基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
chore: better interface settings page
Prediditd1987734c290
diff --git a/lib/pages/my/my_page.dart b/lib/pages/my/my_page.dartindex 0dc897f6..5c00349e 100644--- a/lib/pages/my/my_page.dart+++ b/lib/pages/my/my_page.dart@@ -66,7 +66,8 @@ class _MyPageState extends State<MyPage> {},leading: const Icon(Icons.download_rounded),title: Text('下载管理', style: TextStyle(fontFamily: fontFamily)),- description: Text('查看和管理离线下载', style: TextStyle(fontFamily: fontFamily)),+ description: Text('查看和管理离线下载',+ style: TextStyle(fontFamily: fontFamily)),),SettingsTile.navigation(onPressed: (_) {@@ -74,7 +75,8 @@ class _MyPageState extends State<MyPage> {},leading: const Icon(Icons.settings_rounded),title: Text('下载设置', style: TextStyle(fontFamily: fontFamily)),- description: Text('配置下载并发数等参数', style: TextStyle(fontFamily: fontFamily)),+ description: Text('配置下载并发数等参数',+ style: TextStyle(fontFamily: fontFamily)),),SettingsTile.navigation(onPressed: (_) {@@ -99,15 +101,6 @@ class _MyPageState extends State<MyPage> {description: Text('设置播放器相关参数',style: TextStyle(fontFamily: fontFamily)),),- SettingsTile.navigation(- onPressed: (_) {- Modular.to.pushNamed('/settings/interface');- },- leading: const Icon(Icons.pages_rounded),- title: Text('界面设置', style: TextStyle(fontFamily: fontFamily)),- description: Text('设置应用界面样式',- style: TextStyle(fontFamily: fontFamily)),- ),SettingsTile.navigation(onPressed: (_) {Modular.to.pushNamed('/settings/danmaku/');@@ -149,6 +142,15 @@ class _MyPageState extends State<MyPage> {description: Text('设置应用主题和刷新率',style: TextStyle(fontFamily: fontFamily)),),+ SettingsTile.navigation(+ onPressed: (_) {+ Modular.to.pushNamed('/settings/interface');+ },+ leading: const Icon(Icons.pages_rounded),+ title: Text('界面设置', style: TextStyle(fontFamily: fontFamily)),+ description: Text('设置应用界面样式',+ style: TextStyle(fontFamily: fontFamily)),+ ),SettingsTile.navigation(onPressed: (_) {Modular.to.pushNamed('/settings/webdav/');@@ -177,4 +179,4 @@ class _MyPageState extends State<MyPage> {),);}-}\ No newline at end of file+}diff --git a/lib/pages/settings/interface_settings.dart b/lib/pages/settings/interface_settings.dartindex dbdda27c..9da58bde 100644--- a/lib/pages/settings/interface_settings.dart+++ b/lib/pages/settings/interface_settings.dart@@ -17,25 +17,14 @@ class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {Box setting = GStorage.setting;late bool showRating;late String defaultPage;+ final MenuController defaultPageMenuController = MenuController();- static const List<DropdownMenuItem> defaultPageSettingList = [- DropdownMenuItem(- value: "/tab/popular/",- child: Text('推荐'),- ),- DropdownMenuItem(- value: "/tab/timeline/",- child: Text('时间表'),- ),- DropdownMenuItem(- value: "/tab/collect/",- child: Text('追番'),- ),- DropdownMenuItem(- value: "/tab/my/",- child: Text('我的'),- ),- ];+ static const Map<String, String> defaultPageMap = {+ '/tab/popular/': '推荐',+ '/tab/timeline/': '时间表',+ '/tab/collect/': '追番',+ '/tab/my/': '我的',+ };@overridevoid initState() {@@ -45,6 +34,13 @@ class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {defaultValue: '/tab/popular/');}+ void updateDefaultPage(String page) {+ setting.put(SettingBoxKey.defaultStartupPage, page);+ setState(() {+ defaultPage = page;+ });+ }+@overrideWidget build(BuildContext context) {final fontFamily = Theme.of(context).textTheme.bodyMedium?.fontFamily;@@ -57,18 +53,48 @@ class _InterfaceSettingsPageState extends State<InterfaceSettingsPage> {sections: [SettingsSection(tiles: [SettingsTile.navigation(+ onPressed: (_) async {+ if (defaultPageMenuController.isOpen) {+ defaultPageMenuController.close();+ } else {+ defaultPageMenuController.open();+ }+ },title: Text('启动界面设置', style: TextStyle(fontFamily: fontFamily)),description: Text('设置应用开启时的默认页面',style: TextStyle(fontFamily: fontFamily)),- trailing: DropdownButton(- value: defaultPage,- items: defaultPageSettingList,- onChanged: (value) async {- await setting.put(SettingBoxKey.defaultStartupPage, value);- setState(() {- defaultPage = value;- });+ value: MenuAnchor(+ consumeOutsideTap: true,+ controller: defaultPageMenuController,+ builder: (_, __, ___) {+ return Text(+ defaultPageMap[defaultPage] ?? '推荐',+ style: TextStyle(fontFamily: fontFamily),+ );},+ menuChildren: [+ for (final entry in defaultPageMap.entries)+ MenuItemButton(+ requestFocusOnHover: false,+ onPressed: () => updateDefaultPage(entry.key),+ child: Container(+ height: 48,+ constraints: BoxConstraints(minWidth: 112),+ child: Align(+ alignment: Alignment.centerLeft,+ child: Text(+ entry.value,+ style: TextStyle(+ color: entry.key == defaultPage+ ? Theme.of(context).colorScheme.primary+ : null,+ fontFamily: fontFamily,+ ),+ ),+ ),+ ),+ ),+ ],),),]),