KeyValueFieldWidget class
keyvalue. One row per pair, each a key cell and a value cell side by
side.
Row identity is independent of the key string (fix round 1, Finding
2). The wire value is a Map<String, String>, which cannot itself hold
two rows sharing a key — but a user typing a new key routes through every
intermediate value on the way to a final one, and two rows sharing a key
(or the blank key a second Add produces) is a completely ordinary,
recoverable mid-edit state, not data loss. So _pairs is State, seeded
once from FieldState.value and mutated in place by _commit — not
re-derived from the map on every build, the way the old Stateless version
did. _isOwnEcho is what makes this safe: after a commit, FieldState
round-trips the same (possibly collapsed) map back down through
didUpdateWidget, and that echo must not stomp _pairs back to the
collapsed shape — only a genuinely external change (a fresh record
loaded, a /state refresh) does. Without this a second tap of Add did
nothing (the second blank key collided with the first on the very next
build) and renaming one row's key to another's silently deleted a row
while the user was still typing.
Absent, not disabled (design spec, and fix round 1 Finding 1): the Add
control renders only when KeyValueComponent.addable, a row's Remove
control only when KeyValueComponent.deletable, and — now — a row's key
or value cell renders as plain, unfocusable Text rather than a
_TextControl when KeyValueComponent.editableKeys /
KeyValueComponent.editableValues is false. The value itself is never
absent (the row still has to show what it holds, which is why vendor's
own view disables rather than removes its <input>) — it is the INPUT
AFFORDANCE that goes away, the same distinction Add and Remove already
draw.
reorderable is deliberately not read at all — it is not on the wire
(design spec): the repeater publishes it and this widget has never
offered one.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- KeyValueFieldWidget
Constructors
- KeyValueFieldWidget({required KeyValueComponent component, required FieldState state, Key? key})
-
const
Properties
- component → KeyValueComponent
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → FieldState
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< KeyValueFieldWidget> -
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.
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