How do you adjust the height and borderRadius of a BottomSheet in Flutter?

后端 未结 9 1248
野性不改
野性不改 2021-02-05 03:47

I\'m probably missing something obvious here, but my BottomSheet only takes up the bottom half the screen, even though the widgets in it take up more space. So now there is scro

9条回答
  •  生来不讨喜
    2021-02-05 04:13

    You can adjust the height by setting the height of your main container either by a constant ex : 800 or by using MediaQuery ex :

    if i want to show only 2 /3 of the screen

    MediaQuery.of(context).size.height -
          (MediaQuery.of(context).size.height / 3)
    

    for the radius first you have to set the

     showModalBottomSheet(
                              backgroundColor: Colors.transparent,
    

    and then you container color to White or any color you wanted , example :

    return Container(
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
              topLeft: const Radius.circular(16),
              topRight: const Radius.circular(16))),
      child:
    

提交回复
热议问题