mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
show flush bar on desktop instead of dialog
This commit is contained in:
parent
664a8212fd
commit
9820aed1ff
1 changed files with 27 additions and 11 deletions
|
@ -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<StackThemeCard> {
|
|||
final message = result
|
||||
? "${widget.data.name} theme installed!"
|
||||
: "Failed to install ${widget.data.name} theme";
|
||||
await showDialog<void>(
|
||||
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<void>(
|
||||
context: context,
|
||||
builder: (_) => StackOkDialog(
|
||||
title: message,
|
||||
onOkPressed: (_) {
|
||||
setState(() {
|
||||
_hasTheme = result;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _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 {
|
||||
|
|
Loading…
Reference in a new issue