ExpressiveShellAction constructor
const
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 (icon with onPressed, or a menu), or — with action —
the widget that draws action. onPressed is handed the context it
was pressed in.
Implementation
const ExpressiveShellAction({
IconData? icon,
void Function(BuildContext context)? onPressed,
this.label,
this.accent = false,
this.menu,
this.scrim = false,
this.semanticLabel,
this.splashAnchor = false,
this.expanded,
this.onExpandedChanged,
this.action,
this.mark,
this.collapseOnScroll = false,
this.labelShown = true,
super.key,
}) : _icon = icon,
_onPressed = onPressed,
assert(
(action == null) != (icon == null),
'ExpressiveShellAction is a spec (icon:) or draws one (action:).',
),
assert(
action != null || onPressed != null || menu != null,
'An ExpressiveShellAction without a menu needs onPressed.',
),
assert(
menu == null || label == null,
'A FAB menu never opens from an extended FAB (CONTRACT §3): give '
'the action a label or a menu, not both.',
),
assert(
menu == null || (menu.length >= 2 && menu.length <= 5),
'A FAB menu holds 2–5 items (CONTRACT §3).',
),
assert(!scrim || menu != null, 'Only a FAB menu dims the screen.'),
assert(
expanded == null || menu != null,
'Only a FAB menu opens: expanded needs a menu.',
),
assert(
!collapseOnScroll || label != null || action != null,
'Only an extended FAB collapses: collapseOnScroll needs a label.',
);