Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-29 17:55:15 +08:00
parent 21fad89cde
commit 99634a66ab
9 changed files with 107 additions and 134 deletions

View File

@@ -700,9 +700,7 @@ Future<void> audioNormalization(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: ColorScheme.of(context).outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -798,9 +796,7 @@ void _showDynDialog(BuildContext context) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -840,21 +836,20 @@ void _showReplyLengthDialog(BuildContext context, VoidCallback setState) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () async {
Get.back();
int length = int.tryParse(replyLengthLimit) ?? 6;
ReplyItemGrpc.replyLengthLimit = length == 0 ? null : length;
await GStorage.setting.put(
SettingBoxKey.replyLengthLimit,
length,
);
setState();
try {
final val = int.parse(replyLengthLimit);
Get.back();
ReplyItemGrpc.replyLengthLimit = val == 0 ? null : val;
await GStorage.setting.put(SettingBoxKey.replyLengthLimit, val);
setState();
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
child: const Text('确定'),
),
@@ -883,22 +878,22 @@ void _showDmHeightDialog(BuildContext context, VoidCallback setState) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () async {
Get.back();
await GStorage.setting.put(
SettingBoxKey.danmakuLineHeight,
max(
try {
final val = max(
1.0,
double.tryParse(danmakuLineHeight)?.toPrecision(1) ?? 1.6,
),
);
setState();
double.parse(danmakuLineHeight).toPrecision(1),
);
Get.back();
await GStorage.setting.put(SettingBoxKey.danmakuLineHeight, val);
setState();
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
child: const Text('确定'),
),
@@ -927,9 +922,7 @@ void _showTouchSlopDialog(BuildContext context, VoidCallback setState) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -1210,9 +1203,7 @@ void _showProxyDialog(BuildContext context) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -1254,20 +1245,22 @@ void _showCacheDialog(BuildContext context, VoidCallback setState) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () async {
Get.back();
num value = num.tryParse(valueStr) ?? 0;
await GStorage.setting.put(
SettingBoxKey.maxCacheSize,
value * 1024 * 1024,
);
setState();
try {
final val = num.parse(valueStr);
Get.back();
await GStorage.setting.put(
SettingBoxKey.maxCacheSize,
val * 1024 * 1024,
);
setState();
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
child: const Text('确定'),
),

View File

@@ -148,9 +148,7 @@ SettingsModel getBanWordModel({
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -228,15 +226,17 @@ SettingsModel getVideoFilterSelectModel({
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () {
Get.back();
result = int.tryParse(valueStr) ?? 0;
try {
result = int.parse(valueStr);
Get.back();
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
child: const Text('确定'),
),

View File

@@ -249,9 +249,8 @@ List<SettingsModel> get playSettings => [
leading: const Icon(Icons.volume_up_outlined),
setKey: SettingBoxKey.enableBackgroundPlay,
defaultVal: true,
onChanged: (value) {
videoPlayerServiceHandler!.enableBackgroundPlay = value;
},
onChanged: (value) =>
videoPlayerServiceHandler!.enableBackgroundPlay = value,
),
const SwitchModel(
title: '播放器设置仅对当前生效',

View File

@@ -90,9 +90,7 @@ List<SettingsModel> get recommendSettings => [
leading: const Icon(Icons.favorite_border_outlined),
setKey: SettingBoxKey.exemptFilterForFollowed,
defaultVal: true,
onChanged: (value) {
RecommendFilter.exemptFilterForFollowed = value;
},
onChanged: (value) => RecommendFilter.exemptFilterForFollowed = value,
),
SwitchModel(
title: '过滤器也应用于相关视频',
@@ -100,8 +98,6 @@ List<SettingsModel> get recommendSettings => [
leading: const Icon(Icons.explore_outlined),
setKey: SettingBoxKey.applyFilterToRelatedVideos,
defaultVal: true,
onChanged: (value) {
RecommendFilter.applyFilterToRelatedVideos = value;
},
onChanged: (value) => RecommendFilter.applyFilterToRelatedVideos = value,
),
];

View File

@@ -1,5 +1,4 @@
import 'dart:io';
import 'dart:math';
import 'package:PiliPlus/common/widgets/color_palette.dart';
import 'package:PiliPlus/common/widgets/custom_toast.dart';
@@ -83,9 +82,7 @@ List<SettingsModel> get styleSettings => [
setKey: SettingBoxKey.appFontWeight,
defaultVal: false,
leading: const Icon(Icons.text_fields),
onChanged: (value) {
Get.forceAppUpdate();
},
onChanged: (value) => Get.forceAppUpdate(),
onTap: _showFontWeightDialog,
),
NormalModel(
@@ -357,9 +354,7 @@ List<SettingsModel> get styleSettings => [
leading: const Icon(Icons.exit_to_app_outlined),
setKey: SettingBoxKey.directExitOnBack,
defaultVal: false,
onChanged: (value) {
Get.find<MainController>().directExitOnBack = value;
},
onChanged: (value) => Get.find<MainController>().directExitOnBack = value,
),
if (Platform.isAndroid)
NormalModel(
@@ -474,9 +469,7 @@ void _showUiScaleDialog(
onPressed: () => Navigator.pop(context),
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -516,7 +509,7 @@ void _showSpringDurationDialog(BuildContext context) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -602,7 +595,7 @@ void _showSpringDialog(BuildContext context, _) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
@@ -794,12 +787,8 @@ void _showScrollDialog(BuildContext context) {
content: TextFormField(
autofocus: true,
initialValue: scrollThreshold,
keyboardType: const TextInputType.numberWithOptions(
decimal: true,
),
onChanged: (value) {
scrollThreshold = value;
},
keyboardType: const .numberWithOptions(decimal: true),
onChanged: (value) => scrollThreshold = value,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[\d\.]+')),
],
@@ -810,22 +799,19 @@ void _showScrollDialog(BuildContext context) {
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(
onPressed: () {
Get.back();
GStorage.setting.put(
SettingBoxKey.scrollThreshold,
max(
10.0,
double.tryParse(scrollThreshold) ?? 50.0,
),
);
SmartDialog.showToast('重启生效');
try {
final val = double.parse(scrollThreshold);
Get.back();
GStorage.setting.put(SettingBoxKey.scrollThreshold, val);
SmartDialog.showToast('重启生效');
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
child: const Text('确定'),
),

View File

@@ -195,9 +195,7 @@ Future<void> _showLiveCDNDialog(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: ColorScheme.of(context).outline,
),
style: TextStyle(color: ColorScheme.of(context).outline),
),
),
TextButton(