How to show a Flutter SnackBar widget at the top?

3,235

Try to use this plugin: flushbar

Flushbar( flushbarPosition: FlushbarPosition.TOP, )

Share:
3,235
ccpizza
Author by

ccpizza

Just visiting this planet.

Updated on December 15, 2022

Comments

  • ccpizza
    ccpizza over 1 year

    Is there a way to show a Flutter Snackbar at the top of the screen rather than at the bottom?

    According to the docs you can set behaviour: SnackBarBehavior.floating and that raises slightly the snackbar and makes it look a bit like a popup, but it still doesn't provide an option to explicitly set the positioning at the top, for example, right below the action bar.

  • ccpizza
    ccpizza over 3 years
    Flushbar is a 3rd party library. I was looking at ways to do it with the ootb SnackBar, possibly by passing a different context object similar to how Snackbar works in android where the Snackbar is anchored to a specific widget.
  • ccpizza
    ccpizza over 3 years
    I've seen the flushbar plugin before posting the question; would prefer to stick to the standard ootb widgets.
  • ajay
    ajay over 3 years
    @ccpizza I understand what you are looking in to. According to Material design, Snackbars used to provide brief messages about app processes at the bottom of the screen. have a look - Snackbar
  • ccpizza
    ccpizza over 3 years
    yes, i know, yet the android native snackbar can be tweaked to appear on top, eg stackoverflow.com/a/31746370/191246 — I was assuming something similar might be possible with flutter.