From 9820aed1ffdfbbe57eaa54e931d3a070440a6517 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 12 May 2023 15:20:47 -0600 Subject: [PATCH] show flush bar on desktop instead of dialog --- .../sub_widgets/stack_theme_card.dart | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart index 1f9d4ed0e..7b36c873a 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart @@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/providers/db/main_db_provider.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; @@ -70,22 +71,37 @@ class _StackThemeCardState extends ConsumerState { final message = result ? "${widget.data.name} theme installed!" : "Failed to install ${widget.data.name} theme"; - await showDialog( - context: context, - builder: (_) => StackOkDialog( - title: message, - onOkPressed: (_) { - setState(() { - _hasTheme = result; - }); - }, - ), - ); + if (isDesktop) { + await showFloatingFlushBar( + type: result ? FlushBarType.success : FlushBarType.warning, + message: message, + context: context, + ); + } else { + await showDialog( + context: context, + builder: (_) => StackOkDialog( + title: message, + onOkPressed: (_) { + setState(() { + _hasTheme = result; + }); + }, + ), + ); + } } } Future _uninstallThemePressed() async { await ref.read(pThemeService).remove(themeId: widget.data.id); + if (mounted) { + await showFloatingFlushBar( + type: FlushBarType.success, + message: "${widget.data.name} uninstalled", + context: context, + ); + } } bool get themeIsInUse {