DesignCommandPalette class
The palette's body: the field over the results. Put it in a route with showDesignCommandPalette, or anywhere (a sidebar's search).
DesignCommandPalette(commands: const [DesignCommand(label: 'New file')], fieldBuilder: (context, field) => EditableText(controller: field.controller, focusNode: field.focusNode, style: const TextStyle(), cursorColor: const Color(0xFF000000), backgroundCursorColor: const Color(0xFF808080), onEditingComplete: field.submit), itemBuilder: (context, command, states) => Text(command.label))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DesignCommandPalette
Constructors
-
DesignCommandPalette({Key? key, required List<
DesignCommand> commands, required DesignComboboxFieldBuilder fieldBuilder, required Widget itemBuilder(BuildContext context, DesignCommand command, Set<WidgetState> states), ValueChanged<DesignCommand> ? onSelected, Widget groupBuilder(BuildContext context, String group)?, WidgetBuilder? emptyBuilder, DesignPaletteLayoutBuilder? layoutBuilder, int? score(String text, String query) = designMatchScore, double maxHeight = 360, String? semanticLabel, String resultsMessage(int count)?, TextEditingController? controller, FocusNode? focusNode, bool autofocus = true}) -
A palette of
commands.const
Properties
- autofocus → bool
-
Whether the field takes focus once it is built: true for a palette opened over the page, false for one that
stands inline on a page and waits to be reached.
final
-
commands
→ List<
DesignCommand> -
The commands, in the order they list with no query.
final
- controller → TextEditingController?
-
The field's text. The caller's, who disposes it; null: the palette
makes its own and disposes it.
final
- emptyBuilder → WidgetBuilder?
-
Paints "No results"; null: nothing.
final
- fieldBuilder → DesignComboboxFieldBuilder
-
Paints the search field (DesignComboboxField.submit, its input's
onEditingComplete, runs the highlighted command).final - focusNode → FocusNode?
-
The field's focus.
final
- groupBuilder → Widget Function(BuildContext context, String group)?
-
Paints a group's heading.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
itemBuilder
→ Widget Function(BuildContext context, DesignCommand command, Set<
WidgetState> states) -
Paints a command; WidgetState.focused marks the highlighted one.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- layoutBuilder → DesignPaletteLayoutBuilder?
-
Lays out the field over the results; null: a column.
final
- maxHeight → double
-
The results' greatest height before they scroll.
final
-
onSelected
→ ValueChanged<
DesignCommand> ? -
Takes a chosen command; null runs its own DesignCommand.onPressed.
showDesignCommandPalette closes the route here.
final
- resultsMessage → String Function(int count)?
-
What a screen reader hears when the results change; null:
DesignLocalizations.commandPaletteResultsMessage.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- score → int? Function(String text, String query)
-
Ranks a command's words against the query.
final
- semanticLabel → String?
-
What a screen reader calls the results; null:
DesignLocalizations.commandPaletteLabel.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DesignCommandPalette> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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