From a511c92bf70be9e8c33865e987de3a07eb945dc5 Mon Sep 17 00:00:00 2001 From: Alin Babu Date: Sun, 30 Apr 2023 17:23:21 +0530 Subject: [PATCH] Reformat code in files --- lib/generated/intl/messages_all.dart | 1 + lib/generated/intl/messages_en.dart | 1 + lib/generated/l10n.dart | 2 ++ lib/main.dart | 4 ++-- lib/screens/tasks_screen.dart | 1 - lib/widgets/popup_menu.dart | 36 ++++++++++++++-------------- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/lib/generated/intl/messages_all.dart b/lib/generated/intl/messages_all.dart index 203415c..a929ae8 100644 --- a/lib/generated/intl/messages_all.dart +++ b/lib/generated/intl/messages_all.dart @@ -19,6 +19,7 @@ import 'package:intl/src/intl_helpers.dart'; import 'messages_en.dart' as messages_en; typedef Future LibraryLoader(); + Map _deferredLibraries = { 'en': () => new SynchronousFuture(null), }; diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index dfc1f15..0092994 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -27,6 +27,7 @@ class MessageLookup extends MessageLookupByLibrary { "${Intl.plural(count, one: '1 task', other: '${count} tasks')}"; final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { "appName": MessageLookupByLibrary.simpleMessage("Tasks App"), "appTitle": MessageLookupByLibrary.simpleMessage("Flutter Tasks App"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index d31e4db..5de8718 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -495,8 +495,10 @@ class AppLocalizationDelegate extends LocalizationsDelegate { @override bool isSupported(Locale locale) => _isSupported(locale); + @override Future load(Locale locale) => S.load(locale); + @override bool shouldReload(AppLocalizationDelegate old) => false; diff --git a/lib/main.dart b/lib/main.dart index 74c6f1b..ab414e2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -47,9 +47,9 @@ class TasksApp extends StatelessWidget { child: BlocBuilder( builder: (context, state) { final customThemeMode = - state.isDarkTheme ? ThemeMode.dark : ThemeMode.light; + state.isDarkTheme ? ThemeMode.dark : ThemeMode.light; final themeMode = - state.isSystemTheme ? ThemeMode.system : customThemeMode; + state.isSystemTheme ? ThemeMode.system : customThemeMode; return MaterialApp( onGenerateTitle: (context) => S.of(context).appTitle, theme: AppThemes.appThemeData[AppTheme.lightTheme], diff --git a/lib/screens/tasks_screen.dart b/lib/screens/tasks_screen.dart index 146034c..deb7368 100644 --- a/lib/screens/tasks_screen.dart +++ b/lib/screens/tasks_screen.dart @@ -21,7 +21,6 @@ class TasksScreen extends StatelessWidget { final appLocale = S.of(context); return BlocBuilder( builder: (context, state) { - var tasks = isCompleted == true ? state.completedTasks : isFavorite == true diff --git a/lib/widgets/popup_menu.dart b/lib/widgets/popup_menu.dart index b9a8ebc..f14a0bc 100644 --- a/lib/widgets/popup_menu.dart +++ b/lib/widgets/popup_menu.dart @@ -33,39 +33,39 @@ class PopupMenu extends StatelessWidget { ), ), PopupMenuItem( - onTap: favoriteOrUnfavoriteCallback, - child: PopupTextButton( - icon: + onTap: favoriteOrUnfavoriteCallback, + child: PopupTextButton( + icon: task.isFavorite! ? Icons.favorite_border : Icons.favorite, label: task.isFavorite! ? appLocale.labelUnfavorite : appLocale.labelFavorite, ), - ), - PopupMenuItem( - onTap: cancelOrDeleteCallback, - child: PopupTextButton( + ), + PopupMenuItem( + onTap: cancelOrDeleteCallback, + child: PopupTextButton( icon: Icons.delete, label: appLocale.labelDelete, ), - ), - ] + ), + ] : [ - PopupMenuItem( - onTap: restoreCallback, - child: PopupTextButton( + PopupMenuItem( + onTap: restoreCallback, + child: PopupTextButton( icon: Icons.restore_from_trash, label: appLocale.labelRestore, ), - ), - PopupMenuItem( - onTap: cancelOrDeleteCallback, - child: PopupTextButton( + ), + PopupMenuItem( + onTap: cancelOrDeleteCallback, + child: PopupTextButton( icon: Icons.delete_forever, label: appLocale.labelDeleteForever, ), - ), - ], + ), + ], onSelected: (value) { context.showAddOrEditTaskBottomSheet(task: task); },