How to wrap height according to child content for showModalBottomSheet or remove auto height

Viewed 160

I have one bottom sheet and under that bottom sheet i am managing routing my each screen have different screen size. and i want to change the height of showModalBottomSheet for each screen.

showModalBottomSheet<void>(
      context: context,
      isDismissible: true,
      //isScrollControlled: true,
      elevation: 2.0,
      barrierColor: Colors.white.withOpacity(0),
      builder: (BuildContext context) {
        // double ht = Provider.of<SearchByLocationNotify>(context).getScreenSize;
        return SizedBox(
            height: MediaQuery.of(context).size.height * 0.5,// currently static height provided
            child: PopUpHome());
      },
    );
  1. change the height according to each screen
  2. or wrap the content of children so that static height is not needed

enter image description here

In the above image red porion is showModalBottomSheet blue is my child so i want red portion should only occupy blue.

1 Answers

return a Column with mainAxisSize: MainAxisSize.min from the builder and place your content inside the Column widget.

Related