KatDropDownTextField class

A TextFormField with a DropdownButton built into its suffix, letting the user either type a value directly or tap the dropdown icon to pick one of items instead.

onChanged fires for typed input, onSelected fires when a dropdown item is picked - the two are independent, so a caller that wants typing a value and picking one to behave the same way (e.g. keeping controller in sync) needs to handle that itself in both callbacks.

Inheritance

Constructors

KatDropDownTextField({Key? key, String? labelText, String? initialValue, String? selectedValue, String? suffixText, Function? onChanged, Function? onSelected, Function? validator, Function? onTap, int? maxLines, int? maxLength, TextEditingController? controller, TextInputType? keyboardType, List<DropdownMenuItem<String>>? items, bool autovalidate = false, bool readOnly = false, bool autoFocus = false, bool hasBorder = false, List<TextInputFormatter>? inputFormatters, TextStyle? style, TextAlign textAlign = TextAlign.start})
const

Properties

autoFocus bool
final
autovalidate bool
final
controller TextEditingController?
final
hasBorder bool
Whether to draw an outlined border, focused in the theme's primary color. When false (the default), falls back to the ambient InputDecorationTheme's border.
final
hashCode int
The hash code for this object.
no setterinherited
initialValue String?
final
inputFormatters List<TextInputFormatter>?
final
items List<DropdownMenuItem<String>>?
The choices offered by the suffix DropdownButton.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType TextInputType?
final
labelText String?
final
maxLength int?
final
maxLines int?
final
onChanged Function?
Called with the new text when the user types into the field.
final
onSelected Function?
Called with the picked value when the user chooses a suffix dropdown item.
final
onTap Function?
final
readOnly bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedValue String?
The value shown as selected in the suffix DropdownButton.
final
style TextStyle?
final
suffixText String?
final
textAlign TextAlign
final
validator Function?
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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