keyed_form_flutter 0.1.0
keyed_form_flutter: ^0.1.0 copied to clipboard
Flutter bindings for keyed_form: a scope, field and list widgets with selective rebuilds, caret-safe text editing, and scroll-to-first-error anchors.
0.1.0 #
Initial release.
KeyedForm— theFormof this family. Publishes aKeyedFormControllerdown the widget tree and owns aKeyedFieldRegistryinternally (apps never construct one);KeyedForm.controllerOf/registryOf/translateErrorOfread it back from a descendant context (thecontexta builder callback hands you — same rule asForm.of(context)).KeyedFormField(andKeyedFormField.text) — binds one field reference and rebuilds only when that field's value, visible error, orisValidatingchanges.KeyedFieldState.isValidatingmirrorsKeyedFormController.isValidating— render a spinner from it while a field's own async validation (form.field(ref).validateAsync) is running.KeyedFieldState.isFailedValidationmirrorsKeyedFormController.isFailedValidation— render a retry affordance from it when a field's async check itself failed (it threw, or exceeded its timeout), as distinct fromerrorText.KeyedFieldState.isReadOnlymirrorsKeyedFormController.isReadOnly— passenabled: !state.isReadOnlyto the wrapped Material widget to grey it out.onChangedstays safe to wire unconditionally: the controller already no-ops a write to a frozen field.KeyedFieldList— binds one list field and rebuilds only when the row set changes.context.watchField(ref)/context.watchForm<Root>()/context.selectForm((f) => slice)— read a form slice inbuild(), get the value back, rebuild this element only when that changes: a selective read built on the sameInheritedElementmachinery as Flutter's scoped-rebuild widgets.KeyedFormSelector<Root, T>— scopes acontext.selectFormrebuild to a subtree; has a non-rebuiltchild.KeyedFormBuilder<Root>— the whole-form escape hatch (rebuilds on every controller change).KeyedTextBinding— a caret- and IME-stableTextEditingControllerbinding.KeyedFieldRegistry/KeyedFieldAnchor— scroll-to-first-error.form.handleSubmit(context, onValid, {onInvalid})— wrapsKeyedFormController.submitwith a defaultonInvalidthat reveals the first visible error via the ambientKeyedFieldRegistry; passonInvalidto override for custom invalid-handling (e.g. scrolling a lazily-built section list first).