Closed aclowkey closed 3 months ago
Hi!
@aclowkey Here is the related migration guide: https://pub.dev/packages/wolt_modal_sheet/versions/0.7.0#migration-from-v060-to-v070
So, you can define your own custom modal constraints by extending the modal type class:
class MyCustomBottomSheetType extends WoltBottomSheetType {
const MyCustomBottomSheetType()
: super(
shapeBorder: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(24))),
showDragHandle: false,
barrierDismissible: false,
);
}
you need to override the method:
/// Defines the constraints for the modal based on the available screen size.
///
/// Implement this method to specify the modal's sizing within the route screen.
///
/// Returns a [BoxConstraints] object that defines the modal's dimensions.
BoxConstraints layoutModal(Size availableSize);
One example:
/// Specifies the size constraints for the modal based on the available space.
///
/// This implementation ensures the modal uses the full width of the screen and limits its maximum
/// height to 90% of the screen height, while maintaining a minimum height of 40% of the screen
/// height.
///
/// [availableSize] defines the total available space for the modal.
///
/// Returns [BoxConstraints] that dictate the allowable size of the bottom sheet.
@override
BoxConstraints layoutModal(Size availableSize) {
return BoxConstraints(
minWidth: availableSize.width,
maxWidth: availableSize.width,
minHeight: 0,
maxHeight: availableSize.height * 0.9,
);
}
Please let me know what you think of the improvement. Also, feel free to close the issue if this helps.
@ulusoyca Thanks a lot! I missed this migration guide, I was searching the changelog. perhaps it's worth mentioning as a breaking change?
I like that these values are encapsulated within layoutModal. Great job :)
First of all, sorry I'm not following your bug report template. Secondly, glad to see you're making so many improvements!
I've used version 0.5.0 a couple of months ago, now. I upgraded to 0.9.2. And I noticed that maxPageHeight was removed.
I didn't see any issue or reference about it in the changelog - any idea what I should do?