fix: preserve queued settings and recover interrupted or corrupt state

This commit is contained in:
Codex
2026-10-13 09:32:50 +08:00
parent 5ceab20b67
commit da5b8076a0
16 changed files with 373 additions and 50 deletions
+11 -6
View File
@@ -138,14 +138,16 @@ class _SettingsPageState extends State<SettingsPage> {
label: const Text('多彩'),
selected: s.colorMode == ColorMode.multicolor,
onSelected: (_) => c.updateSettings(
s.copyWith(colorMode: ColorMode.multicolor),
(current) =>
current.copyWith(colorMode: ColorMode.multicolor),
),
),
ChoiceChip(
label: const Text('单色'),
selected: s.colorMode == ColorMode.single,
onSelected: (_) => c.updateSettings(
s.copyWith(colorMode: ColorMode.single),
(current) =>
current.copyWith(colorMode: ColorMode.single),
),
),
],
@@ -166,7 +168,7 @@ class _SettingsPageState extends State<SettingsPage> {
button: true,
child: InkWell(
onTap: () => c.updateSettings(
s.copyWith(
(current) => current.copyWith(
singleColorArgb: color,
colorMode: ColorMode.single,
),
@@ -217,7 +219,8 @@ class _SettingsPageState extends State<SettingsPage> {
await c.enableRemindersFromUserAction();
} else {
await c.updateSettings(
s.copyWith(remindersEnabled: false),
(current) =>
current.copyWith(remindersEnabled: false),
);
}
},
@@ -234,7 +237,9 @@ class _SettingsPageState extends State<SettingsPage> {
onSelected: c.isDemo
? null
: (_) => c.updateSettings(
s.copyWith(reminderMinutes: minutes),
(current) => current.copyWith(
reminderMinutes: minutes,
),
),
),
],
@@ -361,7 +366,7 @@ class _SettingsPageState extends State<SettingsPage> {
});
if (_weeksError != null || _dateError != null) return;
await c.updateSettings(
s.copyWith(
(current) => current.copyWith(
semester: Semester(
startDate: _start!,
totalWeeks: weeks!,