diff --git a/lib/widgets/amount_input/amount_input.dart b/lib/widgets/amount_input/amount_input.dart index a516b42ad..6ed1ef5f3 100644 --- a/lib/widgets/amount_input/amount_input.dart +++ b/lib/widgets/amount_input/amount_input.dart @@ -34,6 +34,7 @@ class AmountInput extends StatefulWidget { } class _AmountInputState extends State { + final _formFieldKey = GlobalKey>(); CurrencyTextInputFormatter? formatter; CurrencyTextInputValidator? validator; @@ -99,7 +100,11 @@ class _AmountInputState extends State { title: LocaleKeys.maxWord.tr(), buttonShape: ButtonShape.rectangle, buttonSize: ButtonSize.small, - onPressed: widget.onMaxAmount, + onPressed: () { + widget.onMaxAmount(); + _formFieldKey.currentState + ?.didChange(widget.controller.text); + }, ), ], ), @@ -114,6 +119,7 @@ class _AmountInputState extends State { behavior: HitTestBehavior.translucent, onTap: widget.focusNode?.requestFocus, child: FormField( + key: _formFieldKey, initialValue: widget.controller.text, autovalidateMode: AutovalidateMode.onUserInteraction, validator: validator?.validate,