mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 12:23:31 +00:00
Add controller return on buildSnackBar and change to use default close icon
This commit is contained in:
parent
581b4bf224
commit
2a0e5a9be3
1 changed files with 9 additions and 10 deletions
|
@ -1,16 +1,15 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
Future<void> buildSnackbar(BuildContext context, String message,
|
||||
{int durationSec = 3}) async {
|
||||
Future<ScaffoldFeatureController<SnackBar, SnackBarClosedReason>?>
|
||||
buildSnackbar(BuildContext context, String message,
|
||||
{int durationSec = 3}) async {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
final snackBar = SnackBar(
|
||||
content: SelectableText(message),
|
||||
duration: Duration(seconds: durationSec),
|
||||
action: SnackBarAction(
|
||||
label: 'Dismiss',
|
||||
onPressed: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(),
|
||||
));
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
content: SelectableText(message),
|
||||
duration: Duration(seconds: durationSec),
|
||||
showCloseIcon: true,
|
||||
);
|
||||
return ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue