How to create a modal bottomsheet with circular corners in Flutter?

前端 未结 9 1136
时光取名叫无心
时光取名叫无心 2020-12-05 02:25

showModalBottomSheet does not provide any styling or decorations. I want to create something like the Google Tasks bottomsheet.

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 02:30

    i have this code and work well for me. please check it and let me know you'r opinion.

    showBottomSheet(
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.vertical(
                  top: Radius.circular(20),
                ),
              ),
              context: context,
              builder: (context) => Container(
                    height: 250,
    
                    child: new Container(
                        decoration: new BoxDecoration(
                            color: Theme.of(context).primaryColor,
                            borderRadius: new BorderRadius.only(
                                topLeft: const Radius.circular(20.0),
                                topRight: const Radius.circular(20.0))),
                        child: new Center(
                          child: new Text("This is a modal sheet"),
                        )),
                  ))
    

提交回复
热议问题