Is there any way to achieve a Flutter top snackbar?
You can set a margin using the device's height to achieve this:
ScaffoldMessenger.of(context).showSnackBar(new SnackBar(
content: Text('Snackbar message'),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.height - 100,
right: 20,
left: 20),
));
You can use https://pub.dartlang.org/packages/flushbar
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);
},
),