material_snackbar 1.3.0 copy "material_snackbar: ^1.3.0" to clipboard
material_snackbar: ^1.3.0 copied to clipboard

discontinued

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.

style: effective dart CodeFactor

Features #

showcase

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 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.

snackbar queue

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 ➡

17
likes
40
pub points
36%
popularity

Publisher

verified publisherclevertasks.de

A flutter plugin for displaying snackbars with the newest material design on desktop and mobile.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

animations, flutter, flutter_web_plugins

More

Packages that depend on material_snackbar