CNBottomSheet class
Drop-in wrappers for Flutter's modal sheets that publish the sheet's frame for position-aware hide-on-modal behavior.
What it does. When you open a sheet with CNBottomSheet.show (or
CNBottomSheet.showCupertino), a tiny invisible probe is injected into
the sheet's builder. The probe captures the sheet body's live global
rect each frame and publishes it to CNTabBarRouteObserver.topModalRect.
Any CN-widget on the host page consuming ModalHideMixin then only
destroys its native PlatformView IF its own rect geometrically
intersects that published sheet rect (Issue #53).
Not required since 2.5.2. CNTabBarRouteObserver now measures what
any modal route paints (CNTabBarRouteObserver.routeModalRect), so
sheets opened with the framework's showModalBottomSheet,
showCupertinoModalPopup or a sheet package are position-aware too
(#149). A published rect still takes precedence, and the probe remains
the way to describe a sheet that isn't a route.
API parity. Every parameter of showModalBottomSheet /
showCupertinoSheet is forwarded unchanged. Your builder receives a
regular BuildContext and can return any Flutter widget tree you
want — exactly like the underlying APIs. The probe is invisible: it
neither adds UI nor changes layout.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
show<
T> ({required BuildContext context, required WidgetBuilder builder, Color? backgroundColor, String? barrierLabel, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, Color? barrierColor, bool isScrollControlled = false, double scrollControlDisabledMaxHeightRatio = 9.0 / 16.0, bool isDismissible = true, bool enableDrag = true, bool? showDragHandle, bool useSafeArea = false, RouteSettings? routeSettings, AnimationController? transitionAnimationController, Offset? anchorPoint}) → Future< T?> - Position-aware wrapper for showModalBottomSheet.
-
showCupertino<
T> ({required BuildContext context, required WidgetBuilder pageBuilder, bool enableDrag = true}) → Future< T?> - Position-aware wrapper for showCupertinoSheet — the iOS 26 native-style stacked-card sheet. Same probe injection.
-
showModalPopup<
T> ({required BuildContext context, required WidgetBuilder builder, ImageFilter? filter, Color? barrierColor, bool barrierDismissible = true, bool semanticsDismissible = false, RouteSettings? routeSettings, Offset? anchorPoint}) → Future< T?> - Position-aware wrapper for showCupertinoModalPopup — the iOS action-sheet style popup that animates up from the bottom. Same probe injection. Even though the popup is short, it's still a PlatformView container conflict source, so wrapping is worth it.