From 499625b04cd0ef8f6a08e6e3527072e02227f9d6 Mon Sep 17 00:00:00 2001 From: Daichi Fujita <68946713+fujidaiti@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:07:53 +0900 Subject: [PATCH] Add `settings` and `fullscreenDialog` params to the constructors of modal sheet routes and pages (#28) Fixes #24. --- package/lib/src/modal/cupertino.dart | 16 ++++++++++++++-- package/lib/src/modal/modal_sheet.dart | 11 ++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/package/lib/src/modal/cupertino.dart b/package/lib/src/modal/cupertino.dart index fd67b468..e7758542 100644 --- a/package/lib/src/modal/cupertino.dart +++ b/package/lib/src/modal/cupertino.dart @@ -335,7 +335,10 @@ class _CupertinoStackedTransitionState extends State abstract class _BaseCupertinoModalSheetRoute extends PageRoute with ModalSheetRouteMixin { - _BaseCupertinoModalSheetRoute({super.settings}); + _BaseCupertinoModalSheetRoute({ + super.settings, + super.fullscreenDialog, + }); PageRoute? _previousRoute; @@ -407,6 +410,7 @@ class CupertinoModalSheetPage extends Page { this.maintainState = true, this.enablePullToDismiss = true, this.barrierDismissible = true, + this.fullscreenDialog = false, this.barrierLabel, this.barrierColor = _cupertinoBarrierColor, this.transitionDuration = _cupertinoTransitionDuration, @@ -420,6 +424,8 @@ class CupertinoModalSheetPage extends Page { /// {@macro flutter.widgets.ModalRoute.maintainState} final bool maintainState; + final bool fullscreenDialog; + final Color? barrierColor; final bool barrierDismissible; @@ -434,7 +440,10 @@ class CupertinoModalSheetPage extends Page { @override Route createRoute(BuildContext context) { - return _PageBasedCupertinoModalSheetRoute(page: this); + return _PageBasedCupertinoModalSheetRoute( + page: this, + fullscreenDialog: fullscreenDialog, + ); } } @@ -442,6 +451,7 @@ class _PageBasedCupertinoModalSheetRoute extends _BaseCupertinoModalSheetRoute { _PageBasedCupertinoModalSheetRoute({ required CupertinoModalSheetPage page, + super.fullscreenDialog, }) : super(settings: page); CupertinoModalSheetPage get _page => @@ -477,6 +487,8 @@ class _PageBasedCupertinoModalSheetRoute class CupertinoModalSheetRoute extends _BaseCupertinoModalSheetRoute { CupertinoModalSheetRoute({ + super.settings, + super.fullscreenDialog, required this.builder, this.enablePullToDismiss = true, this.maintainState = true, diff --git a/package/lib/src/modal/modal_sheet.dart b/package/lib/src/modal/modal_sheet.dart index b0d00a33..3827dfd4 100644 --- a/package/lib/src/modal/modal_sheet.dart +++ b/package/lib/src/modal/modal_sheet.dart @@ -22,6 +22,7 @@ class ModalSheetPage extends Page { this.maintainState = true, this.enablePullToDismiss = true, this.barrierDismissible = true, + this.fullscreenDialog = false, this.barrierLabel, this.barrierColor = Colors.black54, this.transitionDuration = const Duration(milliseconds: 300), @@ -35,6 +36,8 @@ class ModalSheetPage extends Page { /// {@macro flutter.widgets.ModalRoute.maintainState} final bool maintainState; + final bool fullscreenDialog; + final Color? barrierColor; final bool barrierDismissible; @@ -49,7 +52,10 @@ class ModalSheetPage extends Page { @override Route createRoute(BuildContext context) { - return _PageBasedModalSheetRoute(page: this); + return _PageBasedModalSheetRoute( + page: this, + fullscreenDialog: fullscreenDialog, + ); } } @@ -57,6 +63,7 @@ class _PageBasedModalSheetRoute extends PageRoute with ModalSheetRouteMixin { _PageBasedModalSheetRoute({ required ModalSheetPage page, + super.fullscreenDialog, }) : super(settings: page); ModalSheetPage get _page => settings as ModalSheetPage; @@ -91,6 +98,8 @@ class _PageBasedModalSheetRoute extends PageRoute class ModalSheetRoute extends PageRoute with ModalSheetRouteMixin { ModalSheetRoute({ + super.settings, + super.fullscreenDialog, required this.builder, this.enablePullToDismiss = true, this.maintainState = true,