fluttersnackbarcupertinotabbar

Flutter SnackBar displays under CupertinoTabBar(hidding snackBar)


I have used BottomNavigatoinBar on root page. On one of the pages (Explore page) which is a stateful widget, It has a CupertionoSegmentedTab with three Tab and each displays listview.

I have to display SnackBar based on the listview item click. I can successfully show the SnackBar but It is hidden behind the BottomNavigatoinBar . Is there any solution I can display it above the BottomNavigatoinBar ?


Solution

  • Simply adjusting the content of the SnackBar helped in my case as:

     Scaffold.of(context).showSnackBar(
            SnackBar(
              content: SizedBox(
                  height:70,
                  child: Text(state.message.toString())),
            ),
          );
    

    Although the above solution fixed my problem, according to the official docs its says SnackBar has behaviour option: floating, that cause [SnackBar] to be shown above other widgets in the [Scaffold]:

    SnackBar(
    content: Text("Slow Internet Connection..."),
    behavior: SnackBarBehavior.floating,));