diff --git a/lib/basic/config/Address.dart b/lib/basic/config/Address.dart index 1f214fd..7c89354 100644 --- a/lib/basic/config/Address.dart +++ b/lib/basic/config/Address.dart @@ -73,9 +73,9 @@ Widget reloadSwitchAddressSetting() { return StatefulBuilder( builder: (BuildContext context, void Function(void Function()) setState) { return ListTile( - title: const Text("==== 分流 ===="), + title: const Text("分流同步"), onTap: () async { - String? choose = await chooseListDialog(context, "==== 分流 ====", [ + String? choose = await chooseListDialog(context, "分流同步", [ "从服务器获取最新的分流地址", "重制分流为默认值", ]); diff --git a/lib/basic/config/ListLayout.dart b/lib/basic/config/ListLayout.dart index 9644506..f3b6cc6 100644 --- a/lib/basic/config/ListLayout.dart +++ b/lib/basic/config/ListLayout.dart @@ -53,3 +53,5 @@ IconButton chooseLayoutActionButton(BuildContext context) => IconButton( }, icon: const Icon(Icons.view_quilt), ); + +const chooseListLayout = _chooseListLayout; diff --git a/lib/basic/config/ShadowCategories.dart b/lib/basic/config/ShadowCategories.dart index 7afaa66..1fe5a8c 100644 --- a/lib/basic/config/ShadowCategories.dart +++ b/lib/basic/config/ShadowCategories.dart @@ -79,3 +79,5 @@ Widget shadowCategoriesSetting() { }, ); } + +const chooseShadowCategories = _chooseShadowCategories; diff --git a/lib/basic/config/ShadowCategoriesMode.dart b/lib/basic/config/ShadowCategoriesMode.dart index caf11f7..3d3f475 100644 --- a/lib/basic/config/ShadowCategoriesMode.dart +++ b/lib/basic/config/ShadowCategoriesMode.dart @@ -71,3 +71,14 @@ Widget shadowCategoriesModeSetting() { }, ); } + +Widget shadowSwitchActionButton(BuildContext context) { + return IconButton( + onPressed: () { + _chooseShadowCategoriesMode(context); + }, + icon: const Icon(Icons.do_not_disturb_on_outlined), + ); +} + +const chooseShadowCategoriesMode = _chooseShadowCategoriesMode; diff --git a/lib/screens/CategoriesScreen.dart b/lib/screens/CategoriesScreen.dart index cc860fc..a080435 100644 --- a/lib/screens/CategoriesScreen.dart +++ b/lib/screens/CategoriesScreen.dart @@ -16,6 +16,7 @@ import '../basic/config/IconLoading.dart'; import 'ComicsScreen.dart'; import 'GamesScreen.dart'; import 'RandomComicsScreen.dart'; +import 'components/Common.dart'; import 'components/ContentLoading.dart'; import 'components/Images.dart'; @@ -46,7 +47,7 @@ class _CategoriesScreenState extends State { return AppBar( title: const Text('分类'), actions: [ - shadowCategoriesActionButton(context), + aPopMenu(context), _searchBar.getSearchAction(context), ], ); diff --git a/lib/screens/ComicsScreen.dart b/lib/screens/ComicsScreen.dart index d48ed50..e2e2b3a 100644 --- a/lib/screens/ComicsScreen.dart +++ b/lib/screens/ComicsScreen.dart @@ -10,6 +10,7 @@ import '../basic/Entities.dart'; import '../basic/config/IconLoading.dart'; import 'SearchScreen.dart'; import 'components/ComicPager.dart'; +import 'components/Common.dart'; import 'components/RightClickPop.dart'; // 漫画列表 @@ -53,8 +54,7 @@ class _ComicsScreenState extends State { return AppBar( title: Text(categoryTitle(widget.category)), actions: [ - shadowCategoriesActionButton(context), - chooseLayoutActionButton(context), + aPopMenu(context), _chooseCategoryAction(), _categorySearchBar.getSearchAction(context), ], diff --git a/lib/screens/SearchScreen.dart b/lib/screens/SearchScreen.dart index 88ac001..e9dbf71 100644 --- a/lib/screens/SearchScreen.dart +++ b/lib/screens/SearchScreen.dart @@ -3,12 +3,12 @@ import 'package:flutter_search_bar/flutter_search_bar.dart'; import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/config/ShadowCategories.dart'; import 'package:pikapika/basic/store/Categories.dart'; -import 'package:pikapika/basic/config/ListLayout.dart'; import 'package:pikapika/basic/Method.dart'; import 'package:pikapika/screens/components/RightClickPop.dart'; import '../basic/Entities.dart'; import '../basic/config/IconLoading.dart'; import 'components/ComicPager.dart'; +import 'components/Common.dart'; // 搜索页面 class SearchScreen extends StatefulWidget { @@ -50,8 +50,7 @@ class _SearchScreenState extends State { return AppBar( title: Text("${categoryTitle(widget.category)} ${widget.keyword}"), actions: [ - shadowCategoriesActionButton(context), - chooseLayoutActionButton(context), + aPopMenu(context), _chooseCategoryAction(), _searchBar.getSearchAction(context), ], diff --git a/lib/screens/components/Common.dart b/lib/screens/components/Common.dart new file mode 100644 index 0000000..0e13b99 --- /dev/null +++ b/lib/screens/components/Common.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; + +import '../../basic/config/ListLayout.dart'; +import '../../basic/config/ShadowCategories.dart'; +import '../../basic/config/ShadowCategoriesMode.dart'; + +Widget aPopMenu(BuildContext context) { + return PopupMenuButton( + itemBuilder: (BuildContext context) => >[ + const PopupMenuItem( + value: 0, + child: ListTile( + leading: Icon(Icons.view_quilt), + title: Text("显示模式"), + ), + ), + const PopupMenuItem( + value: 1, + child: ListTile( + leading: Icon(Icons.do_not_disturb_on_outlined), + title: Text("封印模式"), + ), + ), + const PopupMenuItem( + value: 2, + child: ListTile( + leading: Icon(Icons.hide_source), + title: Text("封印列表"), + ), + ), + ], + onSelected: (int value) { + switch (value) { + case 0: + chooseListLayout(context); + break; + case 1: + chooseShadowCategoriesMode(context); + break; + case 2: + chooseShadowCategories(context); + break; + } + }, + ); +}