how to set showModalBottomSheet to full height

后端 未结 5 1899
星月不相逢
星月不相逢 2020-12-14 02:01

i use showRoundedModalBottomSheet, how to adjust this modal height till below the appbar?

5条回答
  •  难免孤独
    2020-12-14 02:03

    What worked for me was returning the modal's content wrapped in a DraggableScrollableSheet:

    showModalBottomSheet(
      backgroundColor: Colors.transparent,
      context: context,
      isScrollControlled: true,
      isDismissible: true,
      builder: (BuildContext context) {
        return DraggableScrollableSheet(
          initialChildSize: 0.75, //set this as you want
          maxChildSize: 0.75, //set this as you want
          minChildSize: 0.75, //set this as you want
          expand: true,
          builder: (context, scrollController) {
            return Container(...); //whatever you're returning, does not have to be a Container
          }
        );
      }
    )
    

提交回复
热议问题