BackPressBehavior enum Null safety

This decides the action to be taken when user presses the back button.

Note that this will continue to work, even if the panel is not currently visible. (i.e., PanelState.closed with height 0.0).

For normal panels, any of these can be used. But for Two-state panels, these behaviors can be used: POP, PERSIST, CLOSE_POP, CLOSE_PERSIST.

Default : POP

Inheritance

Constructors

BackPressBehavior()
const

Values

POP → const BackPressBehavior

Just pop the route without considering the panel state.

Also valid for two-state panels.

This is the default behavior.

PERSIST → const BackPressBehavior

Never pop the route no matter what the panel state is. To pop the route you need to change this yourself to another behavior. (e.g., POP).

Also valid for two-state panels.

Useful in cases when the user must interact with the panel only.

COLLAPSE_PERSIST → const BackPressBehavior

If the panel's height is more than PanelSize.collapsedHeight, the panel will collapse.

After collapsed, if the user taps back button again, the behavior would be PERSIST. i.e., route will not pop.

If this is provided for two-state panels, PERSIST is applied instead.

COLLAPSE_POP → const BackPressBehavior

If the panel's height is more than PanelSize.collapsedHeight, the panel will collapse.

After collapsed, if the user taps back button again, the behavior would be POP. i.e., route will pop.

If this is provided for two-state panels, POP is applied instead.

CLOSE_PERSIST → const BackPressBehavior

If the panel's height is more than PanelSize.closedHeight, the panel will close.

After closed, if the user taps back button again, the behavior would be PERSIST. i.e., route will not pop.

CLOSE_POP → const BackPressBehavior

If the panel's height is more than PanelSize.closedHeight, the panel will close.

After closed, if the user taps back button again, the behavior would be POP. i.e., route will pop.

Also valid for two-state panels.

COLLAPSE_CLOSE_PERSIST → const BackPressBehavior

If the panel's height is more than PanelSize.collapsedHeight, the panel will collapse. Again, if the panel's height is more than PanelSize.closedHeight, and less than or equal to PanelSize.collapsedHeight, the panel will close.

After closed, if the user taps back button again, the behavior would be PERSIST. i.e., route will not pop.

If this is provided for two-state panels, CLOSE_PERSIST is applied instead.

COLLAPSE_CLOSE_POP → const BackPressBehavior

If the panel's height is more than PanelSize.collapsedHeight, the panel will collapse. Again, if the panel's height is more than PanelSize.closedHeight, and less than or equal to PanelSize.collapsedHeight, the panel will close.

After closed, if the user taps back button again, the behavior would be POP. i.e., route will pop.

If this is provided for two-state panels, CLOSE_POP is applied instead.

Properties

hashCode int
The hash code for this object.
read-onlyinherited
index int
A numeric identifier for the enumerated value.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<BackPressBehavior>
A constant List of the values in this enum, in order of their declaration.
[POP, PERSIST, COLLAPSE_PERSIST, COLLAPSE_POP, CLOSE_PERSIST, CLOSE_POP, COLLAPSE_CLOSE_PERSIST, COLLAPSE_CLOSE_POP]