1

I'am trying to show webView in a showModalBottomSheet, using inAppWebView plugin for webView. So when the webView state changes bottomSheet should adjust its height. Currently I just made a hotFix by giving scroll to bottomSheet.

 return  return showModalBottomSheet(
      enableDrag: false,
      isDismissible: false,
      isScrollControlled: true,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(20.r),
          topLeft: Radius.circular(20.r),
        ),
      ),
      context: context,
      builder: (context) => BottomSheet(),
    );
Widget build(BuildContext context) {
return Container(
      alignment: Alignment.center,
      height: MediaQuery.of(context).size.height - (kToolbarHeight * 2),
      decoration: BoxDecoration(
        color: lmWhite,
        borderRadius: BorderRadius.circular(20.r),
      ),
      clipBehavior: Clip.hardEdge,
      child: Stack(
        children: [
          InAppWebView(),
          Opacity(),
          ],
        ),
      );
   }
Shebin PR
  • 75
  • 1
  • 5

1 Answers1

0

Default height for bottomSheet is half the screenSize

If you want your bottomSheet to Expand according to your content use below code

showModalBottomSheet<dynamic>(
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
  return Wrap(
      children: <Widget>[...]
  )
 }
)

This will automatically expand the bottomSheet according to content inside.

  • I am using this method in all other scenarios and working fine. But in this case it is a webview inside bottomsheet and it is not expanding. – Shebin PR Jan 13 '23 at 13:06