ExpressiveShellAction class
The shell's action (CONTRACT §4.2): the design kit's ShellAction
(icon, onPressed, label, accent, key) plus menu. As a spec it goes to
ExpressiveShell(action:); as a widget — ExpressiveShellAction(action: spec), what the shell draws — it draws any spec by its type:
- a plain spec: the primary-container FAB (
accent= the vibrant primary FAB), its label announced; - an ExpressiveShellAction with a label: the small extended FAB printing it (a kit ShellAction's label stays announced only), wearing its mark in the icon's place when it has one, and collapsing to its icon while a branch scrolls down when it says collapseOnScroll;
- an ExpressiveShellAction with a menu (2–5 items): the FAB menu, the shell's hero moment (drawn inside its own ExpressiveHeroMoment); onPressed, when given, runs as the menu opens. A menu never opens from an extended FAB: label and menu are exclusive. The items open in the overlay, so the action's box (and the shell's band) stays the closed toggle's. accent gives it the vibrant family, and scrim dims the screen behind it while it is open. In a rail's header (the shell at ≥ 600dp) the menu is never drawn (no FAB menu beside a rail, CONTRACT §3): the plain FAB runs onPressed.
The shell places it 16dp in from the end and above the bar
(ScaffoldBehavior.fabSpacing).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ExpressiveShellAction
- Implemented types
Constructors
-
ExpressiveShellAction({IconData? icon, void onPressed(BuildContext context)?, String? label, bool accent = false, bool scrim = false, String? semanticLabel, bool splashAnchor = false, bool? expanded, ValueChanged<
bool> ? onExpandedChanged, ShellAction? action, Widget? mark, bool collapseOnScroll = false, bool labelShown = true, Key? key}) -
A spec (
iconwithonPressed, or amenu), or — withaction— the widget that drawsaction.onPressedis handed the context it was pressed in.const
Properties
- accent → bool
-
Whether the FAB wears the vibrant primary rather than the primary
container; a menu then wears ExpressiveFabMenuColor.vibrant.
final
- action → ShellAction?
-
The spec this widget draws, when it draws another spec (the shell's
ExpressiveShellAction(action: spec)).final - collapseOnScroll → bool
-
Whether the extended FAB collapses to its icon while a branch root
scrolls down and expands again when it scrolls up or returns to its
top (Material's extended FAB guidance, as
ExpressiveFabScrollExpansion does for a page's own FAB). The shell
follows the scroll and draws the action with labelShown.
final
- expanded → bool?
-
A FAB menu's open state, when the app holds it (opening the menu once
to show what it offers); null leaves it to the menu. With it, the
menu reports every open and close to onExpandedChanged and opens or
closes only when expanded does.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData
-
The glyph the act wears.
no setteroverride
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
What the act does: announced, and printed on the extended FAB.
final
- labelShown → bool
-
Whether an extended FAB shows its label: the shell sets it from the
scroll when the spec says collapseOnScroll; always true otherwise.
final
- mark → Widget?
-
An app's own mark in the icon's place on the extended FAB
(ExpressiveFloatingActionButton.mark); the plain FAB and a menu wear icon.
final
-
The FAB menu's acts, top to bottom: 2–5. Null for a plain or extended
FAB.
final
-
onExpandedChanged
→ ValueChanged<
bool> ? -
Told when a held menu asks to open or close.
final
- onPressed → void Function(BuildContext context)
-
What a press runs: the constructor's
onPressed, or the drawn spec's.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrim → bool
-
Whether the open menu dims the screen behind it
(ExpressiveFabMenu.scrim). Only with a menu.
final
- semanticLabel → String?
-
What the act is called, announced and never printed: the name a menu
toggle or a plain FAB carries when it has no label (a menu can't
take one, and a label on a plain spec prints an extended FAB). A
label, when given, is announced instead.
final
- splashAnchor → bool
-
Whether the FAB is where the app's splash lands
(ExpressiveSplashScreenAnchor, its large corner in the FAB's container
colour): the shell's action on the page the app opens on.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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.
override
-
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