ShellCommand class final
One command of the shell (spec 12a D6): New, Open, Open sample, Save, Save As, Export, Print (spec 13 D8, D9), Undo, Redo.
A command is invoked only through invoke, by its toolbar button and by its shortcuts alike: a disabled command's binding stays present (so the key is consumed, S-26) and does nothing -- it never calls the flow or the dispatcher and lets it refuse (S-8).
- Annotations
Constructors
-
ShellCommand({required String id, required String label, required IconData icon, List<
SingleActivator> shortcuts = const <SingleActivator>[], required ValueListenable<bool> enabled, required Future<void> run()}) -
const
Properties
-
enabled
→ ValueListenable<
bool> -
Whether the command can act now. Read at every invocation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData
-
final
- id → String
-
The toolbar button's key is
toolbar-<id>.final - label → String
-
final
-
run
→ Future<
void> Function() -
What the command does. Called only by invoke, when enabled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shortcuts
→ List<
SingleActivator> -
Every chord bound to the command; the first one names it in the
tooltip.
final
- tooltip → String
-
The label and the first chord's glyph for defaultTargetPlatform:
⌘Son macOS (which web on a Mac reports too),Ctrl+Selsewhere (spec 12a D6, S-26).no setter
Methods
-
invoke(
) → void - Runs the command when it is enabled, and otherwise does nothing.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
tooltipFor(
TargetPlatform platform, {String control = 'Ctrl', String shift = 'Shift'}) → String -
tooltip as it reads on
platform; off macOS the modifiers are namedcontrolandshift(spec 14d L4:Strgin German). -
toString(
) → String -
A string representation of this object.
inherited
-
withEnabled(
ValueListenable< bool> enabled) → ShellCommand -
The same command, enabled only while
enabledis.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited