DesignField class

A control with its label, help and error.

By default (mergeSemantics null) the field reads what its child brings to the semantics tree. A child that holds one control (a text field, a select, a switch, a slider) is one node, which takes the label as its name and the error and help as its hint. A child that holds several (a stepper's buttons and entry, segmented buttons, a wrap of chips, radios) keeps each control's own node, so a tap through the semantics tree (a screen reader's, or a click on the web with semantics on) reaches the control under it; the label names them as a group. When the child already says the label (a stepper named as its field, or a group that names itself on its own node), the label is not added again, so it is read once.

DesignField(labelText: 'Email', builder: (context, parts) => Column(children: [?parts.label, parts.control]), child: const Text('field'))
Inheritance

Constructors

DesignField({Key? key, required DesignFieldBuilder builder, required Widget child, String? labelText, String? helperText, String? errorText, bool required = false, bool enabled = true, FocusNode? focusNode, bool? mergeSemantics, String? requiredHint})
A field around child.
const

Properties

builder → DesignFieldBuilder
Lays out the parts.
final
child → Widget
The control.
final
enabled → bool
Whether the control takes input.
final
errorText → String?
What is wrong, or null.
final
focusNode → FocusNode?
The control's focus: a tap on the label requests it. The caller's, who disposes it; the field only requests it.
final
hashCode → int
The hash code for this object.
no setterinherited
helperText → String?
Help under it.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelText → String?
What the field is: its label's words, and its control's name.
final
mergeSemantics → bool?
Whether the label, hint and validity join the control's own node: true always (one node for the whole child), false never (the label names the child as a group and each control keeps its node), null as the child's controls say (see DesignField).
final
required → bool
Whether it must be filled.
final
requiredHint → String?
Added to the name of a required field; null: DesignLocalizations.requiredHint.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignField>
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.
override
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