modal_bottom_sheet
modal_bottom_sheet copied to clipboard
Let user customize sheet width
This allows a user to set a width for their bottom sheet when calling showCupertinoModalBottomSheet
, showBarModalBottomSheet
, showMaterialModalBottomSheet
, or CupertinoScaffold.showCupertinoModalBottomSheet
. When I ran pub get
, a bunch of files auto-updated - not sure if you want these in the PR. If not, I can just go and delete them manually.
One thing to note - if the user chooses a small width and provides a child widget that doesn't scale appropriately, flutter will get angry and throw an error. Here is an example of what I am talking about.
In the example titled "Cupertino Modal with Width", change the width
from 300 to 50. Try to open it and note the error:
Leading widget consumes entire tile width. Please use a sized widget, or consider replacing ListTile with a custom widget (see https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4)
'package:flutter/src/material/list_tile.dart':
Failed assertion: line 1724 pos 7: 'tileWidth != leadingSize.width || tileWidth == 0.0'
The problem is that the ListTile
's in example/lib/modals/modal_fit.dart
have a leading icon which is bigger than the specified width, so it throws an error. As a user, I might be confused by this error, so I just wanted to see what you think about this and if it is acceptable.
Great package and I am happy to hear that it will be integrated into flutter soon 😊
Need some time to work out a few issues
I reverted my previous attempt and am reopening this with my new attempt.
Please merge this... It's a great addition and so useful on tablets :)
I would prefer to implement this in the containerBuilder parameter instead of the internal widget. Right now it is possible to achieve this behavior without need to edit the core.