From 73a32349e01f5dcd10fc2b00f91a0bf78cb45b18 Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Thu, 30 Oct 2025 07:00:21 +0100 Subject: [PATCH] add durations to snackbars --- app/lib/utils/ui_helper.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/lib/utils/ui_helper.dart b/app/lib/utils/ui_helper.dart index 35b0d037..efc20b9d 100644 --- a/app/lib/utils/ui_helper.dart +++ b/app/lib/utils/ui_helper.dart @@ -61,6 +61,7 @@ void showTabOpenedMessage( BuildContext context, { String? tabName, void Function()? onShow, + Duration duration = const Duration(seconds: 3), }) { final message = switch (tabName.whenNotEmpty) { String() => "New tab '$tabName' opened in background", @@ -72,6 +73,7 @@ void showTabOpenedMessage( action: onShow.mapNotNull( (onPressed) => SnackBarAction(label: 'Show', onPressed: onPressed), ), + duration: duration, ); ScaffoldMessenger.of(context).showSnackBar(snackBar); @@ -106,6 +108,7 @@ void showTabSwitchMessage( BuildContext context, { String? tabName, void Function()? onSwitch, + Duration duration = const Duration(seconds: 3), }) { ScaffoldMessenger.of(context).clearSnackBars(); @@ -119,6 +122,7 @@ void showTabSwitchMessage( action: onSwitch.mapNotNull( (onPressed) => SnackBarAction(label: 'Switch', onPressed: onPressed), ), + duration: duration, ); ScaffoldMessenger.of(context).showSnackBar(snackBar);