Skip to content

Commit 73a3234

Browse files
committed
add durations to snackbars
1 parent 3955859 commit 73a3234

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/lib/utils/ui_helper.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void showTabOpenedMessage(
6161
BuildContext context, {
6262
String? tabName,
6363
void Function()? onShow,
64+
Duration duration = const Duration(seconds: 3),
6465
}) {
6566
final message = switch (tabName.whenNotEmpty) {
6667
String() => "New tab '$tabName' opened in background",
@@ -72,6 +73,7 @@ void showTabOpenedMessage(
7273
action: onShow.mapNotNull(
7374
(onPressed) => SnackBarAction(label: 'Show', onPressed: onPressed),
7475
),
76+
duration: duration,
7577
);
7678

7779
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -106,6 +108,7 @@ void showTabSwitchMessage(
106108
BuildContext context, {
107109
String? tabName,
108110
void Function()? onSwitch,
111+
Duration duration = const Duration(seconds: 3),
109112
}) {
110113
ScaffoldMessenger.of(context).clearSnackBars();
111114

@@ -119,6 +122,7 @@ void showTabSwitchMessage(
119122
action: onSwitch.mapNotNull(
120123
(onPressed) => SnackBarAction(label: 'Switch', onPressed: onPressed),
121124
),
125+
duration: duration,
122126
);
123127

124128
ScaffoldMessenger.of(context).showSnackBar(snackBar);

0 commit comments

Comments
 (0)