diff --git a/lib/ui/widgets/first_screen/g1_textfield.dart b/lib/ui/widgets/first_screen/g1_textfield.dart index 357ddf6b2a37b45041dacb2c4292d7893de0326c..05c0afc25228d0bcaebb1f5d1506beb28b0f83da 100644 --- a/lib/ui/widgets/first_screen/g1_textfield.dart +++ b/lib/ui/widgets/first_screen/g1_textfield.dart @@ -42,12 +42,17 @@ class _G1PayAmountFieldState extends State<G1PayAmountField> { newValue != null && newValue.isNotEmpty && validate) { - context.read<PaymentCubit>().selectAmount(parseToDoubleLocalized( - locale: context.locale.toLanguageTag(), number: newValue)); + final double newAmount = parseToDoubleLocalized( + locale: context.locale.toLanguageTag(), number: newValue); + if (newAmount != context.read<PaymentCubit>().state.amount) { + context.read<PaymentCubit>().selectAmount(newAmount); + } } else { - context - .read<PaymentCubit>() - .selectAmount(newValue == null ? null : double.tryParse(newValue)); + final double? newAmount = + newValue == null ? null : double.tryParse(newValue); + if (newAmount != context.read<PaymentCubit>().state.amount) { + context.read<PaymentCubit>().selectAmount(newAmount); + } } } @@ -76,9 +81,7 @@ class _G1PayAmountFieldState extends State<G1PayAmountField> { key: _formKey, child: TextFormField( keyboardType: const TextInputType.numberWithOptions(decimal: true), - initialValue: state.amount == null - ? '' - : localizeNumber(context, state.amount!), + controller: _controller, validator: validateDecimalAndFixInitialSep, autofillHints: const <String>[], onEditingComplete: () {},