TextFieldBlocBuilder class

A material design text field that can show suggestions.

Inheritance

Constructors

TextFieldBlocBuilder({Key? key, required TextFieldBloc textFieldBloc, bool enableOnlyWhenFormBlocCanSubmit = false, bool isEnabled = true, FieldBlocErrorBuilder? errorBuilder, SuffixButton? suffixButton, EdgeInsetsGeometry? padding, bool removeSuggestionOnLongPress = false, FocusNode? focusNode, InputDecoration decoration = const InputDecoration(), TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, @Deprecated('Use textStyle') TextStyle? style, TextStyle? textStyle, MaterialStateProperty<Color?>? textColor, StrutStyle? strutStyle, bool? obscureText, TextAlign? textAlign, TextAlignVertical? textAlignVertical, TextDirection? textDirection, bool? showCursor, bool autofocus = false, bool autocorrect = true, int? maxLines = 1, int? minLines, bool expands = false, int? maxLength, MaxLengthEnforcement maxLengthEnforced = MaxLengthEnforcement.enforced, ValueChanged<String>? onChanged, VoidCallback? onEditingComplete, ValueChanged<String>? onSubmitted, List<TextInputFormatter>? inputFormatters, double cursorWidth = 2.0, Radius? cursorRadius, Color? cursorColor, Brightness? keyboardAppearance, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), DragStartBehavior dragStartBehavior = DragStartBehavior.start, bool enableInteractiveSelection = true, GestureTapCallback? onTap, InputCounterWidgetBuilder? buildCounter, ScrollController? scrollController, ScrollPhysics? scrollPhysics, SuggestionsBoxDecoration? suggestionsBoxDecoration, TextStyle? suggestionTextStyle, Duration debounceSuggestionDuration = const Duration(milliseconds: 300), bool getImmediateSuggestions = true, Duration suggestionsAnimationDuration = const Duration(milliseconds: 700), FocusNode? nextFocusNode, bool hideOnLoadingSuggestions = false, bool hideOnEmptySuggestions = false, bool hideOnSuggestionsError = false, WidgetBuilder? loadingSuggestionsBuilder, WidgetBuilder? suggestionsNotFoundBuilder, ErrorBuilder? suggestionsErrorBuilder, bool keepSuggestionsOnLoading = false, bool showSuggestionsWhenIsEmpty = true, bool readOnly = false, ToolbarOptions? toolbarOptions, bool enableSuggestions = true, bool animateWhenCanShow = true, bool focusOnValidationFailed = true, Widget? obscureTextTrueIcon, Widget? obscureTextFalseIcon, Widget? clearTextIcon, Iterable<String>? autofillHints, Widget asyncValidatingIcon = const SizedBox(height: 24, width: 24, child: Padding(padding: EdgeInsets.all(8.0), child: CircularProgressIndicator(strokeWidth: 2.0)))})
Creates a Material Design text field
const

Properties

animateWhenCanShow bool
Set to true if you want animate size/fade, when the field bloc is added and removed from form bloc.
final
asyncValidatingIcon Widget
When suffixButton is SuffixButton.asyncValidating, this icon will be displayed.
final
autocorrect bool
Whether to enable autocorrection.
final
autofillHints Iterable<String>?
final
autofocus bool
Whether this text field should focus itself if nothing else is already focused.
final
buildCounter InputCounterWidgetBuilder?
Callback that generates a custom InputDecorator.counter widget.
final
clearTextIcon Widget?
When suffixButton is SuffixButton.clearText, this icon will be displayed.
final
cursorColor Color?
The color to use when painting the cursor.
final
cursorRadius Radius?
How rounded the corners of the cursor should be.
final
cursorWidth double
How thick the cursor will be.
final
debounceSuggestionDuration Duration
The duration to wait after the user stops typing before calling TextFieldBlocState.suggestions.
final
decoration InputDecoration
The decoration to show around the text field.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
enableInteractiveSelection bool
Whether to enable user interface affordances for changing the text selection.
final
enableOnlyWhenFormBlocCanSubmit bool
If true, this widget will be enabled only when the state of the FormBloc that contains this FieldBloc has FormBlocState.canSubmit in true.
final
enableSuggestions bool
final
errorBuilder FieldBlocErrorBuilder?
This function take the context and the FieldBlocState.error and must return a String error to display in the widget when has an error or null if you don't want to display the error. By default is FieldBlocBuilder.defaultErrorBuilder.
final
expands bool
Whether this widget's height will be sized to fill its parent.
final
focusNode FocusNode?
final
focusOnValidationFailed bool
Set to true if you want to focus field when has error on submitting
final
getImmediateSuggestions bool
If set to true, suggestions will be fetched immediately when the field is added to the view.
final
hashCode int
The hash code for this object.
no setterinherited
hideOnEmptySuggestions bool
If set to true, nothing will be shown if there are no results. suggestionsNotFoundBuilder will also be ignored.
final
hideOnLoadingSuggestions bool
If set to true, no loading box will be shown while suggestions are being fetched. loadingSuggestionsBuilder will also be ignored.
final
hideOnSuggestionsError bool
If set to true, nothing will be shown if there is an error. suggestionsErrorBuilder will also be ignored.
final
inputFormatters List<TextInputFormatter>?
Optional input validation and formatting overrides.
final
isEnabled bool
If false the text field is "disabled": it ignores taps and its decoration is rendered in grey.
final
keepSuggestionsOnLoading bool
If set to false, the suggestions box will show a circular progress indicator when retrieving suggestions.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
The appearance of the keyboard.
final
keyboardType TextInputType
The type of keyboard to use for editing the text.
final
loadingSuggestionsBuilder WidgetBuilder?
Called when waiting for TextFieldBlocState.suggestions to return.
final
maxLength int?
The maximum number of characters (Unicode scalar values) to allow in the text field.
final
maxLengthEnforced MaxLengthEnforcement
MaxLengthEnforcement.enforced versus
final
maxLines int?
The maximum number of lines to show at one time, wrapping if necessary.
final
minLines int?
The minimum number of lines to occupy when the content spans fewer lines.
final
nextFocusNode FocusNode?
When change the value of the FieldBloc, this will call nextFocusNode.requestFocus().
final
obscureText bool?
Whether to hide the text being edited (e.g., for passwords).
final
obscureTextFalseIcon Widget?
When suffixButton is SuffixButton.obscureText, this icon will be displayed when obscure text is false.
final
obscureTextTrueIcon Widget?
When suffixButton is SuffixButton.obscureText, this icon will be displayed when obscure text is true.
final
onChanged ValueChanged<String>?
Called when the user initiates a change to the TextField's value: when they have inserted or deleted text.
final
onEditingComplete VoidCallback?
Called when the user submits editable content (e.g., user presses the "done" button on the keyboard).
final
onSubmitted ValueChanged<String>?
Called when the user indicates that they are done editing the text in the field.
final
onTap GestureTapCallback?
Called when the user taps on this text field.
final
padding EdgeInsetsGeometry?
The amount of space by which to inset the child.
final
readOnly bool
Whether the text can be changed.
final
removeSuggestionOnLongPress bool
if true when do a long press in a suggestion, it will be removed and will be added to TextFieldBloc.selectedSuggestion stream.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
The ScrollController to use when vertically scrolling the input.
final
scrollPadding EdgeInsets
Configures padding to edges surrounding a Scrollable when the Textfield scrolls into view.
final
scrollPhysics ScrollPhysics?
The ScrollPhysics to use when vertically scrolling the input.
final
showCursor bool?
Whether to show cursor.
final
showSuggestionsWhenIsEmpty bool
If set to false, the suggestion no will be showed when the text is empty and TextFieldBlocState.suggestions not will be called
final
strutStyle StrutStyle?
The strut style used for the vertical layout.
final
suffixButton SuffixButton?
The suffix button with a default behavior:
final
suggestionsAnimationDuration Duration
The time for show and hide the suggestions box. By default is 700 milliseconds.
final
suggestionsBoxDecoration SuggestionsBoxDecoration?
The decoration of the material sheet that contains the suggestions.
final
suggestionsErrorBuilder → ErrorBuilder?
Called when TextFieldBlocState.suggestions throws an exception.
final
suggestionsNotFoundBuilder WidgetBuilder?
Called when TextFieldBlocState.suggestions returns an empty array.
final
suggestionTextStyle TextStyle?
The style to use for the suggestion text.
final
textAlign TextAlign?
How the text should be aligned horizontally.
final
textAlignVertical TextAlignVertical?
final
textCapitalization TextCapitalization
Configures how the platform keyboard will select an uppercase or lowercase keyboard.
final
textColor MaterialStateProperty<Color?>?
It is the color of the text
final
textDirection TextDirection?
The directionality of the text.
final
textFieldBloc TextFieldBloc
The fieldBloc for rebuild the widget when its state changes.
final
textInputAction TextInputAction?
The type of action button to use for the keyboard.
final
textStyle TextStyle?
The style to use for the text being edited.
final
toolbarOptions ToolbarOptions?
Configuration of toolbar options.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _TextFieldBlocBuilderState
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
themeStyleOf(BuildContext context) TextFieldTheme
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}) 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

Constants

noMaxLength → const int
If maxLength is set to this value, only the "current input length" part of the character counter is shown.