Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter bottom sheet invisible because of bottom navigation bar

Tags:

flutter

I'm trying to show bottom sheet and let user pick choice. I did like so

showModalBottomSheet(
  context: context,
  builder: (builder) {
   return Column(
     mainAxisSize: MainAxisSize.min,
      children: <Widget>[
       new ListTile(
        leading: new Icon(Icons.image),
        title: new Text('From gallary'),
       ),
       new ListTile(
        leading: new Icon(Icons.camera_alt),
        title: new Text('Take video'),
       ),
      ],
    );
   });

However it barely visible because of bottom navigation bar. It looks like this.image I want to implement minimum height bottom sheet coming up from top edge of the bottom navigation bar. How can I achieve this?

like image 502
Daibaku Avatar asked Sep 16 '18 01:09

Daibaku


People also ask

How do you show the bottom sheet Flutter?

Modal bottom sheets can be created and displayed using the showModalBottomSheet function. The showModalBottomSheet has two required properties: BuildContext and WidgetBuilder .

How do you make the navigation bar transparent in Flutter?

Solution. In summary, we can make a transparent app bar by set backgroundColor to Colors. transparent (1), elevation to 0 (2), and title color to anything different from background color (3).


1 Answers

The showModalBottomSheet has useRootNavigator which is by default false. The documentation says:

The useRootNavigator parameter ensures that the root navigator is used to display the [BottomSheet] when set to true. This is useful in the case that a modal [BottomSheet] needs to be displayed above all other content but the caller is inside another [Navigator].

I think that is solution to your problem.

like image 97
Lebohang Mbele Avatar answered Nov 04 '22 06:11

Lebohang Mbele