DialogSelect<T> class

A generic searchable, grouped selection list dialog.

This is the lower-level primitive that CommandPalette and domain-specific list dialogs (model picker, agent picker, etc.) build upon.

Features:

  • Title bar with esc dismiss hint
  • Search input with fuzzy text filtering
  • Grouped items with section headers
  • Keyboard nav: up/down, pgup/pgdn, home/end, enter, esc
  • Mouse hover + click
  • Current item marker ()
  • Fully themeable via DialogThemeData + CommandPaletteThemeData
DialogSelect<String>(
  title: 'Select Model',
  items: models.map((m) => DialogSelectItem(
    label: m.name,
    value: m.id,
    description: m.provider,
    category: m.providerGroup,
    isCurrent: m.id == currentModelId,
  )).toList(),
  onSelect: (item) => _setModel(item.value!),
  onDismiss: () => _close(),
)
Inheritance

Constructors

DialogSelect({required List<DialogSelectItem<T>> items, String? title, String? searchHint, void onSelect(DialogSelectItem<T> item)?, CmdCallback? onDismiss, int? width, int? height, List<({String description, String key})> keybinds = const [], Widget trailing(int filteredCount, int totalCount)?, void onHighlightChanged(DialogSelectItem<T> item)?, Widget emptyBuilder(String searchQuery)?, Key? key})

Properties

children List<Widget>
Child widgets that receive forwarded messages.
no setterinherited
debugRenderObjectPassthrough bool
Whether this widget is intentionally transparent to render-object layouts.
no setterinherited
emptyBuilder Widget Function(String searchQuery)?
Custom builder for the empty state (when no items match the search). Receives the current search query. If null, a default "No matches" text is shown.
final
focusable bool
Whether this widget can receive keyboard focus.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height int?
Height of the dialog in rows. Defaults to theme or 22.
final
id String
Unique identifier for this widget.
no setterinherited
items List<DialogSelectItem<T>>
Items to display and filter.
final
key Key?
Key for preserving widget identity.
finalinherited
keybinds List<({String description, String key})>
Additional keybind hints shown in the footer.
final
onDismiss CmdCallback?
Called when the dialog should be dismissed.
final
onHighlightChanged → void Function(DialogSelectItem<T> item)?
Called when the highlighted (selected) item changes due to keyboard navigation or mouse hover. Useful for live-preview scenarios like theme switching.
final
onSelect → void Function(DialogSelectItem<T> item)?
Called when an item is selected (enter or click).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchHint String?
Placeholder text for the search input.
final
theme Theme
Access the current theme.
no setterinherited
title String?
Title shown at the top of the dialog.
final
trailing Widget Function(int filteredCount, int totalCount)?
Optional trailing widget shown at the bottom (e.g., item count).
final
width int?
Width of the dialog in columns. Defaults to theme or 64.
final

Methods

buildCachedView<T>(T builder(), Object? cacheKey) → T
Returns a cached view if the cache key matches.
inherited
createState() State<StatefulWidget>
Creates the mutable State associated with this widget.
override
handleInit() Cmd?
Override this instead of init for widget-specific initialization.
inherited
handleIntercept(Msg msg) → (Widget, Cmd?)
Override this to handle messages before they reach children.
inherited
handleUpdate(Msg msg) → (Widget, Cmd?)
Override this to handle messages specific to this widget.
inherited
init() Cmd?
Called once when the widget is first mounted.
inherited
invalidateCachedView() → void
Clears any cached view for this widget.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(Msg msg) → (Model, Cmd?)
Handles messages by forwarding to children then calling handleUpdate.
inherited
view() Object
Renders the widget to a string or View.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited