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

后端 未结 9 1250
野性不改
野性不改 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:12

    you can use a Column Inside a SingleChildScrollView to dynamically change the height of bottom sheet and also it gets scrollable once it exceeds the available max height,make sure the isScrollControlled is set to true, And for the border radius the shape property will help you add the borderRadius to the bottomsheet. here's a dartpad example for the same

    
      Future _showBottomSheet() async {
        return showModalBottomSheet(
          isScrollControlled: true,
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(13)),
          backgroundColor: Colors.white,
          context: context,
          builder: (context) => SingleChildScrollView(
              child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: List.generate(kBoxes, (index) => _squareBox(index)))),
        );
      }
    
    

提交回复
热议问题