BottomSheetGuard class
Guards against "tap-through" events that occur during a modal sheet's reverse dismiss animation.
How it works:
- BaseBottomSheet calls trackRoute right after pushing a sheet. The guard listens for the route's animation status.
- When the animation enters AnimationStatus.reverse (i.e. the sheet has just begun closing), isCovered becomes true and a timestamp is refreshed.
- isCovered returns false as soon as either of the following happens
(whichever comes first):
- The animation reaches AnimationStatus.dismissed (normal path).
- More than
_maxCoverDurationhas elapsed since the last reverse timestamp (safety fallback in case the dismissed callback never arrives, e.g. the route is disposed externally).
- Forward / completed states are intentionally ignored: while the sheet is fully open it is modal and blocks taps on its own, so no guarding is needed.
Note: this guard only tracks modal sheets opened via BaseBottomSheet;
it has no effect on OverlayEntry-based floating widgets and will not
interfere with them.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCovered → bool
-
Whether a modal sheet is currently inside its reverse dismiss
animation window. Returns false once the animation finishes
(
dismissed) or once_maxCoverDurationhas elapsed since the reverse animation started, whichever comes first.no setter - 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
-
trackRoute(
ModalRoute route) → void - Registers a modal route that is being shown. Only the reverse and dismissed transitions are observed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → BottomSheetGuard
-
final