PlinthCombobox<T> class

The option-list primitive behind a select-shaped control, matching Mantine's Combobox.

This is the part that is genuinely fiddly and genuinely shared: an overlay anchored to a field that tracks it through scrolling, a highlighted option that moves with the arrow keys and skips disabled entries, Enter to take the highlight, Escape to abandon it, and a list that stays in sync when its options change underneath.

Mantine's Combobox.Dropdown is folded in rather than exported separately. In React the dropdown is a distinct component because it is a distinct piece of markup; here the overlay is plumbing, not a thing a caller composes, and PlinthPopover already covers "anchored panel with arbitrary content". A second wrapper would be API surface with nothing behind it.

PlinthSelect, PlinthAutocomplete, PlinthMultiSelect and PlinthTagsInput predate this and keep their own dropdown mechanics. This is for building the next one — or a control none of them cover, like a command palette.

PlinthCombobox<String>(
  controller: _dropdown,
  target: PlinthTextInput(controller: _search),
  options: _matches,
  onSelected: _choose,
)
Inheritance

Constructors

PlinthCombobox({Key? key, required PlinthDisclosureController controller, required Widget target, required List<PlinthComboboxOption<T>> options, required ValueChanged<T> onSelected, T? selected, double? width, double maxHeight = 240, Widget? empty, PlinthSize size = PlinthSize.md, String? color, PlinthSize? radius, bool closeOnSelect = true})
const

Properties

closeOnSelect → bool
final
color → String?
final
controller → PlinthDisclosureController
final
empty → Widget?
Shown when options is empty. Omit to render nothing at all — an empty bordered box is worse than no box.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxHeight → double
final
onSelected → ValueChanged<T>
final
options → List<PlinthComboboxOption<T>>
final
radius → PlinthSize?
Overrides the theme's default radius for this one instance.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selected → T?
Marked with a check, and where the highlight starts when the list opens.
final
size → PlinthSize
final
target → Widget
The field the list hangs off. Tapping it is not wired up — unlike PlinthPopover, the trigger here is usually a text field that needs its taps for the caret, so opening is the caller's call.
final
width → double?
Defaults to the target's width, which is what a select-shaped dropdown almost always wants.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<PlinthCombobox<T>>
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