From 88ce52dcae961dd02011cde6d2994eb229ef039a Mon Sep 17 00:00:00 2001 From: stonegate Date: Sat, 10 Oct 2020 21:43:45 +0800 Subject: [PATCH] Minor change. --- lib/home/home.dart | 2 +- lib/home/home_menu.dart | 194 +++++++++++++++++++++------------------- 2 files changed, 101 insertions(+), 95 deletions(-) diff --git a/lib/home/home.dart b/lib/home/home.dart index 32f6a2c..b1204aa 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -543,7 +543,7 @@ class __PlaylistButtonState extends State<_PlaylistButton> { @override Widget build(BuildContext context) { - var audio = context.watch(); + final audio = context.watch(); final s = context.s; return Material( color: Colors.transparent, diff --git a/lib/home/home_menu.dart b/lib/home/home_menu.dart index 32410a9..8ea3a0c 100644 --- a/lib/home/home_menu.dart +++ b/lib/home/home_menu.dart @@ -103,108 +103,114 @@ class _PopupMenuState extends State { Widget build(BuildContext context) { var refreshWorker = Provider.of(context, listen: false); final s = context.s; - return 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(); - } - }) - ], - ), - ], + return Material( + 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(); + } + }) + ], + ), + ], + ), ), ), - ), - 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())); + } + }, + ), ); } }