CLCommandPalette class
Command palette / global search stile shadcn — generica e decoupled.
Due sorgenti, combinabili:
- items: lista statica/locale, filtrata client-side su
label/description. - asyncSearch: callback async (es. fan-out su repository/BE). Debounced (debounce), parte solo da minQueryLength caratteri, con guard di obsolescenza (le risposte in volo di query superate vengono ignorate).
I risultati sono raggruppati per CLCommandItem.group (header per gruppo; gli item senza group restano in cima senza header). La navigazione è incapsulata in CLCommandItem.onSelect → il widget NON conosce le route.
onAskAi opzionale: quando la query non produce risultati, mostra una riga "chiedi all'AI" selezionabile. L'app decide cosa significhi.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CLCommandPalette
- Available extensions
Constructors
-
CLCommandPalette({Key? key, List<
CLCommandItem> items = const [], List<CLCommandItem> ? previewItems, Future<List< asyncSearch(String query)?, int minQueryLength = 1, Duration debounce = const Duration(milliseconds: 300), void onAskAi(String query)?, String? askAiLabel, String? hintText, String? emptyText})CLCommandItem> > -
const
Properties
- askAiLabel → String?
-
final
-
asyncSearch
→ Future<
List< Function(String query)?CLCommandItem> > -
final
- debounce → Duration
-
final
- emptyText → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintText → String?
-
final
-
items
→ List<
CLCommandItem> -
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minQueryLength → int
-
final
- onAskAi → void Function(String query)?
-
final
-
previewItems
→ List<
CLCommandItem> ? -
Voci mostrate SOLO a query vuota (anteprima "principali"). Se null si
ricade su items. La ricerca digitata filtra sempre items (+ async).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
animateOnActionTrigger(
AnimationInfo animationInfo, {bool hasBeenTriggered = false}) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
animateOnPageLoad(
AnimationInfo animationInfo) → Widget -
Available on Widget, provided by the AnimatedWidgetExtension extension
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CLCommandPalette> -
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.
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
Static Methods
-
show(
BuildContext context, {List< CLCommandItem> items = const [], List<CLCommandItem> ? previewItems, Future<List< asyncSearch(String query)?, int minQueryLength = 1, Duration debounce = const Duration(milliseconds: 300), void onAskAi(String query)?, String? askAiLabel, String? hintText, String? emptyText}) → Future<CLCommandItem> >void>