Ahmed Abogameel
Ahmed Abogameel

Reputation: 11

How to control width of modalBottomSheet in flutter?

i want to make my bottom sheet don't take infinity width how to make that i tried nested container and the nested one with width 100 and it also take the whole width ?

Upvotes: 0

Views: 1020

Answers (1)

Salim Murshed
Salim Murshed

Reputation: 1441

You can check the below code.

   RaisedButton(
        child: Text("abc"),
        onPressed: () {
          showModalBottomSheet(
              context: context,
              backgroundColor: Colors.transparent,
              builder: (BuildContext bc) {
                return Container(
                  width: MediaQuery.of(context).size.width,
                  color: Colors.transparent,
                  child: Padding(
                    padding: const EdgeInsets.fromLTRB(100, 0, 100, 0),
                    child: Container(
                      color: Colors.white,
                      width: MediaQuery.of(context).size.width - 200,
                      child: new Wrap(
                        children: <Widget>[
                          new ListTile(
                              leading: new Icon(Icons.music_note),
                              title: new Text('Music'),
                              onTap: () => {}),
                          new ListTile(
                            leading: new Icon(Icons.videocam),
                            title: new Text('Video'),
                            onTap: () => {},
                          ),
                        ],
                      ),
                    ),
                  ),
                );
              });
        })

Upvotes: 1

Related Questions