opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-04 10:44:21 +08:00
parent 14f2c34d21
commit 9cf74c0db6
5 changed files with 288 additions and 248 deletions

View File

@@ -451,32 +451,89 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
),
);
},
title: Text.rich(
TextSpan(
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: MediaQuery.textScalerOf(context).scale(15),
width: 10,
alignment: Alignment.center,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
),
style: TextStyle(fontSize: 14),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text.rich(
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: TextStyle(fontSize: 14),
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: MediaQuery.textScalerOf(context).scale(15),
width: 10,
alignment: Alignment.center,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
),
style: TextStyle(fontSize: 14),
),
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: TextStyle(fontSize: 14),
),
],
),
],
),
),
PopupMenuButton(
initialValue: _blockSettings[index].second,
onSelected: (item) async {
_blockSettings[index].second = item;
await setting.put(
SettingBoxKey.blockSettings,
_blockSettings
.map((item) => item.second.index)
.toList());
setState(() {});
},
itemBuilder: (context) => SkipType.values
.map((item) => PopupMenuItem<SkipType>(
value: item,
child: Text(item.title),
))
.toList(),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_blockSettings[index].second.title,
style: TextStyle(
height: 1,
fontSize: 14,
color: _blockSettings[index].second ==
SkipType.disable
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.7)
: Theme.of(context).colorScheme.secondary,
),
strutStyle: StrutStyle(height: 1, leading: 0),
),
Icon(
MdiIcons.unfoldMoreHorizontal,
size: MediaQuery.textScalerOf(context).scale(14),
color:
_blockSettings[index].second == SkipType.disable
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.7)
: Theme.of(context).colorScheme.secondary,
),
],
),
),
),
],
),
subtitle: Text(
_blockSettings[index].first.description,
@@ -487,48 +544,6 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
: Theme.of(context).colorScheme.outline,
),
),
trailing: PopupMenuButton(
initialValue: _blockSettings[index].second,
onSelected: (item) async {
_blockSettings[index].second = item;
await setting.put(SettingBoxKey.blockSettings,
_blockSettings.map((item) => item.second.index).toList());
setState(() {});
},
itemBuilder: (context) => SkipType.values
.map((item) => PopupMenuItem<SkipType>(
value: item,
child: Text(item.title),
))
.toList(),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_blockSettings[index].second.title,
style: TextStyle(
height: 1,
fontSize: 14,
color:
_blockSettings[index].second == SkipType.disable
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
),
strutStyle: StrutStyle(height: 1, leading: 0),
),
Icon(
MdiIcons.unfoldMoreHorizontal,
size: MediaQuery.textScalerOf(context).scale(14),
color: _blockSettings[index].second == SkipType.disable
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
),
],
),
),
),
),
separatorBuilder: (context, index) => Divider(
height: 1,

View File

@@ -7,6 +7,7 @@ import 'package:PiliPalaX/models/common/dynamics_type.dart';
import 'package:PiliPalaX/models/common/nav_bar_config.dart';
import 'package:PiliPalaX/models/common/rcmd_type.dart';
import 'package:PiliPalaX/models/common/reply_sort_type.dart';
import 'package:PiliPalaX/models/common/theme_type.dart';
import 'package:PiliPalaX/models/common/up_panel_position.dart';
import 'package:PiliPalaX/models/video/play/CDN.dart';
import 'package:PiliPalaX/models/video/play/quality.dart';
@@ -348,31 +349,32 @@ List<SettingsModel> get styleSettings => [
),
),
),
// SettingsModel(
// settingsType: SettingsType.normal,
// onTap: (setState) async {
// ThemeType? result = await showDialog(
// context: Get.context!,
// builder: (context) {
// return SelectDialog<ThemeType>(
// title: '主题模式',
// value: GStorage.themeType,
// values: ThemeType.values.map(
// (e) {
// return {'title': e.description, 'value': e};
// },
// ).toList());
// },
// );
// if (result != null) {
// GStorage.setting.put(SettingBoxKey.themeMode, result.index);
// Get.forceAppUpdate();
// }
// },
// leading: const Icon(Icons.flashlight_on_outlined),
// title: '主题模式',
// getSubtitle: () => '当前模式:${GStorage.themeType.description}',
// ),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) async {
ThemeType? result = await showDialog(
context: Get.context!,
builder: (context) {
return SelectDialog<ThemeType>(
title: '主题模式',
value: GStorage.themeType,
values: ThemeType.values.map(
(e) {
return {'title': e.description, 'value': e};
},
).toList());
},
);
if (result != null) {
GStorage.setting.put(SettingBoxKey.themeMode, result.index);
Get.put(ColorSelectController()).themeType.value = result;
Get.forceAppUpdate();
}
},
leading: const Icon(Icons.flashlight_on_outlined),
title: '主题模式',
getSubtitle: () => '当前模式:${GStorage.themeType.description}',
),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) => Get.toNamed('/colorSetting'),