GlassFormField class
A standard form field wrapper for glass inputs following iOS design patterns.
GlassFormField wraps input widgets (like GlassTextField, GlassPicker, etc.) with a standard label, error text, and helper text layout. It ensures consistent spacing and typography across all form inputs in an application.
Key Features
- Consistent Typography: Uses standard iOS-style weights and colors for labels
- Validation Support: Displays error text in red when provided
- Helper Text: Optional secondary text for hints or instructions
- Flexible Layout: Works with any child widget
Usage
Basic Usage
GlassFormField(
label: 'Email Address',
child: GlassTextField(
placeholder: 'name@example.com',
),
)
With Validation Error
GlassFormField(
label: 'Password',
errorText: isPasswordValid ? null : 'Password must be at least 8 chars',
child: GlassPasswordField(),
)
With Helper Text
GlassFormField(
label: 'Username',
helperText: 'This will be visible to other users',
child: GlassTextField(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassFormField
Constructors
- GlassFormField({required Widget child, Key? key, String? label, String? helperText, String? errorText, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start})
-
Creates a form field wrapper.
const
Properties
- child → Widget
-
The input widget (e.g., GlassTextField).
final
- crossAxisAlignment → CrossAxisAlignment
-
Cross alignment of the column.
final
- errorText → String?
-
Error text displayed below the input (replaces helperText).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
Helper text displayed below the input.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Label displayed above the input.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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