♻️ (Gui) Modify menu and icons

This commit is contained in:
niuhuan 2023-04-07 09:56:11 +08:00
parent 0ff443762b
commit ccae23ed75
8 changed files with 96 additions and 53 deletions

View File

@ -6,6 +6,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/Common.dart';
import 'package:pikapika/basic/config/ImageAddress.dart';
import 'package:pikapika/basic/config/UseApiLoadImage.dart';
import '../Method.dart'; import '../Method.dart';
@ -126,12 +128,45 @@ Future chooseAddressAndSwitch(BuildContext context) async {
} }
} }
Widget addressActionButton(BuildContext context) { Widget addressPopMenu(BuildContext context) {
return IconButton( return PopupMenuButton<int>(
onPressed: () { icon: const Icon(Icons.webhook),
itemBuilder: (BuildContext context) => <PopupMenuItem<int>>[
PopupMenuItem<int>(
value: 0,
child: ListTile(
leading: const Icon(Icons.share),
title: Text("分流 (${currentAddressName()})"),
),
),
PopupMenuItem<int>(
value: 1,
child: ListTile(
leading: const Icon(Icons.image_search),
title: Text("图片分流 (${currentImageAddressName()})"),
),
),
PopupMenuItem<int>(
value: 2,
child: ListTile(
leading: const Icon(Icons.network_ping),
title: Text("用API加载图片 (${currentUseApiLoadImageName()})"),
),
),
],
onSelected: (int value) {
switch (value) {
case 0:
chooseAddressAndSwitch(context); chooseAddressAndSwitch(context);
break;
case 1:
chooseImageAddress(context);
break;
case 2:
chooseUseApiLoadImage(context);
break;
}
}, },
icon: const Icon(Icons.network_ping),
); );
} }

View File

@ -48,8 +48,8 @@ class _CategoriesScreenState extends State<CategoriesScreen> {
return AppBar( return AppBar(
title: const Text('分类'), title: const Text('分类'),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
_searchBar.getSearchAction(context), _searchBar.getSearchAction(context),
], ],
); );

View File

@ -55,8 +55,8 @@ class _ComicsScreenState extends State<ComicsScreen> {
return AppBar( return AppBar(
title: Text(categoryTitle(widget.category)), title: Text(categoryTitle(widget.category)),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
_chooseCategoryAction(), _chooseCategoryAction(),
_categorySearchBar.getSearchAction(context), _categorySearchBar.getSearchAction(context),
], ],
@ -147,8 +147,8 @@ class _ComicsScreenState extends State<ComicsScreen> {
appBar = AppBar( appBar = AppBar(
title: Text(title), title: Text(title),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
_chooseCategoryAction(), _chooseCategoryAction(),
], ],
); );

View File

@ -33,8 +33,8 @@ class _RandomComicsScreenState extends State<RandomComicsScreen> {
appBar: AppBar( appBar: AppBar(
title: const Text('随机本子'), title: const Text('随机本子'),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
], ],
), ),
body: ComicListBuilder(method.randomComics), body: ComicListBuilder(method.randomComics),

View File

@ -34,8 +34,8 @@ class RankingsScreen extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: const Text('排行榜'), title: const Text('排行榜'),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
], ],
), ),
body: DefaultTabController( body: DefaultTabController(

View File

@ -51,8 +51,8 @@ class _SearchScreenState extends State<SearchScreen> {
return AppBar( return AppBar(
title: Text("${categoryTitle(widget.category)} ${widget.keyword}"), title: Text("${categoryTitle(widget.category)} ${widget.keyword}"),
actions: [ actions: [
aPopMenu(context), commonPopMenu(context),
addressActionButton(context), addressPopMenu(context),
_chooseCategoryAction(), _chooseCategoryAction(),
_searchBar.getSearchAction(context), _searchBar.getSearchAction(context),
], ],

View File

@ -4,7 +4,7 @@ import '../../basic/config/ListLayout.dart';
import '../../basic/config/ShadowCategories.dart'; import '../../basic/config/ShadowCategories.dart';
import '../../basic/config/ShadowCategoriesMode.dart'; import '../../basic/config/ShadowCategoriesMode.dart';
Widget aPopMenu(BuildContext context) { Widget commonPopMenu(BuildContext context) {
return PopupMenuButton<int>( return PopupMenuButton<int>(
itemBuilder: (BuildContext context) => <PopupMenuItem<int>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<int>>[
const PopupMenuItem<int>( const PopupMenuItem<int>(

View File

@ -24,6 +24,7 @@ import 'package:pikapika/basic/config/VolumeController.dart';
import 'package:pikapika/screens/components/PkzImages.dart'; import 'package:pikapika/screens/components/PkzImages.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../basic/config/IconLoading.dart'; import '../../basic/config/IconLoading.dart';
import '../../basic/config/UseApiLoadImage.dart';
import '../FilePhotoViewScreen.dart'; import '../FilePhotoViewScreen.dart';
import 'gesture_zoom_box.dart'; import 'gesture_zoom_box.dart';
@ -560,7 +561,7 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
!widget.struct.fullScreen) { !widget.struct.fullScreen) {
return Container(); return Container();
} }
if (widget.readerSliderPosition == ReaderSliderPosition.RIGHT ) { if (widget.readerSliderPosition == ReaderSliderPosition.RIGHT) {
return SafeArea( return SafeArea(
child: Align( child: Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
@ -903,7 +904,7 @@ class _SettingPanelState extends State<_SettingPanel> {
Row( Row(
children: [ children: [
_bottomIcon( _bottomIcon(
icon: Icons.shuffle, icon: Icons.share,
title: currentAddressName(), title: currentAddressName(),
onPressed: () async { onPressed: () async {
await chooseAddressAndSwitch(context); await chooseAddressAndSwitch(context);
@ -911,13 +912,20 @@ class _SettingPanelState extends State<_SettingPanel> {
}, },
), ),
_bottomIcon( _bottomIcon(
icon: Icons.repeat_one, icon: Icons.image_search,
title: currentImageAddressName(), title: currentImageAddressName(),
onPressed: () async { onPressed: () async {
await chooseImageAddress(context); await chooseImageAddress(context);
setState(() {}); setState(() {});
}, },
), ),
_bottomIcon(
icon: Icons.network_ping,
title: currentUseApiLoadImageName(),
onPressed: () {
chooseUseApiLoadImage(context);
},
),
_bottomIcon( _bottomIcon(
icon: Icons.refresh, icon: Icons.refresh,
title: "重载页面", title: "重载页面",
@ -926,11 +934,11 @@ class _SettingPanelState extends State<_SettingPanel> {
widget.onReloadEp(); widget.onReloadEp();
}, },
), ),
_bottomIcon( // _bottomIcon(
icon: Icons.file_download, // icon: Icons.file_download,
title: "下载本作", // title: "下载本作",
onPressed: widget.onDownload, // onPressed: widget.onDownload,
), // ),
], ],
), ),
], ],