From af1cf030b354be89e5a3a7b14ab52b3d567fdda6 Mon Sep 17 00:00:00 2001 From: SliverAppBar Date: Sun, 8 Oct 2023 00:41:24 +0900 Subject: [PATCH 1/2] chore: remove Dart Analysis warnings --- lib/component/hitomi/title_cluster.dart | 2 +- lib/pages/database_download/decompress.dart | 7 +++---- lib/settings/settings.dart | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/component/hitomi/title_cluster.dart b/lib/component/hitomi/title_cluster.dart index 000c8cb03..150e8cc49 100644 --- a/lib/component/hitomi/title_cluster.dart +++ b/lib/component/hitomi/title_cluster.dart @@ -77,7 +77,7 @@ class HitomiTitleCluster { }); // Group By Same Lists - var gg = groupBy(groups, (x) => (x as List).join(',')); + var gg = groupBy(groups, (group) => group.join(',')); var ds = DisjointSet(titles.length); // Join groups diff --git a/lib/pages/database_download/decompress.dart b/lib/pages/database_download/decompress.dart index 272ce15d8..29e21c1a0 100644 --- a/lib/pages/database_download/decompress.dart +++ b/lib/pages/database_download/decompress.dart @@ -78,10 +78,9 @@ class P7zip { final devicePlugin = DeviceInfoPlugin(); final deviceInfo = await devicePlugin.androidInfo; - final supportedAbis = - deviceInfo.supportedAbis.where((abi) => abi != null).cast(); - final targetAbi = - supportedAbis.firstWhere((abi) => libraryAbis.contains(abi)); + final targetAbi = deviceInfo.supportedAbis.firstWhere( + (abi) => libraryAbis.contains(abi), + ); final sharedLibraryPath = 'assets/p7zip/$targetAbi/lib7zr.so'; final sharedLibraryContent = await rootBundle.load(sharedLibraryPath); diff --git a/lib/settings/settings.dart b/lib/settings/settings.dart index ef7dcef06..fa0cb58a7 100644 --- a/lib/settings/settings.dart +++ b/lib/settings/settings.dart @@ -224,7 +224,7 @@ class Settings { if (Platform.isAndroid) { var deviceInfoPlugin = DeviceInfoPlugin(); final androidInfo = await deviceInfoPlugin.androidInfo; - if (androidInfo.version.sdkInt! >= 30) tUseInnerStorage = true; + if (androidInfo.version.sdkInt >= 30) tUseInnerStorage = true; } await prefs.setBool('userinnerstorage', tUseInnerStorage); @@ -237,7 +237,7 @@ class Settings { final String path = await ExtStorage.getExternalStorageDirectory(); var androidInfo = await DeviceInfoPlugin().androidInfo; - var sdkInt = androidInfo.version.sdkInt!; + var sdkInt = androidInfo.version.sdkInt; if (sdkInt >= 30 && prefs.getBool('android30downpath') == null) { await prefs.setBool('android30downpath', true); @@ -394,7 +394,7 @@ class Settings { static Future getDefaultDownloadPath() async { var androidInfo = await DeviceInfoPlugin().androidInfo; - var sdkInt = androidInfo.version.sdkInt!; + var sdkInt = androidInfo.version.sdkInt; if (sdkInt >= 30) { var ext = await getExternalStorageDirectory(); From 692a75fe176e1ae97029e43a2499bc294448339c Mon Sep 17 00:00:00 2001 From: SliverAppBar Date: Sun, 8 Oct 2023 01:55:21 +0900 Subject: [PATCH 2/2] chore: remove Dart Analysis const warnings --- lib/pages/article_info/article_info_page.dart | 16 ++++++++-------- lib/pages/artist_info/article_list_page.dart | 4 ++-- .../bookmark/group/group_article_list_page.dart | 4 ++-- lib/pages/community/community_page.dart | 4 ++-- lib/pages/community/user_status_card.dart | 4 ++-- lib/pages/community/user_status_card_dead.dart | 4 ++-- lib/pages/download/download_page.dart | 8 ++++---- .../info/lab/artist_search/artist_search.dart | 4 ++-- .../lab/bookmark/bookmarks_article_list.dart | 4 ++-- lib/pages/main/info/lab/recent_user_record.dart | 4 ++-- lib/pages/main/info/lab/statistics.dart | 8 ++++---- lib/pages/main/info/violet_page.dart | 4 ++-- lib/pages/search/search_page.dart | 4 ++-- lib/pages/settings/db_rebuild_page.dart | 6 +++--- lib/pages/settings/import_from_eh.dart | 6 +++--- lib/pages/settings/libviolet_page.dart | 6 +++--- lib/pages/splash/splash_page.dart | 4 ++-- lib/pages/viewer/overlay/viewer_thumbnails.dart | 4 ++-- 18 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/pages/article_info/article_info_page.dart b/lib/pages/article_info/article_info_page.dart index cd8ba8fc8..8fdbd9ce1 100644 --- a/lib/pages/article_info/article_info_page.dart +++ b/lib/pages/article_info/article_info_page.dart @@ -559,10 +559,10 @@ class PreviewAreaWidget extends StatelessWidget { }, ); } - return Row( + return const Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ SizedBox( width: 100, height: 100, @@ -686,10 +686,10 @@ class __InfoAreaWidgetState extends State<_InfoAreaWidget> { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + const Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ SizedBox( width: 100, height: 100, @@ -824,13 +824,13 @@ class __InfoAreaWidgetState extends State<_InfoAreaWidget> { ); }, splashColor: Colors.white, - child: ListTile( + child: const ListTile( // dense: true, // contentPadding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0), title: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, - children: const [Text('Write Comment')], + children: [Text('Write Comment')], ), ), ); @@ -966,10 +966,10 @@ class __InfoAreaWidgetState extends State<_InfoAreaWidget> { }, ); } - return Row( + return const Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ SizedBox( width: 100, height: 100, diff --git a/lib/pages/artist_info/article_list_page.dart b/lib/pages/artist_info/article_list_page.dart index 1f8eb0d14..a164787ea 100644 --- a/lib/pages/artist_info/article_list_page.dart +++ b/lib/pages/artist_info/article_list_page.dart @@ -113,12 +113,12 @@ class _ArticleListPageState extends State { elevation: 100, clipBehavior: Clip.antiAliasWithSaveLayer, child: InkWell( - child: SizedBox( + child: const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.formatListText, color: Colors.grey, diff --git a/lib/pages/bookmark/group/group_article_list_page.dart b/lib/pages/bookmark/group/group_article_list_page.dart index 5f5252105..c5354304b 100644 --- a/lib/pages/bookmark/group/group_article_list_page.dart +++ b/lib/pages/bookmark/group/group_article_list_page.dart @@ -313,12 +313,12 @@ class _GroupArticleListPageState extends State { elevation: !Settings.themeFlat ? 100 : 0, clipBehavior: Clip.antiAliasWithSaveLayer, child: InkWell( - child: SizedBox( + child: const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.formatListText, color: Colors.grey, diff --git a/lib/pages/community/community_page.dart b/lib/pages/community/community_page.dart index 4d161c486..214415383 100644 --- a/lib/pages/community/community_page.dart +++ b/lib/pages/community/community_page.dart @@ -172,12 +172,12 @@ class _CommunityPageState extends State height: double.infinity, width: 88, child: _logining - ? SizedBox( + ? const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ SizedBox( height: 30, width: 30, diff --git a/lib/pages/community/user_status_card.dart b/lib/pages/community/user_status_card.dart index 381cc3639..5ad7ea407 100644 --- a/lib/pages/community/user_status_card.dart +++ b/lib/pages/community/user_status_card.dart @@ -197,12 +197,12 @@ class _UserStatusCardState extends ThemeSwitchableState height: double.infinity, width: 88, child: _logining - ? SizedBox( + ? const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ SizedBox( height: 30, width: 30, diff --git a/lib/pages/community/user_status_card_dead.dart b/lib/pages/community/user_status_card_dead.dart index 35d499b94..ed19cfe24 100644 --- a/lib/pages/community/user_status_card_dead.dart +++ b/lib/pages/community/user_status_card_dead.dart @@ -197,12 +197,12 @@ class _UserStatusCardState extends State height: double.infinity, width: 88, child: _logining - ? SizedBox( + ? const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ SizedBox( height: 30, width: 30, diff --git a/lib/pages/download/download_page.dart b/lib/pages/download/download_page.dart index 8579d1ad8..041666b7b 100644 --- a/lib/pages/download/download_page.dart +++ b/lib/pages/download/download_page.dart @@ -526,12 +526,12 @@ class _DownloadPageState extends ThemeSwitchableState clipBehavior: Clip.antiAliasWithSaveLayer, child: InkWell( onTap: _featuresOnTap, - child: SizedBox( + child: const SizedBox( height: 64, width: 64, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.hammerWrench, color: Colors.grey, @@ -605,12 +605,12 @@ class _DownloadPageState extends ThemeSwitchableState onTap: _alignOnTap, onDoubleTap: _alignDoubleTap, onLongPress: _alignLongPress, - child: SizedBox( + child: const SizedBox( height: 64, width: 64, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.formatListText, color: Colors.grey, diff --git a/lib/pages/main/info/lab/artist_search/artist_search.dart b/lib/pages/main/info/lab/artist_search/artist_search.dart index 0044e32f2..490842f69 100644 --- a/lib/pages/main/info/lab/artist_search/artist_search.dart +++ b/lib/pages/main/info/lab/artist_search/artist_search.dart @@ -112,9 +112,9 @@ class _ArtistSearchState extends State { } titleArea() { - return Row( + return const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('Artist Search', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), ], diff --git a/lib/pages/main/info/lab/bookmark/bookmarks_article_list.dart b/lib/pages/main/info/lab/bookmark/bookmarks_article_list.dart index 33bebde83..483fe932f 100644 --- a/lib/pages/main/info/lab/bookmark/bookmarks_article_list.dart +++ b/lib/pages/main/info/lab/bookmark/bookmarks_article_list.dart @@ -221,12 +221,12 @@ class _GroupArticleListPageState extends State { elevation: !Settings.themeFlat ? 100 : 0, clipBehavior: Clip.antiAliasWithSaveLayer, child: InkWell( - child: SizedBox( + child: const SizedBox( height: 48, width: 48, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.formatListText, color: Colors.grey, diff --git a/lib/pages/main/info/lab/recent_user_record.dart b/lib/pages/main/info/lab/recent_user_record.dart index 506d1975d..a8245c858 100644 --- a/lib/pages/main/info/lab/recent_user_record.dart +++ b/lib/pages/main/info/lab/recent_user_record.dart @@ -166,8 +166,8 @@ class _LabUserRecentRecordsState extends State { ); }, ) - : Column( - children: const [ + : const Column( + children: [ Expanded( child: Align( alignment: Alignment.center, diff --git a/lib/pages/main/info/lab/statistics.dart b/lib/pages/main/info/lab/statistics.dart index 19ff82e22..cb7249c46 100644 --- a/lib/pages/main/info/lab/statistics.dart +++ b/lib/pages/main/info/lab/statistics.dart @@ -361,8 +361,8 @@ class _StatisticsState extends State { _heatMap(), ], ) - : Column( - children: const [ + : const Column( + children: [ Expanded( child: Align( alignment: Alignment.center, @@ -445,9 +445,9 @@ class _StatisticsState extends State { Container( height: 16, ), - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Text('나의 통계', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), ], diff --git a/lib/pages/main/info/violet_page.dart b/lib/pages/main/info/violet_page.dart index 1212a9a58..f0cb49f9b 100644 --- a/lib/pages/main/info/violet_page.dart +++ b/lib/pages/main/info/violet_page.dart @@ -40,8 +40,8 @@ class VioletPage extends StatelessWidget { padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), width: 250, height: 190, - child: Column( - children: const [ + child: const Column( + children: [ Text(''), Text( 'Violet', diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index f90c0e17e..b3b8f321b 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -429,12 +429,12 @@ class _SearchPageState extends ThemeSwitchableState final alignOverlay = InkWell( onTap: alignOnTap, onLongPress: alignLongPress, - child: SizedBox( + child: const SizedBox( height: 64, width: 64, child: Stack( alignment: Alignment.center, - children: const [ + children: [ Icon( MdiIcons.formatListText, color: Colors.grey, diff --git a/lib/pages/settings/db_rebuild_page.dart b/lib/pages/settings/db_rebuild_page.dart index 7629d6b88..4286c2a0b 100644 --- a/lib/pages/settings/db_rebuild_page.dart +++ b/lib/pages/settings/db_rebuild_page.dart @@ -61,10 +61,10 @@ class _DBRebuildPagePageState extends State { child: SizedBox( width: 280, height: (56 * 4 + 16).toDouble(), - child: Padding( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), + child: const Padding( + padding: EdgeInsets.fromLTRB(0, 8, 0, 8), child: Stack( - children: const [ + children: [ Center( child: CircularProgressIndicator(), ), diff --git a/lib/pages/settings/import_from_eh.dart b/lib/pages/settings/import_from_eh.dart index e61969e0b..e1a8d4d59 100644 --- a/lib/pages/settings/import_from_eh.dart +++ b/lib/pages/settings/import_from_eh.dart @@ -58,8 +58,8 @@ class _ImportFromEHPageState extends State { child: SizedBox( width: 280, height: (56 * 4 + 16).toDouble(), - child: Padding( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), + child: const Padding( + padding: EdgeInsets.fromLTRB(0, 8, 0, 8), // child: Column( // mainAxisAlignment: MainAxisAlignment.center, // children: [ @@ -70,7 +70,7 @@ class _ImportFromEHPageState extends State { // ], // ), child: Stack( - children: const [ + children: [ Center( child: CircularProgressIndicator(), ), diff --git a/lib/pages/settings/libviolet_page.dart b/lib/pages/settings/libviolet_page.dart index e07d847b0..74deec246 100644 --- a/lib/pages/settings/libviolet_page.dart +++ b/lib/pages/settings/libviolet_page.dart @@ -32,10 +32,10 @@ class LibvioletPage extends StatelessWidget { padding: EdgeInsets.fromLTRB(12, 12, 0, 0), child: Text('What is libviolet?'), ), - expanded: Padding( - padding: const EdgeInsets.fromLTRB(16, 4, 16, 4), + expanded: const Padding( + padding: EdgeInsets.fromLTRB(16, 4, 16, 4), child: Column( - children: const [ + children: [ Text( 'Libviolet is a very fast download library implemented based on Rust. ' 'This download library allows downloads up to the network maximum download speed.', diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 240340fb4..c9ea6b299 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -629,13 +629,13 @@ class _SplashPageState extends State { child: InkWell( customBorder: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8.0))), - child: SizedBox( + child: const SizedBox( width: 150, height: 50, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, - children: const [ + children: [ Icon( Icons.language, size: 35, diff --git a/lib/pages/viewer/overlay/viewer_thumbnails.dart b/lib/pages/viewer/overlay/viewer_thumbnails.dart index 6f8804696..15fd81519 100644 --- a/lib/pages/viewer/overlay/viewer_thumbnails.dart +++ b/lib/pages/viewer/overlay/viewer_thumbnails.dart @@ -189,10 +189,10 @@ class _ViewerThumbnailState extends State { }, ); } - return Row( + return const Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: const [ + children: [ SizedBox( width: 100, height: 100,