mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-23 10:36:24 +08:00
committed by
GitHub
parent
acb3784071
commit
218e829fd4
@@ -14,6 +14,7 @@ import 'package:PiliPlus/models/common/audio_normalization.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/dynamics_type.dart';
|
||||
import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/models/common/home_tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/member/tab_type.dart';
|
||||
import 'package:PiliPlus/models/common/msg/msg_unread_type.dart';
|
||||
import 'package:PiliPlus/models/common/nav_bar_config.dart';
|
||||
@@ -591,8 +592,8 @@ List<SettingsModel> get styleSettings => [
|
||||
return SelectDialog<int>(
|
||||
title: '首页启动页',
|
||||
value: GStorage.defaultHomePage,
|
||||
values: defaultNavigationBars.map((e) {
|
||||
return (e['id'] as int, e['label'] as String);
|
||||
values: NavigationBarType.values.map((e) {
|
||||
return (e.index, e.label);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
@@ -606,7 +607,7 @@ List<SettingsModel> get styleSettings => [
|
||||
leading: const Icon(Icons.home_outlined),
|
||||
title: '默认启动页',
|
||||
getSubtitle: () =>
|
||||
'当前启动页:${defaultNavigationBars.firstWhere((e) => e['id'] == GStorage.defaultHomePage)['label']}',
|
||||
'当前启动页:${NavigationBarType.values.firstWhere((e) => e.index == GStorage.defaultHomePage).label}',
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.normal,
|
||||
@@ -699,15 +700,24 @@ List<SettingsModel> get styleSettings => [
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.normal,
|
||||
onTap: (setState) => Get.toNamed('/tabbarSetting'),
|
||||
onTap: (setState) => Get.toNamed('/barSetting', arguments: {
|
||||
'key': SettingBoxKey.tabBarSort,
|
||||
'defaultBars': HomeTabType.values,
|
||||
'title': '首页标签页'
|
||||
}),
|
||||
title: '首页标签页',
|
||||
subtitle: '删除或调换首页标签页',
|
||||
leading: const Icon(Icons.toc_outlined),
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.normal,
|
||||
onTap: (setState) => Get.toNamed('/navbarSetting'),
|
||||
onTap: (setState) => Get.toNamed('/barSetting', arguments: {
|
||||
'key': SettingBoxKey.navBarSort,
|
||||
'defaultBars': NavigationBarType.values,
|
||||
'title': 'Navbar'
|
||||
}),
|
||||
title: 'Navbar编辑',
|
||||
subtitle: '删除或调换Navbar',
|
||||
leading: const Icon(Icons.toc_outlined),
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
import 'package:PiliPlus/models/common/video/audio_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
class SetSelectItem extends StatefulWidget {
|
||||
final String? title;
|
||||
final String? subTitle;
|
||||
final String? setKey;
|
||||
const SetSelectItem({
|
||||
this.title,
|
||||
this.subTitle,
|
||||
this.setKey,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SetSelectItem> createState() => _SetSelectItemState();
|
||||
}
|
||||
|
||||
class _SetSelectItemState extends State<SetSelectItem> {
|
||||
late dynamic currentVal;
|
||||
late int currentIndex;
|
||||
late List menus;
|
||||
late List<PopupMenuEntry> popMenuItems;
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
late String defaultVal;
|
||||
switch (widget.setKey) {
|
||||
case 'defaultVideoQa':
|
||||
defaultVal = VideoQuality.values.last.description;
|
||||
List<VideoQuality> list = menus = VideoQuality.values.reversed.toList();
|
||||
currentVal = setting.get(widget.setKey, defaultValue: defaultVal);
|
||||
currentIndex =
|
||||
list.firstWhere((i) => i.description == currentVal).index;
|
||||
|
||||
popMenuItems = [
|
||||
for (var i in list) ...[
|
||||
PopupMenuItem(
|
||||
value: i.code,
|
||||
child: Text(i.description),
|
||||
)
|
||||
]
|
||||
];
|
||||
|
||||
break;
|
||||
case 'defaultAudioQa':
|
||||
defaultVal = AudioQuality.values.last.description;
|
||||
List<AudioQuality> list = menus = AudioQuality.values.reversed.toList();
|
||||
currentVal = setting.get(widget.setKey, defaultValue: defaultVal);
|
||||
currentIndex =
|
||||
list.firstWhere((i) => i.description == currentVal).index;
|
||||
|
||||
popMenuItems = [
|
||||
for (var i in list) ...[
|
||||
PopupMenuItem(
|
||||
value: i.index,
|
||||
child: Text(i.description),
|
||||
),
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'defaultDecode':
|
||||
defaultVal = VideoDecodeFormatType.values[0].description;
|
||||
currentVal = setting.get(widget.setKey, defaultValue: defaultVal);
|
||||
List<VideoDecodeFormatType> list = menus = VideoDecodeFormatType.values;
|
||||
|
||||
currentIndex =
|
||||
list.firstWhere((i) => i.description == currentVal).index;
|
||||
|
||||
popMenuItems = [
|
||||
for (var i in list) ...[
|
||||
PopupMenuItem(
|
||||
value: i.index,
|
||||
child: Text(i.description),
|
||||
),
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'defaultVideoSpeed':
|
||||
defaultVal = '1.0';
|
||||
currentVal = setting.get(widget.setKey, defaultValue: defaultVal);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
TextStyle subTitleStyle =
|
||||
theme.textTheme.labelMedium!.copyWith(color: theme.colorScheme.outline);
|
||||
return ListTile(
|
||||
onTap: () {},
|
||||
title: Text(widget.title!),
|
||||
subtitle: Text(
|
||||
'当前${widget.title!} $currentVal',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
trailing: PopupMenuButton(
|
||||
initialValue: currentIndex,
|
||||
icon: const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
size: 22,
|
||||
),
|
||||
onSelected: (item) {
|
||||
currentVal = menus.firstWhere((e) => e.code == item).first;
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (BuildContext context) =>
|
||||
<PopupMenuEntry>[...popMenuItems],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user