CommandButton
A Button backed by an AppCommand in the active command registry.
Learn more: Commands & shortcuts
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
CommandScope( commands: [ AppCommand( id: const CommandId('project.runTests'), title: 'Run tests', run: (_) => runTests(), ), ], child: const CommandButton( command: CommandId('project.runTests'), variant: ButtonVariant.primary, ),)Details
Section titled “Details”The command supplies the default label, enabled state, and action. This keeps a dedicated button consistent with command palettes, shortcuts, semantics, and programmatic invocation without repeating command policy.
The button must be below the CommandScope or app that registers command.
Missing commands throw a StateError during build. A registered command
whose visibility predicate is false omits the button from the tree, just as
it is omitted from shortcuts, semantics, and palettes.
Constructors
Section titled “Constructors”CommandButton()
Section titled “CommandButton()”| Parameter | Type | Default | Description |
|---|---|---|---|
command: | CommandId | required | ID of the active command this button presents. |
label: | String? | — | Optional visual label. Defaults to the command’s title. |
variant: | ButtonVariant | ButtonVariant.normal | Accent applied to the underlying button. |
focusNode: | FocusNode? | — | Focus node for the underlying button. |
autofocus: | bool | false | Whether the underlying button requests focus when mounted. |
style: | CellStyle? | — | Base styling for the underlying button. |
Source
Section titled “Source”CommandButton is defined in packages/fleury/lib/src/catalog/command_button.dart.
Category: Inputs & controls · All widgets