CLShellPageActions class
Pubblica actions sul canale page dello shell (CLShellScope) per tutta la vita del widget: lo shell le ricolloca da sé (header su desktop/tablet, area contestuale sopra la bottom bar su mobile). Incapsula il lifecycle che le pagine altrimenti ricablano a mano — lookup dello scope, publish post-frame, gate sulla rotta corrente, clear in dispose — così una pagina passa da ~15 righe sparse (campo + didChangeDependencies + post-frame + dispose) a un solo widget nel tree:
return CLShellPageActions(
actions: _shellActions(context, vm),
child: _buildLayout(context, vm),
);
Trasparente al layout: ritorna child invariato (è solo un publisher). Le actions vengono ri-pubblicate a ogni rebuild del parent, quindi è corretto passare una lista ricostruita dal viewmodel.
gateOnCurrentRoute (default true): pubblica solo se il ModalRoute della
pagina è quello corrente — evita che una lista, mentre una rotta figlia è in
cima ma resta montata e ribuilda, sovrascriva le azioni della figlia. Mettere
a false nelle rotte foglia con GoRouter nidificato, dove ModalRoute di
questo context risolve il route del parent (ModalRoute.isCurrent sarebbe
sempre false): lì il cleanup è comunque garantito dal dispose → clearPage.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CLShellPageActions
- Available extensions
Constructors
-
CLShellPageActions({Key? key, required List<
ShellAction> actions, required Widget child, bool gateOnCurrentRoute = true}) -
const
Properties
-
actions
→ List<
ShellAction> -
final
- child → Widget
-
final
- gateOnCurrentRoute → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
animateOnActionTrigger(
AnimationInfo animationInfo, {bool hasBeenTriggered = false}) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
animateOnPageLoad(
AnimationInfo animationInfo) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CLShellPageActions> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited