Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-23 16:47:11 +08:00
parent 148e0872b4
commit 418a1e8d39
821 changed files with 29467 additions and 25520 deletions

View File

@@ -42,8 +42,10 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
if (widget.setKey == SettingBoxKey.appFontWeight) {
val = Pref.appFontWeight != -1;
} else {
val = GStorage.setting
.get(widget.setKey, defaultValue: widget.defaultVal ?? false);
val = GStorage.setting.get(
widget.setKey,
defaultValue: widget.defaultVal ?? false,
);
}
}
@@ -82,8 +84,10 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
TextButton(
onPressed: () async {
Get.back();
await GStorage.setting
.put(SettingBoxKey.badCertificateCallback, true);
await GStorage.setting.put(
SettingBoxKey.badCertificateCallback,
true,
);
val = true;
SmartDialog.showToast('重启生效');
setState(() {});
@@ -114,13 +118,16 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
TextStyle titleStyle = widget.titleStyle ??
TextStyle titleStyle =
widget.titleStyle ??
theme.textTheme.titleMedium!.copyWith(
color:
widget.onTap != null && !val ? theme.colorScheme.outline : null,
color: widget.onTap != null && !val
? theme.colorScheme.outline
: null,
);
TextStyle subTitleStyle =
theme.textTheme.labelMedium!.copyWith(color: theme.colorScheme.outline);
TextStyle subTitleStyle = theme.textTheme.labelMedium!.copyWith(
color: theme.colorScheme.outline,
);
return ListTile(
contentPadding: widget.contentPadding,
enabled: widget.onTap != null ? val : true,
@@ -136,8 +143,9 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
alignment: Alignment.centerRight,
scale: 0.8,
child: Switch(
thumbIcon:
WidgetStateProperty.resolveWith<Icon?>((Set<WidgetState> states) {
thumbIcon: WidgetStateProperty.resolveWith<Icon?>((
Set<WidgetState> states,
) {
if (states.isNotEmpty && states.first == WidgetState.selected) {
return const Icon(Icons.done);
}