NTBInputFormField class
ShadForm-connected text field with NTB decoration (same role as ShadInputFormField).
Implementation follows ShadInputFormField from shadcn_ui with a merged
decorationBuilder for NTB borders.
When showValidationError is false, FormField.validate still reflects
validator failures and the input keeps error border styling, but no error
text is shown under the field and the label does not switch to error color.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FormField<
String> - ShadFormBuilderField<
String> - NTBFormField<
String> - NTBInputFormField
- Available extensions
Constructors
-
NTBInputFormField({String? id, Key? key, FormFieldSetter<
String> ? onSaved, String? forceErrorText, String? validator(String)?, String? initialValue, bool enabled = true, AutovalidateMode? autovalidateMode, String? restorationId, TextEditingController? controller, String? inputLabelText, Widget? labelWidget, Widget error(String error)?, String? descriptionText, Widget? descriptionWidget, bool required = false, void onChanged(String)?, @Deprecated('Use toValueTransformer instead') ToValueTransformer<String?> ? valueTransformer, ToValueTransformer<String?> ? toValueTransformer, FromValueTransformer<String?> ? fromValueTransformer, VoidCallback? onReset, FocusNode? focusNode, ShadDecoration? decoration, Widget? placeholder, TextMagnifierConfiguration? magnifierConfiguration, TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, TextStyle? style, StrutStyle? strutStyle, TextAlign textAlign = TextAlign.start, TextDirection? textDirection, bool autofocus = false, String obscuringCharacter = '•', bool obscureText = false, bool autocorrect = true, SmartDashesType? smartDashesType, SmartQuotesType? smartQuotesType, bool enableSuggestions = true, int? maxLines = 1, int? minLines, bool expands = false, bool readOnly = false, bool? showCursor, int? maxLength, MaxLengthEnforcement? maxLengthEnforcement, VoidCallback? onEditingComplete, ValueChanged<String> ? onSubmitted, AppPrivateCommandCallback? onAppPrivateCommand, List<TextInputFormatter> ? inputFormatters, double? cursorWidth, double? cursorHeight, Radius? cursorRadius, bool? cursorOpacityAnimates, Color? cursorColor, BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight, BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight, Brightness? keyboardAppearance, EdgeInsets scrollPadding = const EdgeInsets.all(20), bool? enableInteractiveSelection, TextSelectionControls? selectionControls, DragStartBehavior dragStartBehavior = DragStartBehavior.start, GestureTapCallback? onPressed, bool onPressedAlwaysCalled = false, TapRegionCallback? onPressedOutside, bool unfocusOnTapOutside = true, MouseCursor? mouseCursor, ScrollPhysics? scrollPhysics, ScrollController? scrollController, Iterable<String> ? autofillHints, Clip clipBehavior = Clip.hardEdge, bool scribbleEnabled = true, bool enableIMEPersonalizedLearning = true, ContentInsertionConfiguration? contentInsertionConfiguration, EditableTextContextMenuBuilder? contextMenuBuilder, UndoHistoryController? undoController, SpellCheckConfiguration? spellCheckConfiguration, Color? selectionColor, EdgeInsetsGeometry? padding = const EdgeInsets.symmetric(horizontal: 10, vertical: 4), Widget? leading, Widget? trailing, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, TextStyle? placeholderStyle, AlignmentGeometry? alignment, AlignmentGeometry? placeholderAlignment, EdgeInsetsGeometry? inputPadding, double? gap = 6, BoxConstraints? constraints = const BoxConstraints(minHeight: 32), Object? groupId, WidgetBuilder? keyboardToolbarBuilder, Widget? top, Widget? bottom, ValueChanged<int> ? onLineCountChange, Size? editableTextSize, bool? useBrowserContextMenu, ValueChanged<List< ? onPasteFiles, ValueChanged<ShadClipboardItem> >Object> ? onPasteFilesError, bool showValidationError = false})
Properties
- alignment → AlignmentGeometry?
-
final
- autocorrect → bool
-
final
-
autofillHints
→ Iterable<
String> ? -
final
- autofocus → bool
-
final
- autovalidateMode → AutovalidateMode
-
Used to enable/disable this form field auto validation and update its
error text.
finalinherited
- bottom → Widget?
-
final
-
builder
→ FormFieldBuilder<
String> -
Function that returns the widget representing this form field.
finalinherited
- clipBehavior → Clip
-
final
- constraints → BoxConstraints?
-
final
- contentInsertionConfiguration → ContentInsertionConfiguration?
-
final
- contextMenuBuilder → EditableTextContextMenuBuilder?
-
final
- controller → TextEditingController?
-
final
- crossAxisAlignment → CrossAxisAlignment?
-
final
- cursorColor → Color?
-
final
- cursorHeight → double?
-
final
- cursorOpacityAnimates → bool?
-
final
- cursorRadius → Radius?
-
final
- cursorWidth → double?
-
final
- decoration → ShadDecoration?
-
Optional decoration merged on top of the theme baseline (themeDecoration
or
ShadTheme.inputTheme.decoration).no setterinherited - decorationBuilder → ShadDecoration? Function(BuildContext context)?
-
A function that builds a custom ShadDecoration for the field.
Overrides the default decoration; merged with error state if provided.
finalinherited
- description → Widget?
-
The description widget displayed below the field.
Typically a Text widget, offering additional field information.
finalinherited
- descriptionText → String?
-
finalinherited
- descriptionWidget → Widget?
-
finalinherited
- dragStartBehavior → DragStartBehavior
-
final
- editableTextSize → Size?
-
final
- enabled → bool
-
Whether the form is able to receive user input.
finalinherited
- enableIMEPersonalizedLearning → bool
-
final
- enableInteractiveSelection → bool?
-
final
- enableSuggestions → bool
-
final
- error → Widget Function(String error)?
-
A function that returns a custom error widget based on the error text.
Called when validation fails; defaults to a Text widget if null.
finalinherited
- errorBuilder → FormFieldErrorBuilder?
-
Function that returns the widget representing the error to display.
finalinherited
- expands → bool
-
final
- focusNode → FocusNode?
-
The focus node for keyboard navigation and focus handling.
If null, an internal focus node is created by the state.
finalinherited
- forceErrorText → String?
-
An optional property that forces the FormFieldState into an error state
by directly setting the FormFieldState.errorText property without
running the validator function.
finalinherited
-
fromValueTransformer
→ FromValueTransformer<
String?> ? -
A function to transform a value into the field’s expected type.
Useful for converting data before populating the field; defaults to null
(no transformation).
finalinherited
- gap → double?
-
final
- groupId → Object?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
An optional identifier used to reference the field within a ShadForm.
Enables form data retrieval or field manipulation post-submission.
finalinherited
- initialValue → String?
-
An optional value to initialize the form field to, or null otherwise.
finalinherited
-
inputFormatters
→ List<
TextInputFormatter> ? -
final
- inputPadding → EdgeInsetsGeometry?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardAppearance → Brightness?
-
final
- keyboardToolbarBuilder → WidgetBuilder?
-
final
- keyboardType → TextInputType?
-
final
- label → Widget?
-
The label widget displayed above the field.
Typically a Text widget, providing context for the field’s purpose.
finalinherited
- labelText → String?
-
finalinherited
- labelWidget → Widget?
-
finalinherited
- leading → Widget?
-
final
- magnifierConfiguration → TextMagnifierConfiguration?
-
final
- mainAxisAlignment → MainAxisAlignment?
-
final
- maxLength → int?
-
final
- maxLengthEnforcement → MaxLengthEnforcement?
-
final
- maxLines → int?
-
final
- minLines → int?
-
final
- mouseCursor → MouseCursor?
-
final
- obscureText → bool
-
final
- obscuringCharacter → String
-
final
- onAppPrivateCommand → AppPrivateCommandCallback?
-
final
-
onChanged
→ ValueChanged<
String?> ? -
Callback invoked when the field’s value changes.
Provides the new value, complementing form state updates.
finalinherited
- onEditingComplete → VoidCallback?
-
final
-
onLineCountChange
→ ValueChanged<
int> ? -
final
-
onPasteFiles
→ ValueChanged<
List< ?ShadClipboardItem> > -
final
-
onPasteFilesError
→ ValueChanged<
Object> ? -
final
- onPressed → VoidCallback?
-
final
- onPressedAlwaysCalled → bool
-
final
- onPressedOutside → TapRegionCallback?
-
final
- onReset → VoidCallback?
-
Callback invoked when the field is reset to its initial value.
Allows additional reset logic; defaults to null.
finalinherited
-
onSaved
→ ValueChanged<
String?> ? -
An optional method to call with the final value when the form is saved via
FormState.save.
finalinherited
-
onSubmitted
→ ValueChanged<
String> ? -
final
- padding → EdgeInsetsGeometry?
-
final
- placeholder → Widget?
-
final
- placeholderAlignment → AlignmentGeometry?
-
final
- placeholderStyle → TextStyle?
-
final
- readOnly → bool
-
Whether the field is read-only.
Defaults to false; if true, prevents editing but allows focus.
finalinherited
- required → bool
-
If
true, an asterisk is appended to the labelText and a default required validator is applied if validator is null.finalinherited - restorationId → String?
-
Restoration ID to save and restore the state of the form field.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scribbleEnabled → bool
-
final
- scrollController → ScrollController?
-
final
- scrollPadding → EdgeInsets
-
final
- scrollPhysics → ScrollPhysics?
-
final
- selectionColor → Color?
-
final
- selectionControls → TextSelectionControls?
-
final
- selectionHeightStyle → BoxHeightStyle
-
final
- selectionWidthStyle → BoxWidthStyle
-
final
- showCursor → bool?
-
final
- showValidationError → bool
-
If
true, shows error text and decorator error styling when invalid. Iffalse,hasErrorstays true for child styling but hides both.finalinherited - smartDashesType → SmartDashesType?
-
final
- smartQuotesType → SmartQuotesType?
-
final
- spellCheckConfiguration → SpellCheckConfiguration?
-
final
- strutStyle → StrutStyle?
-
final
- style → TextStyle?
-
final
- textAlign → TextAlign
-
final
- textCapitalization → TextCapitalization
-
final
- textDirection → TextDirection?
-
final
- textInputAction → TextInputAction?
-
final
- themeDecoration → ShadDecoration? Function(BuildContext context)?
-
When non-null, used instead of
ShadTheme.inputTheme.decorationas the merge baseline (e.g. checkbox theme for NTBCheckboxFormField).finalinherited - top → Widget?
-
final
-
toValueTransformer
→ ToValueTransformer<
String?> ? -
A function to transform the field’s value before saving or processing.
Useful for formatting or converting data; defaults to null
(no transformation).
finalinherited
- trailing → Widget?
-
final
- undoController → UndoHistoryController?
-
final
- unfocusOnTapOutside → bool
-
When true (the default), tapping outside the input automatically
removes focus. Set to false to keep focus until explicitly dismissed.
final
- useBrowserContextMenu → bool?
-
final
-
validator
→ FormFieldValidator<
String> ? -
An optional method that validates an input. Returns an error string to
display if the input is invalid, or null otherwise.
finalinherited
-
valueTransformer
→ ToValueTransformer<
String?> ? -
A function to transform the field’s value before saving or processing.
Useful for formatting or converting data; defaults to null
(no transformation).
finalinherited
Methods
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → ShadFormBuilderFieldState< NTBFormField< String> , String> -
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
-
positionedWith(
ShadPosition position) → Widget -
Available on Widget, provided by the PositionedExt extension
-
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
-
withAlign(
{AlignmentGeometry alignment = Alignment.center}) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withExpanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withInkWell(
dynamic onTap()) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withOnTap(
dynamic onTap()) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withPadding(
{EdgeInsets padding = const EdgeInsets.all(16)}) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withScaleFactor(
{double? widthFactor, double? heightFactor}) → Widget -
Available on Widget, provided by the WidgetExtension extension
-
withWidthMatchParent(
{EdgeInsets padding = EdgeInsets.zero}) → Widget -
Available on Widget, provided by the WidgetExtension extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited