fix cakepay number textfield (#3221)

Serhii committed May 8, 2026 at 22:37 UTC 2c245040c0b57f4c45d5b08fefc3bd5b18ce0d64
1 file changed +17 -2
lib/src/widgets/number_text_fild_widget.dart
+17 -2
@@ -133,8 +133,23 @@ class _NumberTextInputFormatter extends TextInputFormatter {
133 if (const ['-', ''].contains(newValue.text)) return newValue;
134 final intValue = int.tryParse(newValue.text);
135 if (intValue == null) return oldValue;
136 - if (intValue < min) return newValue.copyWith(text: min.toString());
137 - if (intValue > max) return newValue.copyWith(text: max.toString());
136 +
137 + if (intValue < min) {
138 + final text = min.toString();
139 + return TextEditingValue(
140 + text: text,
141 + selection: TextSelection.collapsed(offset: text.length),
142 + );
143 + }
144 +
145 + if (intValue > max) {
146 + final text = max.toString();
147 + return TextEditingValue(
148 + text: text,
149 + selection: TextSelection.collapsed(offset: text.length),
150 + );
151 + }
152 +
153 return newValue.copyWith(text: intValue.toString());
154 }
155 }