TsaiSelect<T> class

A controlled generic select matching the Penpot Select component.

The options open in TsaiBottomSheet on Android and iOS, and in an anchored menu on web and desktop. Opening the options does not change the field's 56-pixel visual height. Set onChanged to null to disable the component.

Inheritance

Constructors

TsaiSelect({required List<TsaiSelectOption<T>> options, required T? value, required ValueChanged<T?>? onChanged, Key? key, String? placeholder, bool labeledPlaceholder = true, String? description, String? errorText, bool showClearButton = true, bool autofocus = false, FocusNode? focusNode, ValueChanged<bool>? onFocusChange, VoidCallback? onOpen, VoidCallback? onClose, String? semanticLabel, double menuMaxHeight = 320, TsaiSelectPresentation presentation = TsaiSelectPresentation.adaptive})
Creates a Tsai select.
const

Properties

autofocus bool
Whether the field requests focus initially.
final
description String?
Supporting text displayed below the field.
final
errorText String?
Error text displayed below the field.
final
focusNode FocusNode?
Optional caller-owned focus node.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labeledPlaceholder bool
Whether placeholder floats above a selected value.
final
Maximum menu height before it scrolls.
final
onChanged ValueChanged<T?>?
Called with a selected value or null when cleared.
final
onClose VoidCallback?
Called after the menu closes.
final
onFocusChange ValueChanged<bool>?
Called when keyboard focus changes.
final
onOpen VoidCallback?
Called after the menu opens.
final
options List<TsaiSelectOption<T>>
Available menu options.
final
placeholder String?
Text displayed as a placeholder and, when labeledPlaceholder is true, as a floating label while a value is selected.
final
presentation TsaiSelectPresentation
How the option list is presented.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
Optional accessibility label replacing placeholder.
final
showClearButton bool
Whether to show a clear action for a selected value.
final
value → T?
Currently selected value.
final

Methods

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