When using numeric keyboard it decides whether to separate the decimals with dot or comma based on the region settings of the phone. For some reason Apple has decided that in the Netherlands it is a comma, yet everybody separates decimals with a dot here.
Changing the region of the phone works, yet not a viable solution.
Is there a way to change ios region globally/fixed?
Ok, finally found a solution. You can't replace the comma or dot, yet you can use TextFormatter. Example:
class CommaTextInputFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) {
String truncated = newValue.text;
TextSelection newSelection = newValue.selection;
if (newValue.text.contains(",")) {
truncated = newValue.text.replaceFirst(RegExp(','), '.');
}
return TextEditingValue(
text: truncated,
selection: newSelection,
);
} }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With