flutterflutter-showmodalbottomsheet

Flutter / modal_bottom_sheet - constrain width?


I'm reviewing the Flutter 'modal_bottom_sheet' package, and I'm wondering if there is a way to set the maximum width of a modal bottom sheet?

In my case, this is a web app, so I don't want the popup modal to take the full browser width


Solution

  • Try to set a constraint

    showModalBottomSheet(
      context: context,
      constraints: BoxConstraints(
         maxWidth: 500              
      ),
      builder: 
    )