From 8bed1d3b74e769302b09acf79b359724d5f6b28b Mon Sep 17 00:00:00 2001 From: CCXXXI Date: Sun, 3 Oct 2021 04:54:10 +0800 Subject: [PATCH] fix: avoid multiple snackbars --- lib/settings/theme.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/settings/theme.dart b/lib/settings/theme.dart index 19f5f2fe..77ce42a1 100644 --- a/lib/settings/theme.dart +++ b/lib/settings/theme.dart @@ -32,8 +32,12 @@ ThemeData get theme => ThemeData.from( // void updateTheme() => Get.changeTheme(theme); // todo: wait for https://github.com/jonataslaw/getx/issues/1878 -void updateTheme() => Get.snackbar( +void updateTheme() { + if (!(Get.isSnackbarOpen ?? false)) { + Get.snackbar( '主题切换目前有 bug,请手动重启以使更改生效', 'https://github.com/jonataslaw/getx/issues/1878', - duration: const Duration(seconds: 10), + duration: const Duration(days: 42), ); + } +}