material_snackbar 1.0.0
material_snackbar: ^1.0.0 copied to clipboard
A flutter plugin for displaying snackbars with the newest material design on desktop and mobile.
Material snackbar #
A flutter plugin for displaying snackbars with the newest material design on desktop and mobile.
Features #
- Material design (with material motion).
- Designed for desktop and mobile.
- Snackbar queue for stacking snackbars.

Usage #
First, add the material_snackbar package to your pubspec dependencies.
To import material_snackbar:
import 'package:material_snackbar/material_snackbar.dart';
For displaying a material snackbar you need to obtain the [MaterialSnackbarMessengerState] of the current [BuildContext] by using [MaterialSnackBarMessenger.of].
Material snackbar #
Here is an example how to display a simple snackbar.
MaterialSnackBarMessenger.of(context).showSnackBar(
snackbar: MaterialSnackbar(
content: Text('Deleted 142 important documents'),
),
);
Use the actionBuilder to add an action button that can dismiss the snackbar.
MaterialSnackBarMessenger.of(context).showSnackBar(
snackbar: MaterialSnackbar(
content: Text('Deleted 142 important documents.'),
actionBuilder: (context, close) => TextButton(
child: Text('DISMISS'),
onPressed: close,
),
),
);
Snackbar queue #
When you show multiple snackbars they are not displayed all at one time. They are added to the snackbar queue and are displayed individually after the previously shown snackbar.
[VIDEO]
To empty the snackbar queue use:
MaterialSnackBarMessenger.of(context).emptyQueue();
Faster ⚡ #
When you just need a normal snackbar you can use snack() to save time.
MaterialSnackBarMessenger.of(context).snack(
'I am speed',
actionText: 'REPLY',
onAction: () => print('Speeeed'),
);
For more examples see the example tab ➡