DesignTextEntryBox class

A text entry's box: at least minHeight tall, holding child, an editable as wide as the box, with one line centred in it and hint on the typed text's baseline while controller is empty.

child is a TextField whose decoration is null, or collapsed with every field that sizes it set, in which case it draws its own hint and hint stays null. Either way a line stands where the box puts it, whatever the platform's density, the text size or the app's InputDecorationTheme. Several lines (maxLines other than 1) start where one line would stand, and the box grows with them. A press anywhere in the box reaches the editable.

The box centres the line by its line box. What the eye compares in a row is the capitals: to put them on the box's middle, beside a button's cap-centred label, wrap this box in a DesignCapCenter with the field's typeface's factor. The typed text, hint, the caret and taps then move together.

The design system still owns the border, the fill, the focus ring, the side padding, any icons, the counter, help and error, all around or beside this box, and, when the decoration is null, what a screen reader hears as the hint: hint is drawn only, so wrap the entry in Semantics(hint: ...).

DesignTextEntryBox(minHeight: 40, controller: controller, hint: const Text('Search'), child: TextField(controller: controller, decoration: null))
Inheritance

Constructors

DesignTextEntryBox({Key? key, required double minHeight, TextEditingController? controller, Widget? hint, int? maxLines = 1, required Widget child})
A box at least minHeight tall around the editable child.
const

Properties

child → Widget
The editable.
final
controller → TextEditingController?
The editable's controller, which says when hint shows. Required with a hint. Yours to dispose.
final
hashCode → int
The hash code for this object.
no setterinherited
hint → Widget?
Shown while the text is empty, on the typed text's baseline, at most as wide as the editable. It adds nothing to the box's height, so the box does not move as typing starts. Give it one line.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxLines → int?
The editable's own maxLines: 1 centres the line, anything else (null for no limit) starts the first line where a single line would stand.
final
minHeight → double
The least height of the box, in logical pixels.
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.
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