CustomTextFormField class
A customizable and reusable TextFormField widget with enhanced styling, built-in multiline support, optional validation, and rich text formatting.
This widget is designed to offer flexibility and consistent styling across forms or inputs, with sensible defaults and optional overrides.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CustomTextFormField
Constructors
-
CustomTextFormField({Key? key, required TextEditingController controller, required String hintText, TextStyle? textStyle, TextStyle? hintStyle, InputBorder? border, bool multiline = false, bool readOnly = false, TextAlign textAlign = TextAlign.start, FormFieldValidator<
String> ? validator, Color? fillColor, int? minLines, int? maxLines, List<TextInputFormatter> ? inputFormatters, EdgeInsetsGeometry? contentPadding, ValueChanged<String> ? onChanged, TextCapitalization capitalization = TextCapitalization.sentences}) -
Creates a CustomTextFormField with extended customization and formatting options.
const
Properties
- border → InputBorder?
-
Border for all states (enabled, focused, etc.). If not provided, uses a default rounded border.
final
- capitalization → TextCapitalization
-
Controls capitalization behavior (e.g., sentences, words, characters).
final
- contentPadding → EdgeInsetsGeometry?
-
Internal padding inside the input field. Defaults to vertical spacing.
final
- controller → TextEditingController
-
Controls the text being edited.
final
- fillColor → Color?
-
Background color of the input field. Defaults to a soft cream tone.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintStyle → TextStyle?
-
Custom style for the hint text. If not provided, uses default font.
final
- hintText → String
-
Hint text displayed when the input is empty.
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
Input formatters to apply (e.g., filtering digits, uppercasing).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxLines → int?
-
Maximum number of lines allowed when multiline is true.
final
- minLines → int?
-
Minimum number of lines to occupy when multiline is true.
final
- multiline → bool
-
Enables multi-line input when set to
true
.final -
onChanged
→ ValueChanged<
String> ? -
Callback triggered when the text is changed.
final
- readOnly → bool
-
Disables editing if set to
true
.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textAlign → TextAlign
-
Defines the alignment of the entered text (e.g., start, center).
final
- textStyle → TextStyle?
-
Custom style for the input text. If not provided, uses default font.
final
-
validator
→ FormFieldValidator<
String> ? -
Validation logic to be applied to the field value.
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