♻️ (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:pikapika/basic/Common.dart';
import 'package:pikapika/basic/config/ImageAddress.dart';
import 'package:pikapika/basic/config/UseApiLoadImage.dart';
import '../Method.dart';
@ -89,7 +91,7 @@ Future chooseAddressAndSwitch(BuildContext context) async {
title: const Text('选择分流'),
children: <Widget>[
..._addresses.entries.map(
(e) => SimpleDialogOption(
(e) => SimpleDialogOption(
child: ApiOptionRow(
e.value,
e.key,
@ -126,12 +128,45 @@ Future chooseAddressAndSwitch(BuildContext context) async {
}
}
Widget addressActionButton(BuildContext context) {
return IconButton(
onPressed: () {
chooseAddressAndSwitch(context);
Widget addressPopMenu(BuildContext context) {
return PopupMenuButton<int>(
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);
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(
title: const Text('分类'),
actions: [
aPopMenu(context),
addressActionButton(context),
commonPopMenu(context),
addressPopMenu(context),
_searchBar.getSearchAction(context),
],
);

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ import '../../basic/config/ListLayout.dart';
import '../../basic/config/ShadowCategories.dart';
import '../../basic/config/ShadowCategoriesMode.dart';
Widget aPopMenu(BuildContext context) {
Widget commonPopMenu(BuildContext context) {
return PopupMenuButton<int>(
itemBuilder: (BuildContext context) => <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:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../basic/config/IconLoading.dart';
import '../../basic/config/UseApiLoadImage.dart';
import '../FilePhotoViewScreen.dart';
import 'gesture_zoom_box.dart';
@ -560,38 +561,38 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
!widget.struct.fullScreen) {
return Container();
}
if (widget.readerSliderPosition == ReaderSliderPosition.RIGHT ) {
if (widget.readerSliderPosition == ReaderSliderPosition.RIGHT) {
return SafeArea(
child: Align(
alignment: Alignment.bottomRight,
child: Material(
color: Colors.transparent,
child: Container(
padding:
alignment: Alignment.bottomRight,
child: Material(
color: Colors.transparent,
child: Container(
padding:
const EdgeInsets.only(left: 10, right: 10, top: 4, bottom: 4),
margin: const EdgeInsets.only(bottom: 10),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
color: Color(0x88000000),
),
child: GestureDetector(
onTap: () {
widget.struct.onFullScreenChange(!widget.struct.fullScreen);
},
child: Icon(
widget.struct.fullScreen
? Icons.fullscreen_exit
: Icons.fullscreen_outlined,
size: 30,
color: Colors.white,
),
),
margin: const EdgeInsets.only(bottom: 10),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
color: Color(0x88000000),
),
child: GestureDetector(
onTap: () {
widget.struct.onFullScreenChange(!widget.struct.fullScreen);
},
child: Icon(
widget.struct.fullScreen
? Icons.fullscreen_exit
: Icons.fullscreen_outlined,
size: 30,
color: Colors.white,
),
),
));
),
),
));
}
return SafeArea(
child: Align(
@ -903,7 +904,7 @@ class _SettingPanelState extends State<_SettingPanel> {
Row(
children: [
_bottomIcon(
icon: Icons.shuffle,
icon: Icons.share,
title: currentAddressName(),
onPressed: () async {
await chooseAddressAndSwitch(context);
@ -911,13 +912,20 @@ class _SettingPanelState extends State<_SettingPanel> {
},
),
_bottomIcon(
icon: Icons.repeat_one,
icon: Icons.image_search,
title: currentImageAddressName(),
onPressed: () async {
await chooseImageAddress(context);
setState(() {});
},
),
_bottomIcon(
icon: Icons.network_ping,
title: currentUseApiLoadImageName(),
onPressed: () {
chooseUseApiLoadImage(context);
},
),
_bottomIcon(
icon: Icons.refresh,
title: "重载页面",
@ -926,11 +934,11 @@ class _SettingPanelState extends State<_SettingPanel> {
widget.onReloadEp();
},
),
_bottomIcon(
icon: Icons.file_download,
title: "下载本作",
onPressed: widget.onDownload,
),
// _bottomIcon(
// icon: Icons.file_download,
// title: "下载本作",
// onPressed: widget.onDownload,
// ),
],
),
],