Quick choose shadow mode

This commit is contained in:
niuhuan 2023-02-16 16:14:29 +08:00
parent 0f741b14fb
commit c0662439da
8 changed files with 69 additions and 8 deletions

View File

@ -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, "分流同步", [
"从服务器获取最新的分流地址",
"重制分流为默认值",
]);

View File

@ -53,3 +53,5 @@ IconButton chooseLayoutActionButton(BuildContext context) => IconButton(
},
icon: const Icon(Icons.view_quilt),
);
const chooseListLayout = _chooseListLayout;

View File

@ -79,3 +79,5 @@ Widget shadowCategoriesSetting() {
},
);
}
const chooseShadowCategories = _chooseShadowCategories;

View File

@ -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;

View File

@ -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<CategoriesScreen> {
return AppBar(
title: const Text('分类'),
actions: [
shadowCategoriesActionButton(context),
aPopMenu(context),
_searchBar.getSearchAction(context),
],
);

View File

@ -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<ComicsScreen> {
return AppBar(
title: Text(categoryTitle(widget.category)),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutActionButton(context),
aPopMenu(context),
_chooseCategoryAction(),
_categorySearchBar.getSearchAction(context),
],

View File

@ -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<SearchScreen> {
return AppBar(
title: Text("${categoryTitle(widget.category)} ${widget.keyword}"),
actions: [
shadowCategoriesActionButton(context),
chooseLayoutActionButton(context),
aPopMenu(context),
_chooseCategoryAction(),
_searchBar.getSearchAction(context),
],

View File

@ -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<int>(
itemBuilder: (BuildContext context) => <PopupMenuItem<int>>[
const PopupMenuItem<int>(
value: 0,
child: ListTile(
leading: Icon(Icons.view_quilt),
title: Text("显示模式"),
),
),
const PopupMenuItem<int>(
value: 1,
child: ListTile(
leading: Icon(Icons.do_not_disturb_on_outlined),
title: Text("封印模式"),
),
),
const PopupMenuItem<int>(
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;
}
},
);
}