LedgerTextField class
A field written on a rule, as a ledger is: its label in the small capitals over the line, the words typed in the medium at 16 (its hint in the third ink while it is empty), the ink rule under it (2 thick while it has focus), its helper or its error under the rule. No box: the rule is the field. 48 tall at LedgerDensity.standard, each density step 4 less, the words centred in it on every platform.
prefix stands before the words in the serif (a currency sign) and makes
the field a sum's: its words are typed in the serif at 22 too, as Ledger
sets money (sumOf), sign and figures left to right in either direction,
and from 600 it stands at a short entry's measure
(LedgerLayout.fieldMeasure); trailing after them (a clear or a reveal
button). enabled false holds it in the third ink on the light rule.
Validate in a DesignForm with a DesignFormField around it and pass its
error here.
The controller and focusNode are the caller's to dispose when given; when not, the field makes its own and disposes them.
LedgerTextField(label: 'Name', hint: 'As it is on the account', controller: name)
LedgerTextField(label: 'Amount', prefix: r'$', hint: '0.00', keyboardType: const TextInputType.numberWithOptions(decimal: true))
LedgerTextField(label: 'Email', error: 'Enter an email address', onChanged: (v) {})
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- LedgerTextField
Constructors
-
LedgerTextField({TextEditingController? controller, FocusNode? focusNode, String? label, String? hint, String? helper, String? error, String? prefix, Widget? trailing, bool isRequired = false, bool enabled = true, bool readOnly = false, bool obscureText = false, bool autofocus = false, TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, List<
TextInputFormatter> ? inputFormatters, Iterable<String> ? autofillHints, int? maxLines = 1, int? minLines, ValueChanged<String> ? onChanged, ValueChanged<String> ? onSubmitted, VoidCallback? onEditingComplete, LedgerStyle? style, Key? key}) -
A field named
labelon its rule.const
Properties
-
autofillHints
→ Iterable<
String> ? -
What the platform's autofill may fill in.
final
- autofocus → bool
-
Whether it takes focus when it first appears.
final
- controller → TextEditingController?
-
The words; the field's own when null.
final
- enabled → bool
-
Whether it takes input.
final
- error → String?
-
What is wrong, under the rule in the danger red; null while it is
fine.
final
- focusNode → FocusNode?
-
Its focus; the field's own when null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helper → String?
-
Help under the rule.
final
- hint → String?
-
Shown while it is empty, in the third ink.
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
Formatters run over the words as they are typed.
final
- isRequired → bool
-
Whether it must be filled: its label carries a mark, and a screen
reader says so.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType?
-
The keyboard the field asks for.
final
- label → String?
-
What the field is, over the line in the small capitals; its spoken
name.
final
- maxLines → int?
-
How many lines it grows to; 1 keeps it to one, null lets it grow.
final
- minLines → int?
-
How many lines it stands at the least.
final
- obscureText → bool
-
Whether the words are hidden (a password).
final
-
onChanged
→ ValueChanged<
String> ? -
Called with the words as they are typed.
final
- onEditingComplete → VoidCallback?
-
Called when the keyboard's act key is pressed, in place of the field
giving up the focus; see onSubmitted.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Called with the words when the keyboard submits them; the field gives
up the focus. A field that keeps the focus after the act key (one
adding another) takes it in onEditingComplete instead, never both:
told of a submit while it keeps the focus, a field restarts its text
input, and a browser's then takes no typing.
final
- prefix → String?
-
Before the words, in the serif: a currency sign, a unit. A field with
one is a sum's, its words typed in the serif (sumOf).
final
- readOnly → bool
-
Whether its words can be selected but not changed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → LedgerStyle?
-
The field's look, over
components.textField. It readsedge(the rule's ink),fill(a paper behind the written line),padding(round the line),foreground(the words' ink) andtextStyle(the words'); a field isfocused,errorordisabledas it stands.final - textCapitalization → TextCapitalization
-
How the keyboard capitalizes the words.
final
- textInputAction → TextInputAction?
-
The keyboard's act key.
final
- trailing → Widget?
-
After the words: a small button (a clear, a reveal).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< LedgerTextField> -
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
Static Methods
-
heightOf(
LedgerThemeData t) → double -
The line's height at
t's density: 48 at standard. -
sumOf(
LedgerThemeData t) → TextStyle - A sum's words, and its prefix's: the serif at 22 on the same 24 line.
-
wordsOf(
LedgerThemeData t) → TextStyle - The words' style: the medium at 16 on a 24 line.