From 0a8f622f85cd4b1ddd60de234e9a165af4f9c1e1 Mon Sep 17 00:00:00 2001 From: stonega Date: Fri, 6 Nov 2020 22:08:26 +0800 Subject: [PATCH] Minor change. --- lib/home/about.dart | 2 +- lib/home/home.dart | 7 +- lib/home/home_menu.dart | 195 +++++++++++++++-------------- lib/home/search_podcast.dart | 4 +- lib/main.dart | 8 +- lib/podcasts/podcast_detail.dart | 6 +- lib/podcasts/podcast_manage.dart | 2 +- lib/podcasts/podcast_settings.dart | 97 ++++++++------ lib/settings/settting.dart | 18 +-- lib/widgets/custom_widget.dart | 2 +- 10 files changed, 189 insertions(+), 152 deletions(-) diff --git a/lib/home/about.dart b/lib/home/about.dart index 758b613..ad40469 100644 --- a/lib/home/about.dart +++ b/lib/home/about.dart @@ -5,7 +5,7 @@ import 'package:line_icons/line_icons.dart'; import '../util/extension_helper.dart'; import '../widgets/custom_widget.dart'; -const String version = '0.5.0'; +const String version = '0.5.1'; class AboutApp extends StatefulWidget { @override diff --git a/lib/home/home.dart b/lib/home/home.dart index a0aa1f1..782fdd5 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -149,7 +149,7 @@ class _HomeState extends State with SingleTickerProviderStateMixin { s.featureDiscoverySearchDes, child: IconButton( tooltip: s.add, - splashRadius: 25, + splashRadius: 20, icon: Icon(Icons.add_circle_outline), onPressed: () async { @@ -189,7 +189,10 @@ class _HomeState extends State with SingleTickerProviderStateMixin { title: s.featureDiscoveryOMPL, description: s.featureDiscoveryOMPLDes, - child: PopupMenu()), + child: Padding( + padding: const EdgeInsets.only(right: 5.0), + child: PopupMenu(), + )), ], ), ), diff --git a/lib/home/home_menu.dart b/lib/home/home_menu.dart index 5c68db0..15476f7 100644 --- a/lib/home/home_menu.dart +++ b/lib/home/home_menu.dart @@ -93,109 +93,114 @@ class _PopupMenuState extends State { color: Colors.transparent, borderRadius: BorderRadius.circular(100), clipBehavior: Clip.hardEdge, - child: PopupMenuButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(10))), - elevation: 1, - tooltip: s.menu, - itemBuilder: (context) => [ - PopupMenuItem( - value: 1, - child: Container( - padding: EdgeInsets.only(left: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Icon(LineIcons.cloud_download_alt_solid), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5.0), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - s.homeToprightMenuRefreshAll, - ), - FutureBuilder( - future: _getRefreshDate(context), - builder: (_, snapshot) { - if (snapshot.hasData) { - return Text( - snapshot.data, - style: - TextStyle(color: Colors.red, fontSize: 12), - ); - } else { - return Center(); - } - }) - ], - ), - ], + child: SizedBox( + height: 40, + width: 40, + child: PopupMenuButton( + icon: Icon(Icons.more_vert), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10)), + elevation: 1, + tooltip: s.menu, + itemBuilder: (context) => [ + PopupMenuItem( + value: 1, + child: Container( + padding: EdgeInsets.only(left: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon(LineIcons.cloud_download_alt_solid), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5.0), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + s.homeToprightMenuRefreshAll, + ), + FutureBuilder( + future: _getRefreshDate(context), + builder: (_, snapshot) { + if (snapshot.hasData) { + return Text( + snapshot.data, + style: + TextStyle(color: Colors.red, fontSize: 12), + ); + } else { + return Center(); + } + }) + ], + ), + ], + ), ), ), - ), - PopupMenuItem( - value: 2, - child: Container( - padding: EdgeInsets.only(left: 10), - child: Row( - children: [ - Icon(LineIcons.paperclip_solid), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5.0), - ), - Text(s.homeToprightMenuImportOMPL), - ], + PopupMenuItem( + value: 2, + child: Container( + padding: EdgeInsets.only(left: 10), + child: Row( + children: [ + Icon(LineIcons.paperclip_solid), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5.0), + ), + Text(s.homeToprightMenuImportOMPL), + ], + ), ), ), - ), - PopupMenuItem( - value: 4, - child: Container( - padding: EdgeInsets.only(left: 10), - child: Row( - children: [ - Icon(LineIcons.cog_solid), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5.0), - ), - Text(s.settings), - ], + PopupMenuItem( + value: 4, + child: Container( + padding: EdgeInsets.only(left: 10), + child: Row( + children: [ + Icon(LineIcons.cog_solid), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5.0), + ), + Text(s.settings), + ], + ), ), ), - ), - PopupMenuItem( - value: 5, - child: Container( - padding: EdgeInsets.only(left: 10), - child: Row( - children: [ - Icon(LineIcons.info_circle_solid), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5.0), - ), - Text(s.homeToprightMenuAbout), - ], + PopupMenuItem( + value: 5, + child: Container( + padding: EdgeInsets.only(left: 10), + child: Row( + children: [ + Icon(LineIcons.info_circle_solid), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5.0), + ), + Text(s.homeToprightMenuAbout), + ], + ), ), ), - ), - ], - onSelected: (value) { - if (value == 5) { - Navigator.push( - context, MaterialPageRoute(builder: (context) => AboutApp())); - } else if (value == 2) { - _getFilePath(); - } else if (value == 1) { - refreshWorker.start([]); - } else if (value == 3) { - // setting.theme != 2 ? setting.setTheme(2) : setting.setTheme(1); - } else if (value == 4) { - Navigator.push( - context, MaterialPageRoute(builder: (context) => Settings())); - } - }, + ], + onSelected: (value) { + if (value == 5) { + Navigator.push( + context, MaterialPageRoute(builder: (context) => AboutApp())); + } else if (value == 2) { + _getFilePath(); + } else if (value == 1) { + refreshWorker.start([]); + } else if (value == 3) { + // setting.theme != 2 ? setting.setTheme(2) : setting.setTheme(1); + } else if (value == 4) { + Navigator.push( + context, MaterialPageRoute(builder: (context) => Settings())); + } + }, + ), ), ); } diff --git a/lib/home/search_podcast.dart b/lib/home/search_podcast.dart index 42b2255..1320235 100644 --- a/lib/home/search_podcast.dart +++ b/lib/home/search_podcast.dart @@ -86,7 +86,7 @@ class MyHomePageDelegate extends SearchDelegate { }, child: IconButton( tooltip: context.s.back, - splashRadius: 25, + splashRadius: 20, icon: AnimatedIcon( icon: AnimatedIcons.menu_arrow, progress: transitionAnimation, @@ -115,7 +115,7 @@ class MyHomePageDelegate extends SearchDelegate { if (query.isNotEmpty) IconButton( tooltip: context.s.clear, - splashRadius: 25, + splashRadius: 20, icon: const Icon(Icons.clear), onPressed: () { query = ''; diff --git a/lib/main.dart b/lib/main.dart index e2693a8..12d29b4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,6 +16,7 @@ import 'state/refresh_podcast.dart'; import 'state/search_state.dart'; import 'state/setting_state.dart'; +///Initial theme settings final SettingState themeSetting = SettingState(); Future main() async { timeDilation = 1.0; @@ -52,7 +53,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Consumer( - builder: (_, setting, __) { + builder: (_, setting, child) { return FeatureDiscovery( child: MaterialApp( themeMode: setting.theme, @@ -67,12 +68,11 @@ class MyApp extends StatelessWidget { GlobalCupertinoLocalizations.delegate, ], supportedLocales: S.delegate.supportedLocales, - home: setting.showIntro - ? SlideIntro(goto: Goto.home) - : FeatureDiscovery(child: Home()), + home: setting.showIntro ? SlideIntro(goto: Goto.home) : child, ), ); }, + child: FeatureDiscovery(child: Home()), ); } } diff --git a/lib/podcasts/podcast_detail.dart b/lib/podcasts/podcast_detail.dart index 5e0e735..3dbecf5 100644 --- a/lib/podcasts/podcast_detail.dart +++ b/lib/podcasts/podcast_detail.dart @@ -336,12 +336,12 @@ class _PodcastDetailState extends State { String tooltip, List> itemBuilder, Function(int) onSelected, - bool clip = true}) => + }) => Material( key: UniqueKey(), color: Colors.transparent, borderRadius: BorderRadius.circular(100), - clipBehavior: clip ? Clip.hardEdge : Clip.none, + clipBehavior: Clip.hardEdge, child: PopupMenuButton( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), @@ -358,7 +358,7 @@ class _PodcastDetailState extends State { return _customPopupMenu( tooltip: s.menu, child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), + padding: EdgeInsets.all(10), child: Container( width: 30, height: 30, diff --git a/lib/podcasts/podcast_manage.dart b/lib/podcasts/podcast_manage.dart index 46f1bcb..18a48a3 100644 --- a/lib/podcasts/podcast_manage.dart +++ b/lib/podcasts/podcast_manage.dart @@ -178,7 +178,7 @@ class _PodcastManageState extends State description: s.featureDiscoveryGroupDes, buttonColor: Colors.cyan[500], child: IconButton( - splashRadius: 25, + splashRadius: 20, onPressed: () => showGeneralDialog( context: context, barrierDismissible: true, diff --git a/lib/podcasts/podcast_settings.dart b/lib/podcasts/podcast_settings.dart index b29e636..e927d83 100644 --- a/lib/podcasts/podcast_settings.dart +++ b/lib/podcasts/podcast_settings.dart @@ -205,20 +205,23 @@ class _PodcastSettingState extends State { return ListTile( onTap: () => _setAutoDownload(!snapshot.data), dense: true, - leading: SizedBox( - height: 18, - width: 18, - child: CustomPaint( - painter: DownloadPainter( - color: context.brightness == Brightness.light - ? Colors.grey[600] - : Colors.white, - fraction: 0, - progressColor: context.accentColor, + title: Row( + children: [ + SizedBox( + height: 18, + width: 18, + child: CustomPaint( + painter: DownloadPainter( + color: context.textColor, + fraction: 0, + progressColor: context.accentColor, + ), + ), ), - ), + SizedBox(width: 20), + Text(s.autoDownload, style: textStyle), + ], ), - title: Text(s.autoDownload, style: textStyle), trailing: Transform.scale( scale: 0.8, child: @@ -233,8 +236,13 @@ class _PodcastSettingState extends State { return ListTile( dense: true, onTap: () => _setNeverUpdate(!snapshot.data), - leading: Icon(Icons.lock, size: 18), - title: Text(s.neverAutoUpdate, style: textStyle), + title: Row( + children: [ + Icon(Icons.lock, size: 18), + SizedBox(width: 20), + Text(s.neverAutoUpdate, style: textStyle), + ], + ), trailing: Transform.scale( scale: 0.8, child: @@ -256,8 +264,13 @@ class _PodcastSettingState extends State { }); }, dense: true, - leading: Icon(Icons.fast_forward, size: 18), - title: Text(s.skipSecondsAtStart, style: textStyle), + title: Row( + children: [ + Icon(Icons.fast_forward, size: 18), + SizedBox(width: 20), + Text(s.skipSecondsAtStart, style: textStyle), + ], + ), trailing: Padding( padding: const EdgeInsets.only(right: 10.0), child: Text(snapshot.data.toTime), @@ -282,8 +295,13 @@ class _PodcastSettingState extends State { } }, dense: true, - title: Text(s.refreshArtwork, style: textStyle), - leading: Icon(Icons.refresh, size: 18), + title: Row( + children: [ + Icon(Icons.refresh, size: 18), + SizedBox(width: 20), + Text(s.refreshArtwork, style: textStyle), + ], + ), trailing: Padding( padding: const EdgeInsets.only(right: 15.0), child: SizedBox( @@ -301,19 +319,23 @@ class _PodcastSettingState extends State { }); }, dense: true, - title: Text(s.menuMarkAllListened, - style: textStyle.copyWith( - color: context.accentColor, fontWeight: FontWeight.bold)), - leading: SizedBox( - height: 18, - width: 18, - child: CustomPaint( - painter: ListenedAllPainter( - context.brightness == Brightness.light - ? Colors.grey[600] - : Colors.white, - stroke: 2), - ), + title: Row( + children: [ + SizedBox( + height: 18, + width: 18, + child: CustomPaint( + painter: ListenedAllPainter( + context.accentColor, + stroke: 2), + ), + ), + SizedBox(width: 20), + Text(s.menuMarkAllListened, + style: textStyle.copyWith( + color: context.accentColor, + fontWeight: FontWeight.bold)), + ], ), trailing: Padding( padding: const EdgeInsets.only(right: 10.0), @@ -365,10 +387,15 @@ class _PodcastSettingState extends State { }); }, dense: true, - title: Text(s.remove, - style: textStyle.copyWith( - color: Colors.red, fontWeight: FontWeight.bold)), - leading: Icon(Icons.delete, color: Colors.red, size:18), + title: Row( + children: [ + Icon(Icons.delete, color: Colors.red, size: 18), + SizedBox(width: 20), + Text(s.remove, + style: textStyle.copyWith( + color: Colors.red, fontWeight: FontWeight.bold)), + ], + ), ), if (_removeConfirm) Container( diff --git a/lib/settings/settting.dart b/lib/settings/settting.dart index 5be7384..8919b6c 100644 --- a/lib/settings/settting.dart +++ b/lib/settings/settting.dart @@ -31,14 +31,16 @@ class _SettingsState extends State { Navigator.pop(context); }, dense: true, - leading: Icon( - icon, - size: 20, - ), - title: Text( - name, - maxLines: 2, - style: context.textTheme.bodyText2, + title: Row( + children: [ + Icon(icon, size: 20), + SizedBox(width: 20), + Text( + name, + maxLines: 2, + style: context.textTheme.bodyText2, + ), + ], ), ); diff --git a/lib/widgets/custom_widget.dart b/lib/widgets/custom_widget.dart index c9a191b..b682f73 100644 --- a/lib/widgets/custom_widget.dart +++ b/lib/widgets/custom_widget.dart @@ -1211,7 +1211,7 @@ class CustomBackButton extends StatelessWidget { @override Widget build(BuildContext context) { return IconButton( - splashRadius: 25, + splashRadius: 20, icon: const BackButtonIcon(), tooltip: context.s.back, onPressed: () {