flutter snackbar libraries code example

Example 1: flutter snackbar replacement

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
  content: const Text('snack'),
  duration: const Duration(seconds: 1),
  action: SnackBarAction(
	label: 'ACTION',
	onPressed: () { },
  ),
));

Example 2: Flutter snackbar top

RaisedButton(
  child: Text('Show Top Snackbar'),
  onPressed: () {
    Flushbar(
      flushbarPosition: FlushbarPosition.TOP,
    )
      ..title = "Hey Ninja"
      ..message = "Lorem Ipsum is simply dummy text of the printing and typesetting industry"
      ..duration = Duration(seconds: 3)
      ..show(context);
  },
),

Tags:

Dart Example