mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 19:14:42 +08:00
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user