Commit 3800118a authored by Lex Berezhny's avatar Lex Berezhny Committed by Adam Barth

fix for #5549 (#5949)

parent e1a5bfb3
...@@ -112,9 +112,9 @@ class _InputState extends State<Input> { ...@@ -112,9 +112,9 @@ class _InputState extends State<Input> {
bool focused = focusContext != null && Focus.at(focusContext, autofocus: config.autofocus); bool focused = focusContext != null && Focus.at(focusContext, autofocus: config.autofocus);
if (_formData == null) if (_formData == null)
_formData = _FormFieldData.maybeCreate(context, this); _formData = _FormFieldData.maybeCreate(context, this);
InputValue value = config.value ?? _formData?.value ?? InputValue.empty; InputValue value = _formData?.value ?? config.value ?? InputValue.empty;
ValueChanged<InputValue> onChanged = config.onChanged ?? _formData?.onChanged; ValueChanged<InputValue> onChanged = _formData?.onChanged ?? config.onChanged;
ValueChanged<InputValue> onSubmitted = config.onSubmitted ?? _formData?.onSubmitted; ValueChanged<InputValue> onSubmitted = _formData?.onSubmitted ?? config.onSubmitted;
String errorText = config.errorText; String errorText = config.errorText;
if (errorText == null && config.formField != null && config.formField.validator != null) if (errorText == null && config.formField != null && config.formField.validator != null)
...@@ -260,9 +260,10 @@ class _InputState extends State<Input> { ...@@ -260,9 +260,10 @@ class _InputState extends State<Input> {
class _FormFieldData { class _FormFieldData {
_FormFieldData(this.inputState) { _FormFieldData(this.inputState) {
assert(field != null); assert(field != null);
value = inputState.config.value ?? new InputValue();
} }
InputValue value = new InputValue(); InputValue value;
final _InputState inputState; final _InputState inputState;
FormField<String> get field => inputState.config.formField; FormField<String> get field => inputState.config.formField;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment