From 5050020287024de32da482179b70870540df8fce Mon Sep 17 00:00:00 2001 From: Liplum Date: Tue, 24 Sep 2024 11:34:49 +0800 Subject: [PATCH] [timetable] push "/timetable/palettes/custom" after adding generated palette --- lib/timetable/p13n/page/background.dart | 6 ++++-- lib/timetable/p13n/utils/generate.dart | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/timetable/p13n/page/background.dart b/lib/timetable/p13n/page/background.dart index 718a05d8..dbc1faf7 100644 --- a/lib/timetable/p13n/page/background.dart +++ b/lib/timetable/p13n/page/background.dart @@ -139,12 +139,14 @@ class _TimetableBackgroundEditorState extends ConsumerState generatePaletteFromImage( return palette; } -Future addPaletteFromImageByGenerator( +Future addPaletteFromImageByGenerator( BuildContext context, ImageProvider img, { int maxColorCount = 12, @@ -47,13 +47,13 @@ Future addPaletteFromImageByGenerator( img, maxColorCount: maxColorCount, ); - if (!context.mounted) return; + if (!context.mounted) return false; final newPalette = await context.showSheet( (ctx) => TimetablePaletteEditorPage(palette: palette), dismissible: false, ); - if (newPalette == null) return; + if (newPalette == null) return false; TimetableInit.storage.palette.add(newPalette); await HapticFeedback.mediumImpact(); - if (!context.mounted) return; + return true; }