CupertinoAdaptiveActions<T extends Object> class
final
A Cupertino action region backed by ActionLayoutResolver.
primaryCapacity is the maximum width available to the action region. The
host owns that layout policy because a widget context can expose the whole
window through MediaQuery, but cannot infer how much width a surrounding
navigation bar reserves for its leading widget and title. On every build
this widget creates Cupertino-owned layout options, resolves the supplied
actions, and draws the ordered primary and overflow result without
changing the action collection. Primary menu, composite submenu, and
overflow nodes share one recursive Cupertino anchored-menu renderer.
Layout changes animate one boundary action instead of replacing the whole row. Stable actions remain visible while the changing slot fades and expands or contracts. When one result changes several actions, earlier changes complete immediately and only the final boundary action animates. The region therefore retains at most one outgoing and one incoming child while rapid capacity updates never accumulate outgoing rows.
The following example places one adaptive action directly in a CupertinoNavigationBar:
final save = AdaptiveAction<String>.action(
id: ActionId('save'),
metadata: const ActionMetadata(
label: 'Save',
tooltip: 'Save document',
iconKey: 'save',
),
payload: 'save-document',
);
final page = CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Document'),
trailing: CupertinoAdaptiveActions<String>.moreAction(
actions: ActionCollection(roots: [save]),
primaryCapacity: 140,
onInvoke: (command) => handleCommand(command),
iconBuilder: (context, action) => switch (action.metadata.iconKey) {
'save' => const Icon(CupertinoIcons.floppy_disk),
_ => null,
},
),
),
child: const SizedBox(),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CupertinoAdaptiveActions
Constructors
-
CupertinoAdaptiveActions({Key? key, required ActionCollection<
T> actions, required ValueChanged<T> onInvoke, required double primaryCapacity, Iterable<ActionId> primaryOrderOverride = const [], Iterable<ActionId> overflowOrderOverride = const [], ActionLayoutResolver resolver = const ActionLayoutResolver(), int? maxPrimaryActions, CupertinoActionIconBuilder<T> ? iconBuilder, CupertinoActionButtonBuilder<T> ? actionButtonBuilder, CupertinoOverflowButtonBuilder? overflowButtonBuilder, VoidCallback? onOverflowMenuOpened, VoidCallback? onOverflowMenuClosed, bool invokeAfterMenuClosed = false, required Widget overflowIcon, String overflowTooltip = '', CupertinoActionPresentationCallback<T> ? presentationForAction, CupertinoActionPresentation? presentationOverride, CupertinoAdaptiveActionsStyle style = const CupertinoAdaptiveActionsStyle(), Duration fadeDuration = const Duration(milliseconds: 200), Duration resizeDuration = const Duration(milliseconds: 200), Curve switchInCurve = Curves.easeOut, Curve switchOutCurve = Curves.easeIn}) -
Creates a generic Cupertino action region.
const
-
CupertinoAdaptiveActions.moreAction({Key? key, required ActionCollection<
T> actions, required ValueChanged<T> onInvoke, required double primaryCapacity, Iterable<ActionId> primaryOrderOverride = const [], Iterable<ActionId> overflowOrderOverride = const [], ActionLayoutResolver resolver = const ActionLayoutResolver(), int? maxPrimaryActions, CupertinoActionIconBuilder<T> ? iconBuilder, CupertinoActionButtonBuilder<T> ? actionButtonBuilder, CupertinoOverflowButtonBuilder? overflowButtonBuilder, VoidCallback? onOverflowMenuOpened, VoidCallback? onOverflowMenuClosed, bool invokeAfterMenuClosed = false, CupertinoActionPresentationCallback<T> ? presentationForAction, CupertinoActionPresentation? presentationOverride, CupertinoAdaptiveActionsStyle style = const CupertinoAdaptiveActionsStyle(), Widget overflowIcon = const Icon(CupertinoIcons.ellipsis), String overflowTooltip = 'More actions', Duration fadeDuration = const Duration(milliseconds: 200), Duration resizeDuration = const Duration(milliseconds: 200), Curve switchInCurve = Curves.easeOut, Curve switchOutCurve = Curves.easeIn}) -
Creates a Cupertino action region with the conventional More icon.
const
Properties
-
actionButtonBuilder
→ CupertinoActionButtonBuilder<
T> ? -
Overrides leaf actions, primary menu triggers, and composite invoke
buttons while preserving the renderer-owned slot constraints.
final
-
actions
→ ActionCollection<
T> -
The action roots and placement constraints to resolve.
final
- fadeDuration → Duration
-
The duration of action and label visibility animations.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
iconBuilder
→ CupertinoActionIconBuilder<
T> ? -
Resolves platform-specific icons from platform-neutral metadata.
final
- invokeAfterMenuClosed → bool
-
Whether menu actions wait for the root menu to finish closing before
invoking their payload.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxPrimaryActions → int?
-
The optional maximum number of root actions shown in primary.
final
-
onInvoke
→ ValueChanged<
T> -
Receives the payload of an enabled action after the user invokes it.
final
- onOverflowMenuClosed → VoidCallback?
-
Called after the overflow menu finishes closing.
final
- onOverflowMenuOpened → VoidCallback?
-
Called when the overflow menu begins opening.
final
- overflowButtonBuilder → CupertinoOverflowButtonBuilder?
-
Overrides the overflow trigger without replacing its anchored menu.
final
- overflowIcon → Widget
-
The icon reserved for the overflow trigger.
final
-
overflowOrderOverride
→ Iterable<
ActionId> -
Region-local overflow ordering applied by the core resolver.
final
- overflowTooltip → String
-
Accessibility description for the overflow trigger.
final
-
presentationForAction
→ CupertinoActionPresentationCallback<
T> ? -
Selects a primary-button presentation independently for each root action.
final
- presentationOverride → CupertinoActionPresentation?
-
Forces one Cupertino primary presentation for every root action.
final
- primaryCapacity → double
-
The finite, non-negative width available to the primary action region.
final
-
primaryOrderOverride
→ Iterable<
ActionId> -
Region-local primary ordering applied by the core resolver.
final
- resizeDuration → Duration
-
The duration of boundary width expansion and contraction.
final
- resolver → ActionLayoutResolver
-
The layout resolver used with Cupertino-owned constraints.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → CupertinoAdaptiveActionsStyle
-
Renderer-owned Cupertino visual and layout configuration.
final
- switchInCurve → Curve
-
The curve used while a boundary action or label appears and expands.
final
- switchOutCurve → Curve
-
The curve used while a boundary action or label disappears and contracts.
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.
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