CustomTextField class
This is the custom text field with basic design that you can use directly
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CustomTextField
Constructors
-
CustomTextField({Key? key, dynamic onTapOutside(PointerDownEvent)?, required TextEditingController controller, required String hintText, bool isUnderLine = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start, double? width, List<
Locale> ? hintLocales, TextSelectionControls? selectionControls, Radius? cursorRadius, bool? selectAllOnFocus, bool onTapAlwaysCalled = false, bool? ignorePointers, Color? cursorErrorColor, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), WidgetStatesController? statesController, TextMagnifierConfiguration? magnifierConfiguration, bool enableSuggestions = true, TapRegionUpCallback? onTapUpOutside, Widget? buildCounter(BuildContext, {required int currentLength, required bool isFocused, required int? maxLength})?, bool stylusHandwritingEnabled = EditableText.defaultStylusHandwritingEnabled, bool canRequestFocus = true, bool scribbleEnabled = true, Object groupId = EditableText, Clip clipBehavior = Clip.hardEdge, UndoHistoryController? undoController, MouseCursor? mouseCursor, TextStyle? style, int? minLines = 1, SmartDashesType? smartDashesType = SmartDashesType.disabled, SmartQuotesType? smartQuotesType = SmartQuotesType.disabled, TextDirection? textDirection = TextDirection.ltr, Color? cursorColor, bool autocorrect = true, bool isCollapsed = false, ContentInsertionConfiguration? contentInsertionConfiguration, Brightness? keyboardAppearance, Widget? suffix, Widget? prefix, BoxBorder? border, bool expands = false, StrutStyle? strutStyle, List<TextInputFormatter> ? inputFormatters, TextInputAction? textInputAction, double? contentPaddingHorizontal, Iterable<String> ? autofillHints, Color? borderColor, BoxConstraints? prefixIconConstraints, BoxConstraints? suffixIconConstraints, int? maxLines, String? validator(String?)?, int? maxLength, dynamic onSaved(String?)?, double? fontSize, Color? textColor, TextCapitalization textCapitalization = TextCapitalization.none, double? hintTextFontSize, double? headingFontSize, String? headingText, String? subHeadingText, FontWeight? headingFontWeight, double? cursorHeight, bool? autofocus = false, bool readOnly = false, bool filled = true, double? contentPaddingVertical, double horizontalPadding = 0, double verticalPadding = 0, bool obscureText = false, Color? fillColor = MyColors.fillColor, Color? bgColor, Color? hintColor, double? borderRadius, TextInputType? keyboardType, dynamic onChanged(String)?, bool enabled = true, SpellCheckConfiguration? spellCheckConfiguration, double headingSpace = 0, String? suffixText, Color? focusedBorderColor, Widget contextMenuBuilder(BuildContext, EditableTextState)?, FocusNode? focusNode, bool enableInteractiveSelection = true, dynamic onTap()?, TextAlign textAlign = TextAlign.start, bool? showShadow = false, Color? headingColor, dynamic onFieldSubmitted(String)?, dynamic onEditingComplete()?, bool? showCursor = true, Widget errorBuilder(BuildContext, String)?, FloatingLabelAlignment? floatingLabelAlignment = FloatingLabelAlignment.start, String? errorText, TextStyle? errorStyle, InputBorder? errorBorder, Widget? counter, BoxConstraints? constraints, Widget? label, TextStyle? counterStyle, Widget? error, Widget? icon, ScrollPhysics? scrollPhysics, ScrollController? scrollController, void onAppPrivateCommand(String, Map<String, dynamic> )?, bool enableIMEPersonalizedLearning = true, double cursorWidth = 1.0, bool? cursorOpacityAnimates, AutovalidateMode? autovalidateMode, Widget? prefixIcon, bool? alignLabelWithHint, EdgeInsetsGeometry? contentPadding, String? counterText, InputBorder? disabledBorder, InputBorder? enabledBorder, int? errorMaxLines, FloatingLabelBehavior? floatingLabelBehavior, TextStyle? floatingLabelStyle, Color? focusColor, InputBorder? focusedBorder, InputBorder? focusedErrorBorder, Widget? helper, int? helperMaxLines, TextStyle? helperStyle, String? helperText, Widget? hint, Duration? hintFadeDuration, int? hintMaxLines, TextStyle? hintStyle, TextDirection? hintTextDirection, Color? hoverColor, Color? iconColor, bool? isDense, TextStyle? labelStyle, String? labelText, bool? maintainHintHeight, bool? maintainHintSize, Color? prefixIconColor, TextStyle? prefixStyle, String? restorationId, String? semanticCounterText, Widget? suffixIcon, Color? suffixIconColor, TextStyle? suffixStyle, VisualDensity? visualDensity}) - this is the constructor of the CustomTextField
Properties
- alignLabelWithHint ↔ bool?
-
Aligns label with hint text
getter/setter pair
- autocorrect → bool
-
Enables or disables text autocorrection while typing
final
-
autofillHints
→ Iterable<
String> ? -
this will allow text field to autofill hints
final
- autofocus → bool?
-
this is the autofocus of the custom text field
final
- autovalidateMode ↔ AutovalidateMode?
-
Enables automatic validation behavior
getter/setter pair
- bgColor → Color?
-
this is the bgColor of the custom text field
final
- border → BoxBorder?
-
this is the border of the custom text field
final
- borderColor → Color?
-
this is the borderColor of the custom text field
final
- borderRadius → double
-
this is the borderRadius of the custom text field
final
- buildCounter ↔ Widget? Function(BuildContext, {required int currentLength, required bool isFocused, required int? maxLength})?
-
Builds a custom character counter widget
getter/setter pair
- canRequestFocus ↔ bool
-
Allows the text field to request focus
getter/setter pair
- clipBehavior ↔ Clip
-
Defines how content is clipped inside the field
getter/setter pair
- constraints ↔ BoxConstraints?
-
Size constraints applied to the decoration
getter/setter pair
- contentInsertionConfiguration ↔ ContentInsertionConfiguration?
-
Enables content insertion from external sources
getter/setter pair
- contentPadding ↔ EdgeInsetsGeometry?
-
Padding inside the input field
getter/setter pair
- contentPaddingHorizontal → double?
-
this is the contentPaddingHorizontal of the custom text field
final
- contentPaddingVertical → double?
-
this is the contentPaddingVertical of the custom text field
final
- contextMenuBuilder ↔ Widget Function(BuildContext, EditableTextState)?
-
Builds a custom context menu for text actions
getter/setter pair
- controller → TextEditingController
-
this is the controller of the custom text field
final
- counter ↔ Widget?
-
Widget displayed as the character counter
getter/setter pair
- counterStyle ↔ TextStyle?
-
Style applied to counter text
getter/setter pair
- counterText ↔ String?
-
Text displayed as the character counter
getter/setter pair
- cursorColor → Color?
-
this is the cursor color of the text field
final
- cursorErrorColor ↔ Color?
-
Cursor color shown when the field is in error state
getter/setter pair
- cursorHeight → double?
-
this is the cursorHeight of the custom text field
final
- cursorOpacityAnimates ↔ bool?
-
Animates cursor opacity when blinking
getter/setter pair
- cursorRadius ↔ Radius?
-
Rounded corners applied to the text cursor
getter/setter pair
- cursorWidth ↔ double
-
Width of the blinking text cursor
getter/setter pair
- disabledBorder ↔ InputBorder?
-
Border shown when the field is disabled
getter/setter pair
- dragStartBehavior → DragStartBehavior
-
Determines when a drag gesture is recognized (start or down)
final
- enabled → bool
-
this is the enabled of the custom text field
final
- enabledBorder ↔ InputBorder?
-
Border shown when the field is enabled
getter/setter pair
- enableIMEPersonalizedLearning ↔ bool
-
Allows IME to learn from user input
getter/setter pair
- enableInteractiveSelection → bool
-
this is the enableInteractiveSelection of the custom text field
final
- enableSuggestions → bool
-
Enables or disables keyboard text suggestions while typing
final
- error ↔ Widget?
-
Custom error widget displayed below the field
getter/setter pair
- errorBorder ↔ InputBorder?
-
Border shown when the field has an error
getter/setter pair
- errorBuilder → Widget Function(BuildContext, String)?
-
Builds a custom widget to display validation errors
final
- errorMaxLines ↔ int?
-
Maximum lines allowed for error text
getter/setter pair
- errorStyle ↔ TextStyle?
-
Style applied to error text
getter/setter pair
- errorText ↔ String?
-
Error text displayed below the field
getter/setter pair
- expands → bool
-
Expands the text field to fill the available vertical space
final
- fillColor → Color?
-
this is the fillColor of the custom text field
final
- filled → bool
-
this is the filled of the custom text field
final
- floatingLabelAlignment ↔ FloatingLabelAlignment?
-
Alignment of the floating label
getter/setter pair
- floatingLabelBehavior ↔ FloatingLabelBehavior?
-
Controls when the label floats
getter/setter pair
- floatingLabelStyle ↔ TextStyle?
-
Style applied to the floating label
getter/setter pair
- focusColor ↔ Color?
-
Color when the field is focused
getter/setter pair
- focusedBorder ↔ InputBorder?
-
Border shown when the field is focused
getter/setter pair
- focusedBorderColor → Color?
-
this is the focusedBorderColor of the custom text field
final
- focusedErrorBorder ↔ InputBorder?
-
Border shown when focused and has an error
getter/setter pair
- focusNode → FocusNode?
-
this is the focusNode of the custom text field
final
- fontSize → double?
-
this is the fontSize of the custom text field
final
- groupId → Object
-
Groups editable text fields for shared selection and toolbar behavior
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headingColor → Color?
-
this is the heading color of the custom text field
final
- headingFontSize → double?
-
this is the headingFontSize of the custom text field
final
- headingFontWeight → FontWeight?
-
this is the headingFontWeight of the custom text field
final
- headingSpace → double
-
this is the space between text field and the heading
final
- headingText → String?
-
this is the headingText of the custom text field
final
- helper ↔ Widget?
-
Helper widget displayed below the field
getter/setter pair
- helperMaxLines ↔ int?
-
Maximum lines allowed for helper text
getter/setter pair
- helperStyle ↔ TextStyle?
-
Style applied to helper text
getter/setter pair
- helperText ↔ String?
-
Helper text displayed below the field
getter/setter pair
- hint ↔ Widget?
-
Widget displayed as hint
getter/setter pair
- hintColor → Color?
-
this is the hintColor of the custom text field
final
- hintFadeDuration ↔ Duration?
-
Duration for hint fade animation
getter/setter pair
-
hintLocales
↔ List<
Locale> ? -
Preferred locales for hint text
getter/setter pair
- hintMaxLines ↔ int?
-
Maximum lines allowed for hint text
getter/setter pair
- hintStyle ↔ TextStyle?
-
Style applied to hint text
getter/setter pair
- hintText → String
-
this is the hintText of the custom text field
final
- hintTextDirection ↔ TextDirection?
-
Direction of the hint text
getter/setter pair
- hintTextFontSize → double?
-
this is the hintTextFontSize of the custom text field
final
- horizontalPadding → double
-
this is the horizontalPadding of the custom text field
final
- hoverColor ↔ Color?
-
Color when the field is hovered
getter/setter pair
- icon ↔ Widget?
-
Icon displayed before the input field
getter/setter pair
- iconColor ↔ Color?
-
Color applied to the leading icon
getter/setter pair
- ignorePointers ↔ bool?
-
Disables pointer interactions when set to true
getter/setter pair
-
inputFormatters
→ List<
TextInputFormatter> ? -
this is the inputFormatters of the custom text field
final
- isCollapsed → bool
-
this is the isCollapsed of the custom text field
final
- isDense ↔ bool?
-
Reduces vertical spacing inside the field
getter/setter pair
- isUnderLine → bool
-
Determines whether the text field uses an underline border
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardAppearance ↔ Brightness?
-
Controls keyboard brightness (light or dark)
getter/setter pair
- keyboardType ↔ TextInputType?
-
this is the keyboardType of the custom text field
getter/setter pair
- label ↔ Widget?
-
Widget used as the input label
getter/setter pair
- labelStyle ↔ TextStyle?
-
Style applied to the label text
getter/setter pair
- labelText ↔ String?
-
Text used as the input label
getter/setter pair
- magnifierConfiguration ↔ TextMagnifierConfiguration?
-
Configuration for the text magnifier
getter/setter pair
- maintainHintHeight ↔ bool?
-
Maintains hint height even when hidden
getter/setter pair
- maintainHintSize ↔ bool?
-
Maintains hint size even when hidden
getter/setter pair
- maxLength → int?
-
this is the maxLength of the custom text field
final
- maxLines → int?
-
this is the maxLines of the custom text field
final
- minLines → int?
-
this is the minLines of the custom text field
final
- mouseCursor ↔ MouseCursor?
-
Mouse cursor displayed when hovering over the field
getter/setter pair
- obscureText → bool
-
this is the obscureText of the custom text field
final
-
onAppPrivateCommand
↔ void Function(String, Map<
String, dynamic> )? -
Handles private commands sent by the IME
getter/setter pair
- onChanged → dynamic Function(String)?
-
this is the onChanged of the custom text field
final
- onEditingComplete → dynamic Function()?
-
this is the onEditingComplete of the custom text field
final
- onFieldSubmitted → dynamic Function(String)?
-
this is the onFieldSubmitted of the custom text field
final
- onSaved → dynamic Function(String?)?
-
this is the onSaved of the custom text field
final
- onTap → dynamic Function()?
-
this is the onTap of the custom text field
final
- onTapAlwaysCalled → bool
-
Calls onTap even when the text field already has focus
final
- onTapOutside → dynamic Function(PointerDownEvent)?
-
this is the onTapOutside of the custom text field
final
- onTapUpOutside → TapRegionUpCallback?
-
Callback triggered when a tap is released outside the text field
final
- prefix ↔ Widget?
-
Widget displayed before the input text
getter/setter pair
- prefixIcon ↔ Widget?
-
Icon displayed at the start of the field
getter/setter pair
- prefixIconColor ↔ Color?
-
Color applied to prefix icon
getter/setter pair
- prefixIconConstraints → BoxConstraints?
-
this is the prefixIconConstraints of the custom text field
final
- prefixStyle ↔ TextStyle?
-
Style applied to prefix text
getter/setter pair
- readOnly → bool
-
this is the readOnly of the custom text field
final
- restorationId ↔ String?
-
Identifier used to restore text field state
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scribbleEnabled ↔ bool
-
Enables Scribble handwriting input on supported devices
getter/setter pair
- scrollController ↔ ScrollController?
-
Controller to manage scrolling programmatically
getter/setter pair
- scrollPadding ↔ EdgeInsets
-
Padding around the field when it scrolls into view
getter/setter pair
- scrollPhysics ↔ ScrollPhysics?
-
Scroll behavior for the editable text area
getter/setter pair
- selectAllOnFocus ↔ bool?
-
Selects all text automatically when the field gains focus
getter/setter pair
- selectionControls ↔ TextSelectionControls?
-
Custom controls for text selection actions
getter/setter pair
- semanticCounterText ↔ String?
-
Semantic text for the counter (accessibility)
getter/setter pair
- showCursor → bool?
-
Controls whether the text field’s cursor is visible
final
- showShadow → bool?
-
this is the showShadow of the custom text field
final
- smartDashesType → SmartDashesType?
-
Controls automatic dash formatting in the text field
final
- smartQuotesType → SmartQuotesType?
-
Controls automatic quote formatting in the text field
final
- spellCheckConfiguration ↔ SpellCheckConfiguration?
-
Enables spell checking configuration
getter/setter pair
- statesController ↔ WidgetStatesController?
-
Manages widget interaction states
getter/setter pair
- strutStyle → StrutStyle?
-
Controls the minimum line height and vertical spacing of the text
final
- style → TextStyle?
-
Text style to customize the appearance of the text
final
- stylusHandwritingEnabled ↔ bool
-
Enables stylus handwriting input
getter/setter pair
- subHeadingText → String?
-
this is the subHeadingText of the custom text field
final
- suffix ↔ Widget?
-
Widget displayed after the input text
getter/setter pair
- suffixIcon ↔ Widget?
-
Icon displayed at the end of the field
getter/setter pair
- suffixIconColor ↔ Color?
-
Color applied to suffix icon
getter/setter pair
- suffixIconConstraints → BoxConstraints?
-
this is the suffixIconConstraints of the custom text field
final
- suffixStyle ↔ TextStyle?
-
Style applied to suffix text
getter/setter pair
- suffixText → String?
-
this is the suffixText of the custom text field
final
- textAlign → TextAlign
-
this is the textAlign of the custom text field
final
- textCapitalization → TextCapitalization
-
this is the textCapitalization of the custom text field
final
- textColor → Color?
-
this is the textColor of the custom text field
final
- textDirection → TextDirection?
-
this is the textDirection of the custom text
final
- textInputAction → TextInputAction?
-
this will the the action when the field is submitted
final
- undoController ↔ UndoHistoryController?
-
Controls undo and redo history for text edits
getter/setter pair
- validator → String? Function(String?)?
-
this is the validator of the custom text field
final
- verticalPadding → double
-
this is the verticalPadding of the custom text field
final
- visualDensity ↔ VisualDensity?
-
Density configuration for layout spacing
getter/setter pair
- width → double?
-
this is the width of the custom text field
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
buildBorder(
{bool isUnderLine = false, required Color color, required double borderRadius}) → InputBorder? - this is the buildBorder of the custom text field
-
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