Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the deprecated WillPopScope to PopScope #222

Merged
merged 12 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
}
}
4 changes: 2 additions & 2 deletions lib/config/theme_switcher_clipper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class ThemeSwitcherClipper extends StatefulWidget {
final Function(bool) onTap;

const ThemeSwitcherClipper({
Key? key,
super.key,
required this.isDarkMode,
required this.onTap,
required Icon child,
}) : super(key: key);
});

@override
_ThemeSwitcherClipperState createState() => _ThemeSwitcherClipperState();
Expand Down
2 changes: 1 addition & 1 deletion lib/drawer/filter_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:taskwarrior/widgets/tag_filter.dart';

// ignore: must_be_immutable
class FilterDrawer extends StatelessWidget {
FilterDrawer(this.filters, {Key? key}) : super(key: key);
FilterDrawer(this.filters, {super.key});
var tileColor = AppSettings.isDarkMode
? const Color.fromARGB(255, 48, 46, 46)
: const Color.fromARGB(255, 220, 216, 216);
Expand Down
4 changes: 2 additions & 2 deletions lib/drawer/nav_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class NavDrawer extends StatefulWidget {
final Function() notifyParent;

const NavDrawer({
Key? key,
super.key,
required this.storageWidget,
required this.notifyParent,
}) : super(key: key);
});

@override
_NavDrawerState createState() => _NavDrawerState();
Expand Down
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Future init() async {
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
@override
// ignore: library_private_types_in_public_api
_MyAppState createState() => _MyAppState();
Expand Down Expand Up @@ -134,7 +134,7 @@ class CheckOnboardingStatus extends StatelessWidget {
final OnboardingController onboardingController =
Get.put(OnboardingController());

CheckOnboardingStatus({Key? key}) : super(key: key);
CheckOnboardingStatus({super.key});

@override
Widget build(BuildContext context) {
Expand Down
8 changes: 4 additions & 4 deletions lib/model/storage/storage_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class TagMetadata {
}

class StorageWidget extends StatefulWidget {
const StorageWidget({Key? key, required this.profile, required this.child})
: super(key: key);
const StorageWidget({super.key, required this.profile, required this.child});

final Directory profile;
final Widget child;
Expand Down Expand Up @@ -428,8 +427,9 @@ class _StorageWidgetState extends State<StorageWidget> {
}

class InheritedStorage extends InheritedModel<String> {
// ignore: use_super_parameters
const InheritedStorage({
Key? key,
super.key,
required this.storage,
required this.tasks,
required this.pendingTags,
Expand Down Expand Up @@ -462,7 +462,7 @@ class InheritedStorage extends InheritedModel<String> {
required this.tabAlias,
required this.serverCertExists,
required child,
}) : super(key: key, child: child);
}) : super(child: child);

final Storage storage;
final List<Task> tasks;
Expand Down
1 change: 1 addition & 0 deletions lib/services/notification_services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class NotificationService {
notificationDetails,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
// ignore: deprecated_member_use
androidAllowWhileIdle: true);
if (kDebugMode) {
print(scheduledAt.day * 100 + scheduledAt.hour * 10 + scheduledAt.minute);
Expand Down
95 changes: 48 additions & 47 deletions lib/services/task_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:taskwarrior/widgets/taskdetails.dart';
import 'package:taskwarrior/widgets/taskw.dart';

class DetailRoute extends StatefulWidget {
const DetailRoute(this.uuid, {Key? key}) : super(key: key);
const DetailRoute(this.uuid, {super.key});

final String uuid;

Expand Down Expand Up @@ -60,7 +60,49 @@ class _DetailRouteState extends State<DetailRoute> {

@override
Widget build(BuildContext context) {
return WillPopScope(
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
if (didPop) {
await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false);
}
// ignore: use_build_context_synchronously
return showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Do you want to save changes?'),
actions: [
TextButton(
onPressed: () {
saveChanges();
Navigator.of(context).pop();
setState(() {});
},
child: const Text('Yes'),
),
TextButton(
onPressed: () {
Navigator.of(context).pushNamedAndRemoveUntil(
HomePage.routeName,
(route) => false,
);
},
child: const Text('No'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Cancel'),
),
],
);
},
);
},
child: Scaffold(
backgroundColor: AppSettings.isDarkMode
? const Color.fromARGB(255, 29, 29, 29)
Expand Down Expand Up @@ -148,47 +190,6 @@ class _DetailRouteState extends State<DetailRoute> {
child: const Icon(Icons.save),
),
),
onWillPop: () async {
if (modify.changes.isNotEmpty) {
return await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Do you want to save changes?'),
actions: [
TextButton(
onPressed: () {
saveChanges();
Navigator.of(context).pop();
setState(() {});
},
child: const Text('Yes'),
),
TextButton(
onPressed: () {
Navigator.of(context).pushNamedAndRemoveUntil(
HomePage.routeName,
(route) => false,
);
},
child: const Text('No'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Cancel'),
),
],
);
},
);
} else {
return await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false);
}
},
);
}
}
Expand All @@ -198,8 +199,8 @@ class AttributeWidget extends StatelessWidget {
required this.name,
required this.value,
required this.callback,
Key? key,
}) : super(key: key);
super.key,
});

final String name;
final dynamic value;
Expand Down Expand Up @@ -319,8 +320,8 @@ class TagsWidget extends StatelessWidget {
required this.name,
required this.value,
required this.callback,
Key? key,
}) : super(key: key);
super.key,
});

final String name;
final dynamic value;
Expand Down
3 changes: 1 addition & 2 deletions lib/services/task_list_tem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import '../model/storage/storage_widget.dart';

class TaskListItem extends StatefulWidget {
const TaskListItem(this.task,
{this.pendingFilter = false, Key? key, required this.darkmode})
: super(key: key);
{this.pendingFilter = false, super.key, required this.darkmode});

final Task task;
final bool pendingFilter;
Expand Down
7 changes: 3 additions & 4 deletions lib/taskserver/ntaskserver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'package:taskwarrior/widgets/taskserver.dart';
import 'package:url_launcher/url_launcher.dart';

class ManageTaskServer extends StatefulWidget {
const ManageTaskServer({Key? key}) : super(key: key);
const ManageTaskServer({super.key});

@override
State<ManageTaskServer> createState() => _ManageTaskServerState();
Expand Down Expand Up @@ -692,10 +692,9 @@ class PemWidget extends StatefulWidget {
const PemWidget(
{required this.storage,
required this.pem,
Key? key,
super.key,
required this.optionString,
required this.listTileTitle})
: super(key: key);
required this.listTileTitle});

final Storage storage;
final String pem;
Expand Down
2 changes: 1 addition & 1 deletion lib/views/Onboarding/onboarding_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:taskwarrior/views/Onboarding/Components/size_config.dart';
import 'package:taskwarrior/views/home/home.dart';

class OnboardingScreen extends StatefulWidget {
const OnboardingScreen({Key? key}) : super(key: key);
const OnboardingScreen({super.key});

@override
State<OnboardingScreen> createState() => _OnboardingScreenState();
Expand Down
2 changes: 1 addition & 1 deletion lib/views/about/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:taskwarrior/widgets/pallete.dart';
import 'package:url_launcher/url_launcher.dart';

class AboutPage extends StatefulWidget {
const AboutPage({Key? key}) : super(key: key);
const AboutPage({super.key});
@override
// ignore: library_private_types_in_public_api
_AboutPageState createState() => _AboutPageState();
Expand Down
2 changes: 1 addition & 1 deletion lib/views/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Filters {
class HomePage extends StatefulWidget {
static const String routeName = '/home';

const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});
@override
_HomePageState createState() => _HomePageState();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/views/profile/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:taskwarrior/widgets/taskdetails.dart';
class ProfilePage extends StatefulWidget {
static const String routeName = '/profile';

const ProfilePage({Key? key}) : super(key: key);
const ProfilePage({super.key});
@override
// ignore: library_private_types_in_public_api
_ProfilePageState createState() => _ProfilePageState();
Expand Down Expand Up @@ -156,8 +156,8 @@ class ProfilesColumn extends StatelessWidget {
this.export,
this.copy,
this.delete, {
Key? key,
}) : super(key: key);
super.key,
});

final Map profilesMap;
final String currentProfile;
Expand Down
2 changes: 1 addition & 1 deletion lib/views/reports/pages/burndown_daily.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart';
import 'package:path_provider/path_provider.dart';

class BurnDownDaily extends StatefulWidget {
const BurnDownDaily({Key? key}) : super(key: key);
const BurnDownDaily({super.key});

@override
State<BurnDownDaily> createState() => _BurnDownDailyState();
Expand Down
2 changes: 1 addition & 1 deletion lib/views/reports/pages/burndown_monthly.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import 'package:taskwarrior/views/reports/widgets/commonChartIndicator.dart';
import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart';

class BurnDownMonthlt extends StatefulWidget {
const BurnDownMonthlt({Key? key}) : super(key: key);
const BurnDownMonthlt({super.key});

@override
State<BurnDownMonthlt> createState() => _BurnDownMonthltState();
Expand Down
2 changes: 1 addition & 1 deletion lib/views/reports/pages/burndown_weekly.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:taskwarrior/widgets/taskdetails/profiles_widget.dart';
import 'package:path_provider/path_provider.dart';

class BurnDownWeekly extends StatefulWidget {
const BurnDownWeekly({Key? key}) : super(key: key);
const BurnDownWeekly({super.key});

@override
State<BurnDownWeekly> createState() => _BurnDownWeeklyState();
Expand Down
4 changes: 2 additions & 2 deletions lib/views/reports/reports_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import 'package:path_provider/path_provider.dart';

class ReportsHome extends StatefulWidget {
const ReportsHome({
Key? key,
}) : super(key: key);
super.key,
});

@override
State<ReportsHome> createState() => _ReportsHomeState();
Expand Down
2 changes: 1 addition & 1 deletion lib/views/reports/widgets/commonChartIndicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:taskwarrior/config/taskwarriorcolors.dart';
///Common widget for Report chart indicator
class CommonChartIndicator extends StatelessWidget {
final String title;
const CommonChartIndicator({Key? key, required this.title}) : super(key: key);
const CommonChartIndicator({super.key, required this.title});

@override
Widget build(BuildContext context) {
Expand Down
5 changes: 2 additions & 3 deletions lib/views/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import 'package:taskwarrior/widgets/pallete.dart';

class SettingsPage extends StatefulWidget {
SettingsPage(
{Key? key,
{super.key,
required this.isSyncOnStartActivel,
required this.isSyncOnTaskCreateActivel})
: super(key: key);
required this.isSyncOnTaskCreateActivel});
bool isSyncOnStartActivel;
bool isSyncOnTaskCreateActivel;

Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/add_Task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:taskwarrior/widgets/taskfunctions/taskparser.dart';
import 'package:taskwarrior/widgets/taskw.dart';

class AddTaskBottomSheet extends StatefulWidget {
const AddTaskBottomSheet({Key? key}) : super(key: key);
const AddTaskBottomSheet({super.key});
@override
_AddTaskBottomSheetState createState() => _AddTaskBottomSheetState();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/app_placeholder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:taskwarrior/config/app_settings.dart';
import 'package:taskwarrior/widgets/pallete.dart';

class AppSetupPlaceholder extends StatelessWidget {
const AppSetupPlaceholder({Key? key}) : super(key: key);
const AppSetupPlaceholder({super.key});

@override
Widget build(BuildContext context) {
Expand Down
Loading
Loading