diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d29021..ba4de9f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -22,7 +22,7 @@ linter: # producing the lint. rules: # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/lib/src/api/comments.dart b/lib/src/api/comments.dart index 56e8ba5..07e347e 100644 --- a/lib/src/api/comments.dart +++ b/lib/src/api/comments.dart @@ -148,7 +148,7 @@ class APIComments { final response = await httpClient.get(Uri.https(server, path, query)); - httpErrorHandler(response, message: "Failed to load user"); + httpErrorHandler(response, message: 'Failed to load user'); final json = jsonDecode(response.body) as Map; @@ -302,7 +302,7 @@ class APIComments { }), ); - httpErrorHandler(response, message: "Failed to edit comment"); + httpErrorHandler(response, message: 'Failed to edit comment'); return CommentModel.fromMbin( jsonDecode(response.body) as Map); @@ -319,7 +319,7 @@ class APIComments { }), ); - httpErrorHandler(response, message: "Failed to edit comment"); + httpErrorHandler(response, message: 'Failed to edit comment'); return CommentModel.fromLemmy( jsonDecode(response.body)['comment_view'] as Map); @@ -333,7 +333,7 @@ class APIComments { final response = await httpClient.delete(Uri.https(server, path)); - httpErrorHandler(response, message: "Failed to delete comment"); + httpErrorHandler(response, message: 'Failed to delete comment'); case ServerSoftware.lemmy: const path = '/api/v3/comment/delete'; @@ -347,7 +347,7 @@ class APIComments { }), ); - httpErrorHandler(response, message: "Failed to delete comment"); + httpErrorHandler(response, message: 'Failed to delete comment'); } } @@ -363,7 +363,7 @@ class APIComments { }), ); - httpErrorHandler(response, message: "Failed to report comment"); + httpErrorHandler(response, message: 'Failed to report comment'); case ServerSoftware.lemmy: const path = '/api/v3/comment/report'; @@ -377,7 +377,7 @@ class APIComments { }), ); - httpErrorHandler(response, message: "Failed to report comment"); + httpErrorHandler(response, message: 'Failed to report comment'); } } } diff --git a/lib/src/api/microblogs.dart b/lib/src/api/microblogs.dart index f4b3391..4d51fc1 100644 --- a/lib/src/api/microblogs.dart +++ b/lib/src/api/microblogs.dart @@ -101,7 +101,7 @@ class MbinAPIMicroblogs { body: jsonEncode({'body': body, 'lang': lang, 'isAdult': isAdult}), ); - httpErrorHandler(response, message: "Failed to edit post"); + httpErrorHandler(response, message: 'Failed to edit post'); return PostModel.fromMbinPost( jsonDecode(response.body) as Map); @@ -114,7 +114,7 @@ class MbinAPIMicroblogs { final response = await httpClient.delete(Uri.https(server, path)); - httpErrorHandler(response, message: "Failed to delete post"); + httpErrorHandler(response, message: 'Failed to delete post'); } Future create( @@ -128,7 +128,7 @@ class MbinAPIMicroblogs { final response = await httpClient.post(Uri.https(server, path), body: jsonEncode({'body': body, 'lang': lang, 'isAdult': isAdult})); - httpErrorHandler(response, message: "Failed to create post"); + httpErrorHandler(response, message: 'Failed to create post'); return PostModel.fromMbinPost( jsonDecode(response.body) as Map); @@ -160,7 +160,7 @@ class MbinAPIMicroblogs { var response = await http.Response.fromStream(await httpClient.send(request)); - httpErrorHandler(response, message: "Failed to create post"); + httpErrorHandler(response, message: 'Failed to create post'); return PostModel.fromMbinPost( jsonDecode(response.body) as Map); @@ -176,6 +176,6 @@ class MbinAPIMicroblogs { }), ); - httpErrorHandler(response, message: "Failed to report post"); + httpErrorHandler(response, message: 'Failed to report post'); } } diff --git a/lib/src/api/threads.dart b/lib/src/api/threads.dart index 9275af0..cbb7821 100644 --- a/lib/src/api/threads.dart +++ b/lib/src/api/threads.dart @@ -88,7 +88,7 @@ class APIThreads { final response = await httpClient.get(Uri.https(server, path, query)); - httpErrorHandler(response, message: "Failed to load user"); + httpErrorHandler(response, message: 'Failed to load user'); final json = jsonDecode(response.body) as Map; @@ -224,7 +224,7 @@ class APIThreads { }), ); - httpErrorHandler(response, message: "Failed to edit entry"); + httpErrorHandler(response, message: 'Failed to edit entry'); return PostModel.fromMbinEntry( jsonDecode(response.body) as Map); @@ -256,7 +256,7 @@ class APIThreads { final response = await httpClient.delete(Uri.https(server, '/api/entry/$postID')); - httpErrorHandler(response, message: "Failed to delete entry"); + httpErrorHandler(response, message: 'Failed to delete entry'); break; case ServerSoftware.lemmy: @@ -266,7 +266,7 @@ class APIThreads { body: jsonEncode({'post_id': postID, 'deleted': true}), ); - httpErrorHandler(response, message: "Failed to delete entry"); + httpErrorHandler(response, message: 'Failed to delete entry'); break; } } @@ -296,7 +296,7 @@ class APIThreads { }), ); - httpErrorHandler(response, message: "Failed to create entry"); + httpErrorHandler(response, message: 'Failed to create entry'); return PostModel.fromMbinEntry( jsonDecode(response.body) as Map); @@ -348,7 +348,7 @@ class APIThreads { }), ); - httpErrorHandler(response, message: "Failed to create entry"); + httpErrorHandler(response, message: 'Failed to create entry'); return PostModel.fromMbinEntry( jsonDecode(response.body) as Map); @@ -409,7 +409,7 @@ class APIThreads { var response = await http.Response.fromStream(await httpClient.send(request)); - httpErrorHandler(response, message: "Failed to create entry"); + httpErrorHandler(response, message: 'Failed to create entry'); return PostModel.fromMbinEntry( jsonDecode(response.body) as Map); @@ -429,7 +429,7 @@ class APIThreads { var pictrsResponse = await http.Response.fromStream(await httpClient.send(request)); - httpErrorHandler(pictrsResponse, message: "Failed to upload image"); + httpErrorHandler(pictrsResponse, message: 'Failed to upload image'); final json = jsonDecode(pictrsResponse.body) as Map; @@ -468,7 +468,7 @@ class APIThreads { }), ); - httpErrorHandler(response, message: "Failed to report post"); + httpErrorHandler(response, message: 'Failed to report post'); case ServerSoftware.lemmy: const path = '/api/v3/post/report'; @@ -482,7 +482,7 @@ class APIThreads { }), ); - httpErrorHandler(response, message: "Failed to report post"); + httpErrorHandler(response, message: 'Failed to report post'); } } } diff --git a/lib/src/api/users.dart b/lib/src/api/users.dart index 4c7c127..33b1e72 100644 --- a/lib/src/api/users.dart +++ b/lib/src/api/users.dart @@ -67,7 +67,7 @@ class APIUsers { final response = await httpClient.get(Uri.https(server, path, query)); - httpErrorHandler(response, message: "Failed to load user"); + httpErrorHandler(response, message: 'Failed to load user'); return DetailedUserModel.fromLemmy( jsonDecode(response.body) as Map); @@ -95,7 +95,7 @@ class APIUsers { final response = await httpClient.get(Uri.https(server, path, query)); - httpErrorHandler(response, message: "Failed to load user"); + httpErrorHandler(response, message: 'Failed to load user'); return DetailedUserModel.fromLemmy( jsonDecode(response.body) as Map); @@ -166,7 +166,7 @@ class APIUsers { headers: {'Content-Type': 'application/json'}, body: jsonEncode({'bio': about})); - httpErrorHandler(response, message: "Failed to load user"); + httpErrorHandler(response, message: 'Failed to load user'); return null; } @@ -199,7 +199,7 @@ class APIUsers { }), ); - httpErrorHandler(response, message: "Failed to send block"); + httpErrorHandler(response, message: 'Failed to send block'); return DetailedUserModel.fromLemmy( jsonDecode(response.body) as Map); @@ -259,7 +259,7 @@ class APIUsers { }), ); - httpErrorHandler(response, message: "Failed to update avatar"); + httpErrorHandler(response, message: 'Failed to update avatar'); return null; } @@ -332,7 +332,7 @@ class APIUsers { 'banner': 'https://$server/pictrs/image/$imageName', })); - httpErrorHandler(response, message: "Failed to update cover"); + httpErrorHandler(response, message: 'Failed to update cover'); return null; } diff --git a/lib/src/screens/create_screen.dart b/lib/src/screens/create_screen.dart index f599784..8566ca2 100644 --- a/lib/src/screens/create_screen.dart +++ b/lib/src/screens/create_screen.dart @@ -86,7 +86,7 @@ class _CreateScreenState extends State { magazineId, title: _titleTextController.text, image: _imageFile!, - alt: "", + alt: '', isOc: _isOc, body: _bodyTextController.text, lang: _lang, @@ -118,7 +118,7 @@ class _CreateScreenState extends State { await api.microblogs.createImage( magazineId, image: _imageFile!, - alt: "", + alt: '', body: _bodyTextController.text, lang: _lang, isAdult: _isAdult, @@ -145,7 +145,7 @@ class _CreateScreenState extends State { padding: const EdgeInsets.all(5), child: TextEditor( _titleTextController, - label: "Title", + label: 'Title', ), ), if (_imageFile == null || widget.type == PostType.microblog) @@ -167,7 +167,7 @@ class _CreateScreenState extends State { child: TextEditor( _urlTextController, keyboardType: TextInputType.url, - label: "URL", + label: 'URL', onChanged: (_) => setState(() {}), ), ), @@ -194,7 +194,7 @@ class _CreateScreenState extends State { padding: const EdgeInsets.all(5), child: TextEditor( _tagsTextController, - label: "Tags", + label: 'Tags', hint: 'Separate with spaces', ), ), diff --git a/lib/src/screens/explore/domain_screen.dart b/lib/src/screens/explore/domain_screen.dart index e1a1c59..bc3e685 100644 --- a/lib/src/screens/explore/domain_screen.dart +++ b/lib/src/screens/explore/domain_screen.dart @@ -100,7 +100,7 @@ class _DomainScreenState extends State { }, icon: const Icon(Icons.block), style: ButtonStyle( - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( _data!.isBlockedByUser == true ? Theme.of(context).colorScheme.error : Theme.of(context).disabledColor), diff --git a/lib/src/screens/explore/domains_screen.dart b/lib/src/screens/explore/domains_screen.dart index 40a2e51..fff3b1a 100644 --- a/lib/src/screens/explore/domains_screen.dart +++ b/lib/src/screens/explore/domains_screen.dart @@ -22,7 +22,7 @@ class DomainsScreen extends StatefulWidget { class _DomainsScreenState extends State { MbinAPIDomainsFilter filter = MbinAPIDomainsFilter.all; - String search = ""; + String search = ''; final PagingController _pagingController = PagingController(firstPageKey: ''); diff --git a/lib/src/screens/explore/magazine_screen.dart b/lib/src/screens/explore/magazine_screen.dart index d239c30..9a6666e 100644 --- a/lib/src/screens/explore/magazine_screen.dart +++ b/lib/src/screens/explore/magazine_screen.dart @@ -139,7 +139,7 @@ class _MagazineScreenState extends State { }, icon: const Icon(Icons.block), style: ButtonStyle( - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( _data!.isBlockedByUser == true ? Theme.of(context).colorScheme.error : Theme.of(context).disabledColor), diff --git a/lib/src/screens/explore/magazines_screen.dart b/lib/src/screens/explore/magazines_screen.dart index 655a824..8a6da0a 100644 --- a/lib/src/screens/explore/magazines_screen.dart +++ b/lib/src/screens/explore/magazines_screen.dart @@ -25,7 +25,7 @@ class MagazinesScreen extends StatefulWidget { class _MagazinesScreenState extends State { APIMagazinesFilter filter = APIMagazinesFilter.all; APIMagazinesSort sort = APIMagazinesSort.hot; - String search = ""; + String search = ''; final searchDebounce = Debouncer(duration: const Duration(milliseconds: 500)); final PagingController _pagingController = diff --git a/lib/src/screens/explore/search_screen.dart b/lib/src/screens/explore/search_screen.dart index 152b229..c8b01f6 100644 --- a/lib/src/screens/explore/search_screen.dart +++ b/lib/src/screens/explore/search_screen.dart @@ -29,7 +29,7 @@ class SearchScreen extends StatefulWidget { } class _SearchScreenState extends State { - String search = ""; + String search = ''; final searchDebounce = Debouncer(duration: const Duration(milliseconds: 500)); final PagingController _pagingController = @@ -77,7 +77,7 @@ class _SearchScreenState extends State { decoration: const InputDecoration( contentPadding: EdgeInsets.all(12), border: OutlineInputBorder(), - label: Text("Search"), + label: Text('Search'), ), ), ), @@ -129,7 +129,7 @@ class _SearchScreenState extends State { case CommentModel item: return PostCommentScreen(item.postType, item.id); case _: - throw "Unrecognized search item"; + throw 'Unrecognized search item'; } }), ); @@ -243,7 +243,7 @@ class _SearchScreenState extends State { ), ]), ), - _ => const Text("Unknown"), + _ => const Text('Unknown'), }, ); }), diff --git a/lib/src/screens/explore/user_screen.dart b/lib/src/screens/explore/user_screen.dart index 89135f0..c433893 100644 --- a/lib/src/screens/explore/user_screen.dart +++ b/lib/src/screens/explore/user_screen.dart @@ -174,7 +174,7 @@ class _UserScreenState extends State { }); }); })), - child: const Text("Edit"), + child: const Text('Edit'), ), ), ) @@ -260,7 +260,7 @@ class _UserScreenState extends State { }, icon: const Icon(Icons.block), style: ButtonStyle( - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( user.isBlockedByUser == true ? Theme.of(context).colorScheme.error : Theme.of(context).disabledColor), diff --git a/lib/src/screens/profile/message_item.dart b/lib/src/screens/profile/message_item.dart index f65d1d2..5090046 100644 --- a/lib/src/screens/profile/message_item.dart +++ b/lib/src/screens/profile/message_item.dart @@ -21,7 +21,7 @@ class MessageItem extends StatelessWidget { context .watch() .selectedAccount - .split("@") + .split('@') .first) .first; diff --git a/lib/src/screens/profile/message_thread_screen.dart b/lib/src/screens/profile/message_thread_screen.dart index 0602ad9..9e20611 100644 --- a/lib/src/screens/profile/message_thread_screen.dart +++ b/lib/src/screens/profile/message_thread_screen.dart @@ -47,7 +47,7 @@ class _MessageThreadScreenState extends State { context .watch() .selectedAccount - .split("@") + .split('@') .first) .first; diff --git a/lib/src/screens/profile/profile_edit_screen.dart b/lib/src/screens/profile/profile_edit_screen.dart index cb15c36..eb92b7a 100644 --- a/lib/src/screens/profile/profile_edit_screen.dart +++ b/lib/src/screens/profile/profile_edit_screen.dart @@ -172,7 +172,7 @@ class _ProfileEditScreen extends State { ]), Row( children: [ - const Text("Select Avatar"), + const Text('Select Avatar'), Padding( padding: const EdgeInsets.all(12), child: ImageSelector( @@ -187,13 +187,13 @@ class _ProfileEditScreen extends State { _deleteAvatar = true; }); }, - child: const Text("Delete"), + child: const Text('Delete'), ) ], ), Row( children: [ - const Text("Select Cover"), + const Text('Select Cover'), Padding( padding: const EdgeInsets.all(12), child: ImageSelector( @@ -209,7 +209,7 @@ class _ProfileEditScreen extends State { _deleteCover = true; }); }, - child: const Text("Delete"), + child: const Text('Delete'), ) ], ), @@ -217,7 +217,7 @@ class _ProfileEditScreen extends State { padding: const EdgeInsets.only(top: 12), child: MarkdownEditor( _aboutTextController!, - label: "About", + label: 'About', ), ), if (_settings != null) @@ -227,11 +227,11 @@ class _ProfileEditScreen extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "Settings", + 'Settings', style: Theme.of(context).textTheme.titleLarge, ), SwitchListTile( - title: const Text("Show NSFW"), + title: const Text('Show NSFW'), value: _settings!.showNSFW, onChanged: (bool value) { setState(() { @@ -242,7 +242,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.blurNSFW != null) SwitchListTile( - title: const Text("Blur NSFW"), + title: const Text('Blur NSFW'), value: _settings!.blurNSFW!, onChanged: (bool? value) { setState(() { @@ -253,7 +253,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showReadPosts != null) SwitchListTile( - title: const Text("Show read posts"), + title: const Text('Show read posts'), value: _settings!.showReadPosts!, onChanged: (bool? value) { setState(() { @@ -264,7 +264,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showSubscribedUsers != null) SwitchListTile( - title: const Text("Show subscribed users"), + title: const Text('Show subscribed users'), value: _settings!.showSubscribedUsers!, onChanged: (bool? value) { setState(() { @@ -275,7 +275,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showSubscribedMagazines != null) SwitchListTile( - title: const Text("Show subscribed magazines"), + title: const Text('Show subscribed magazines'), value: _settings!.showSubscribedMagazines!, onChanged: (bool? value) { setState(() { @@ -286,7 +286,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showSubscribedDomains != null) SwitchListTile( - title: const Text("Show subscribed domains"), + title: const Text('Show subscribed domains'), value: _settings!.showSubscribedDomains!, onChanged: (bool? value) { setState(() { @@ -297,7 +297,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showProfileSubscriptions != null) SwitchListTile( - title: const Text("Show profile subscriptions"), + title: const Text('Show profile subscriptions'), value: _settings!.showProfileSubscriptions!, onChanged: (bool? value) { setState(() { @@ -308,7 +308,7 @@ class _ProfileEditScreen extends State { ), if (_settings!.showProfileFollowings != null) SwitchListTile( - title: const Text("Show profile followings"), + title: const Text('Show profile followings'), value: _settings!.showProfileFollowings!, onChanged: (bool? value) { setState(() { @@ -320,7 +320,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewEntry != null) SwitchListTile( title: const Text( - "Notify on new threads in subscribed magazines"), + 'Notify on new threads in subscribed magazines'), value: _settings!.notifyOnNewEntry!, onChanged: (bool? value) { setState(() { @@ -332,7 +332,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewPost != null) SwitchListTile( title: const Text( - "Notify on new microblog in subscribed magazines"), + 'Notify on new microblog in subscribed magazines'), value: _settings!.notifyOnNewPost!, onChanged: (bool? value) { setState(() { @@ -344,7 +344,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewEntryReply != null) SwitchListTile( title: const Text( - "Notify on comments in authored threads"), + 'Notify on comments in authored threads'), value: _settings!.notifyOnNewEntryReply!, onChanged: (bool? value) { setState(() { @@ -356,7 +356,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewEntryCommentReply != null) SwitchListTile( title: - const Text("Notify on thread comment reply"), + const Text('Notify on thread comment reply'), value: _settings!.notifyOnNewEntryCommentReply!, onChanged: (bool? value) { setState(() { @@ -369,7 +369,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewPostReply != null) SwitchListTile( title: const Text( - "Notify on comments in authored microposts"), + 'Notify on comments in authored microblogs'), value: _settings!.notifyOnNewPostReply!, onChanged: (bool? value) { setState(() { @@ -381,7 +381,7 @@ class _ProfileEditScreen extends State { if (_settings!.notifyOnNewPostCommentReply != null) SwitchListTile( title: const Text( - "Notify on microblog comment reply"), + 'Notify on microblog comment reply'), value: _settings!.notifyOnNewPostCommentReply!, onChanged: (bool? value) { setState(() { diff --git a/lib/src/screens/settings/general_settings.dart b/lib/src/screens/settings/general_settings.dart index cc4fa97..b5c7756 100644 --- a/lib/src/screens/settings/general_settings.dart +++ b/lib/src/screens/settings/general_settings.dart @@ -305,7 +305,7 @@ const SelectionMenu themeModeSelect = SelectionMenu( ); SelectionMenu themeSelect = SelectionMenu( - "Theme Accent Color", + 'Theme Accent Color', themes .map((themeInfo) => SelectionMenuItem( value: themeInfo.name, diff --git a/lib/src/screens/settings/settings_controller.dart b/lib/src/screens/settings/settings_controller.dart index 3eb6f25..b4ee31e 100644 --- a/lib/src/screens/settings/settings_controller.dart +++ b/lib/src/screens/settings/settings_controller.dart @@ -141,60 +141,60 @@ class SettingsController with ChangeNotifier { _themeMode = parseEnum( ThemeMode.values, ThemeMode.system, - prefs.getString("themeMode"), + prefs.getString('themeMode'), ); - _useDynamicColor = prefs.getBool("useDynamicColor") ?? true; - _accentColor = prefs.getString("accentColor") ?? "Default"; + _useDynamicColor = prefs.getBool('useDynamicColor') ?? true; + _accentColor = prefs.getString('accentColor') ?? 'Default'; - _alwaysShowInstance = prefs.getBool("alwaysShowInstance") ?? false; + _alwaysShowInstance = prefs.getBool('alwaysShowInstance') ?? false; _postImagePosition = parseEnum( PostImagePosition.values, PostImagePosition.auto, - prefs.getString("postImagePosition"), + prefs.getString('postImagePosition'), ); - _postCompactPreview = prefs.getBool("postCompactPreview") ?? false; + _postCompactPreview = prefs.getBool('postCompactPreview') ?? false; _feedActionBackToTop = parseEnum( ActionLocation.values, ActionLocation.fabMenu, - prefs.getString("feedActionBackToTop"), + prefs.getString('feedActionBackToTop'), ); _feedActionCreatePost = parseEnum( ActionLocation.values, ActionLocation.fabMenu, - prefs.getString("feedActionCreatePost"), + prefs.getString('feedActionCreatePost'), ); _feedActionExpandFab = parseEnum( ActionLocation.values, ActionLocation.fabTap, - prefs.getString("feedActionExpandFab"), + prefs.getString('feedActionExpandFab'), ); _feedActionRefresh = parseEnum( ActionLocation.values, ActionLocation.fabMenu, - prefs.getString("feedActionRefresh"), + prefs.getString('feedActionRefresh'), ); _feedActionSetFilter = parseEnum( ActionLocationWithTabs.values, ActionLocationWithTabs.tabs, - prefs.getString("feedActionSetFilter"), + prefs.getString('feedActionSetFilter'), ); _feedActionSetSort = parseEnum( ActionLocation.values, ActionLocation.appBar, - prefs.getString("feedActionSetSort"), + prefs.getString('feedActionSetSort'), ); _feedActionSetType = parseEnum( ActionLocationWithTabs.values, ActionLocationWithTabs.appBar, - prefs.getString("feedActionSetType"), + prefs.getString('feedActionSetType'), ); _defaultFeedType = parseEnum( PostType.values, PostType.thread, - prefs.getString("defaultFeedType"), + prefs.getString('defaultFeedType'), ); _defaultEntriesFeedSort = parseEnum( FeedSort.values, @@ -214,14 +214,14 @@ class SettingsController with ChangeNotifier { _defaultCommentSort = parseEnum( CommentSort.values, CommentSort.hot, - prefs.getString("defaultCommentSort"), + prefs.getString('defaultCommentSort'), ); - _useAccountLangFilter = prefs.getBool("useAccountLangFilter") ?? true; - _langFilter = prefs.getStringList("langFilter")?.toSet() ?? {}; - _defaultCreateLang = prefs.getString("defaultCreateLang") ?? 'en'; + _useAccountLangFilter = prefs.getBool('useAccountLangFilter') ?? true; + _langFilter = prefs.getStringList('langFilter')?.toSet() ?? {}; + _defaultCreateLang = prefs.getString('defaultCreateLang') ?? 'en'; - _stars = prefs.getStringList("stars")?.toSet() ?? {}; + _stars = prefs.getStringList('stars')?.toSet() ?? {}; _feedFilters = prefs.getStringList('feedFilters')?.toSet() ?? {}; _regenerateFeedFiltersRegExp(); diff --git a/lib/src/utils/themes.dart b/lib/src/utils/themes.dart index 86e324f..8fadcec 100644 --- a/lib/src/utils/themes.dart +++ b/lib/src/utils/themes.dart @@ -22,11 +22,9 @@ class ThemeInfo { onError: Color(0xFFFFFFFF), errorContainer: Color(0xFFF9DEDC), onErrorContainer: Color(0xFF410E0B), - background: Color(0xFFFFFBFE), - onBackground: Color(0xFF1C1B1F), surface: Color(0xFFFFFBFE), onSurface: Color(0xFF1C1B1F), - surfaceVariant: Color(0xFFE7E0EC), + surfaceContainerHighest: Color(0xFFE7E0EC), onSurfaceVariant: Color(0xFF49454F), outline: Color(0xFF79747E), outlineVariant: Color(0xFFCAC4D0), @@ -56,11 +54,9 @@ class ThemeInfo { onError: Color(0xFF601410), errorContainer: Color(0xFF8C1D18), onErrorContainer: Color(0xFFF9DEDC), - background: Color(0xFF1C1B1F), - onBackground: Color(0xFFE6E1E5), surface: Color(0xFF1C1B1F), onSurface: Color(0xFFE6E1E5), - surfaceVariant: Color(0xFF49454F), + surfaceContainerHighest: Color(0xFF49454F), onSurfaceVariant: Color(0xFFCAC4D0), outline: Color(0xFF938F99), outlineVariant: Color(0xFF49454F), @@ -75,8 +71,8 @@ class ThemeInfo { } final List themes = [ - ThemeInfo("Default"), - ThemeInfo("Catppuccin", + ThemeInfo('Default'), + ThemeInfo('Cappuccino', lightMode: const ColorScheme( brightness: Brightness.light, primary: Color(0xFFDCE0E8), @@ -85,8 +81,6 @@ final List themes = [ onSecondary: Color(0xFFEA76CB), error: Color(0xFFACB0BE), onError: Color(0xFFD20F39), - background: Color(0xFFEFF1F5), - onBackground: Color(0xFF4C4F69), surface: Color(0xFFCCD0DA), onSurface: Color(0xFF4C4F69), ), @@ -98,13 +92,11 @@ final List themes = [ onSecondary: Color(0xFFF5C2E7), error: Color(0xFF585B70), onError: Color(0xFFF38BA8), - background: Color(0xFF1E1E2E), - onBackground: Color(0xFFCDD6F4), surface: Color(0xFF313244), onSurface: Color(0xFFCDD6F4), )), ThemeInfo( - "Blue", + 'Blue', lightMode: ColorScheme.fromSwatch( primarySwatch: Colors.blue, backgroundColor: const Color(0xFFFFFBFE)), darkMode: ColorScheme.fromSwatch( @@ -114,7 +106,7 @@ final List themes = [ ), ), ThemeInfo( - "Purple", + 'Purple', lightMode: ColorScheme.fromSwatch( primarySwatch: Colors.purple, ), @@ -124,7 +116,7 @@ final List themes = [ ), ), ThemeInfo( - "Red", + 'Red', lightMode: ColorScheme.fromSwatch( primarySwatch: Colors.red, ), @@ -134,7 +126,7 @@ final List themes = [ ), ), ThemeInfo( - "Amber", + 'Amber', lightMode: ColorScheme.fromSwatch( primarySwatch: Colors.amber, ), diff --git a/lib/src/utils/utils.dart b/lib/src/utils/utils.dart index e860b2c..d2a7b29 100644 --- a/lib/src/utils/utils.dart +++ b/lib/src/utils/utils.dart @@ -17,35 +17,35 @@ String timeDiffFormat(DateTime input) { if (difference.inDays > 0) { var years = (difference.inDays / 365).truncate(); if (years >= 1) { - return "${years}Y"; + return '${years}Y'; } var months = (difference.inDays / 30).truncate(); if (months >= 1) { - return "${months}M"; + return '${months}M'; } var weeks = (difference.inDays / 7).truncate(); if (weeks >= 1) { - return "${weeks}w"; + return '${weeks}w'; } var days = difference.inDays; - return "${days}d"; + return '${days}d'; } var hours = difference.inHours; if (hours > 0) { - return "${hours}h"; + return '${hours}h'; } var minutes = difference.inMinutes; if (minutes > 0) { - return "${minutes}m"; + return '${minutes}m'; } var seconds = difference.inSeconds; - return "${seconds}s"; + return '${seconds}s'; } void httpErrorHandler(http.Response response, {String? message}) { @@ -84,7 +84,7 @@ T? whenLoggedIn( context .read() .selectedAccount - .split("@") + .split('@') .first == matchesUsername) ? value diff --git a/lib/src/widgets/content_item.dart b/lib/src/widgets/content_item.dart index 34b4c1e..9bf923b 100644 --- a/lib/src/widgets/content_item.dart +++ b/lib/src/widgets/content_item.dart @@ -476,7 +476,7 @@ class _ContentItemState extends State { context, widget.openLinkUri!), child: const Padding( padding: EdgeInsets.all(12), - child: Text("Open Link")), + child: Text('Open Link')), ), if (widget.onReport != null) MenuItemButton( @@ -491,7 +491,7 @@ class _ContentItemState extends State { }, child: const Padding( padding: EdgeInsets.all(12), - child: Text("Report")), + child: Text('Report')), ), if (widget.onEdit != null) MenuItemButton( @@ -502,7 +502,7 @@ class _ContentItemState extends State { }), child: const Padding( padding: EdgeInsets.all(12), - child: Text("Edit")), + child: Text('Edit')), ), if (widget.onDelete != null) MenuItemButton( @@ -536,7 +536,7 @@ class _ContentItemState extends State { ), child: const Padding( padding: EdgeInsets.all(12), - child: Text("Delete")), + child: Text('Delete')), ), ], ), diff --git a/lib/src/widgets/markdown/markdown_subscript_superscript.dart b/lib/src/widgets/markdown/markdown_subscript_superscript.dart index 8f13500..7257a37 100644 --- a/lib/src/widgets/markdown/markdown_subscript_superscript.dart +++ b/lib/src/widgets/markdown/markdown_subscript_superscript.dart @@ -7,7 +7,7 @@ class SubscriptMarkdownSyntax extends md.InlineSyntax { @override bool onMatch(md.InlineParser parser, Match match) { - parser.addNode(md.Element.text("sub", match[1]!)); + parser.addNode(md.Element.text('sub', match[1]!)); return true; } } @@ -17,7 +17,7 @@ class SuperscriptMarkdownSyntax extends md.InlineSyntax { @override bool onMatch(md.InlineParser parser, Match match) { - parser.addNode(md.Element.text("sup", match[1]!)); + parser.addNode(md.Element.text('sup', match[1]!)); return true; } } diff --git a/lib/src/widgets/redirect_listen.dart b/lib/src/widgets/redirect_listen.dart index 9d32ec0..d617308 100644 --- a/lib/src/widgets/redirect_listen.dart +++ b/lib/src/widgets/redirect_listen.dart @@ -26,9 +26,9 @@ class _RedirectListenerState extends State { final req = await server.first; final result = req.uri; req.response.statusCode = 200; - req.response.headers.set("content-type", "text/plain"); + req.response.headers.set('content-type', 'text/plain'); req.response.writeln( - "Redirect received. You can close this tab now and return to the app."); + 'Redirect received. You can close this tab now and return to the app.'); await req.response.close(); await server.close(); return result;