ConfirmFormField class

A boolean yes/no confirmation prompt field.

Toggles its boolean state when the Left/Right arrow keys or Space bar are pressed.

Example

ConfirmFormField(
  label: 'Agree to terms',
  initialValue: false,
)
Inheritance

Constructors

ConfirmFormField({required String label, String description = '', bool? initialValue = false, String? validator(bool?)?, bool focused = false})
Creates a ConfirmFormField for boolean yes/no choice.

Properties

description → String
Optional secondary description text for helper information.
finalinherited
errorText ↔ String?
The validation error text if validation fails; otherwise, null.
getter/setter pairinherited
focused ↔ bool
Whether this field currently has input focus.
getter/setter pairinherited
hasError → bool
Returns whether this field currently contains a validation error.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
initialValue → bool?
The initial value of the field when created or reset.
finalinherited
key → Key?
The optional key for this widget.
finalinherited
label → String
The title label displayed for this field.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
touched ↔ bool
Whether this field has been focused at least once.
getter/setter pairinherited
validator → String? Function(bool?)?
A validation function called by FormState.validate. Returns an error message string if invalid, or null if valid.
finalinherited
value ↔ bool?
The current value of the form field.
getter/setter pairinherited

Methods

createElement() → Element
Creates an Element to manage this widget's location in the tree.
inherited
createState() → State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
getIntrinsicHeight(int width) → int
Computes the intrinsic height of this widget under the given width constraint.
inherited
getIntrinsicWidth(int height) → int
Computes the intrinsic width of this widget under the given height constraint.
inherited
getPreferredHeight() → int
Calculates preferred layout height needed to render this field cleanly.
override
handleKeyEvent(KeyEvent event) → bool
Handles user key inputs to update the internal value.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
validate() → bool
Runs the validator callback against the current field value. Updates errorText and returns whether the field is valid.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited