TFormField<T> class
A form field wrapper with factory methods for all input types.
TFormField provides a unified interface for creating form fields with:
- Automatic value binding to TFieldProp
- Factory methods for all widget types
- Responsive sizing (sm, md, lg)
- Integration with TFormBuilder
Factory Methods
text()- Text inputnumber()- Number inputdate()- Date pickertime()- Time pickerdateTime()- Date-time pickerselect()- Single selectionmultiSelect()- Multiple selectiontoggle()- Switchcheckbox()- CheckboxcheckboxGroup()- Checkbox groupfilePicker()- File uploadgroup()- Nested formitems()- Dynamic list of forms
Usage Example
final name = TFieldProp<String>('');
TFormField.text(name, 'Name',
isRequired: true,
rules: [Validations.required],
).size(6) // 6 columns on medium screens
Type parameter:
T: The type of the field value
See also:
- TFieldProp for reactive properties
- TFormBuilder for form layout
Constructors
-
TFormField({required Widget builder(ValueChanged<
T?> ), required TFieldProp<T> prop}) - Creates a form field.
Properties
-
builder
→ Widget Function(ValueChanged<
T?> ) -
Builder function that creates the widget.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
prop
→ TFieldProp<
T> -
The reactive property for this field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
size(
int md, {int? sm, int? lg}) → TFormField< T> - Sets the responsive size of the field.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
checkbox(
TFieldProp< bool?> prop, String? label, {FocusNode? focusNode, bool isRequired = false, List<String? Function(bool?)> ? rules, bool autoFocus = false, bool disabled = false, Color? color, TInputSize? size}) → TFormField<bool?> -
checkboxGroup<
T> (TFieldProp< List< prop, String? label, List<T> >TCheckboxGroupItem< items, {String? tag, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, TInputFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, List<T> >String? Function(List< ? rules, Color? color, bool block = true, bool vertical = false}) → TFormField<T> ?)>List< T> > -
date(
TFieldProp< DateTime> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTextFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(DateTime?)> ? rules, VoidCallback? onShow, VoidCallback? onHide, DateFormat? format, DateTime? firstDate, DateTime? lastDate}) → TFormField<DateTime> -
dateTime(
TFieldProp< DateTime> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTextFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(DateTime?)> ? rules, VoidCallback? onShow, VoidCallback? onHide, DateFormat? format, DateTime? firstDate, DateTime? lastDate}) → TFormField<DateTime> -
filePicker<
T> (TFieldProp< List< prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, TFilePickerTheme? theme, FocusNode? focusNode, VoidCallback? onTap, List<TFile> >String? Function(List< ? rules, bool allowMultiple = false, List<TFile> ?)>String> ? allowedExtensions, TFileType fileType = TFileType.any}) → TFormField<List< TFile> > -
group<
T extends TFormBase> (TFieldProp< T> prop, {String? label}) → TFormField<T> -
items<
T extends TFormBase> (TFieldProp< List< prop, T onNewItem(), {String? label, String buttonLabel = 'Add New', TItemAddPosition itemAddPosition = TItemAddPosition.first}) → TFormField<T> >List< T> > -
multiSelect<
T, V, K> (TFieldProp< List< prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTagsFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TTagsController? textController, List<V> >String? Function(List< ? rules, List<V> ?)>T> ? items, ItemKeyAccessor<T, K> ? itemKey, ItemValueAccessor<T, V> ? itemValue, ItemTextAccessor<T> ? itemText, ItemTextAccessor<T> ? itemSubText, ItemTextAccessor<T> ? itemImageUrl, ItemChildrenAccessor<T> ? itemChildren, int itemsPerPage = 10, TLoadListener<T> ? onLoad, int? searchDelay}) → TFormField<List< V> > -
number<
T extends num> (TFieldProp< T> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TNumberFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(T?)> ? rules}) → TFormField<T> -
select<
T, V, K> (TFieldProp< V?> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTextFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(V?)> ? rules, List<T> ? items, ItemKeyAccessor<T, K> ? itemKey, ItemValueAccessor<T, V> ? itemValue, ItemTextAccessor<T> ? itemText, ItemTextAccessor<T> ? itemSubText, ItemTextAccessor<T> ? itemImageUrl, ItemChildrenAccessor<T> ? itemChildren, int? itemsPerPage = 6, TLoadListener<T> ? onLoad, int? searchDelay}) → TFormField<V?> -
text(
TFieldProp< String> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTextFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(String?)> ? rules, int rows = 1}) → TFormField<String> -
time(
TFieldProp< TimeOfDay> prop, String? label, {String? tag, String? placeholder, String? helperText, bool isRequired = false, bool disabled = false, bool autoFocus = false, bool readOnly = false, TTextFieldTheme? theme, FocusNode? focusNode, VoidCallback? onTap, TextEditingController? textController, List<String? Function(TimeOfDay?)> ? rules, VoidCallback? onShow, VoidCallback? onHide, DateFormat? format}) → TFormField<TimeOfDay> -
toggle(
TFieldProp< bool> prop, String? label, {FocusNode? focusNode, bool isRequired = false, List<String? Function(bool?)> ? rules, bool autoFocus = false, bool disabled = false, Color? color, TInputSize? size}) → TFormField<bool>