Money TextField input format.

You need 2 custom functions:
1. money format function for formatting the input

String? moneyFormat(double number) {
  /// MODIFY CODE ONLY BELOW THIS LINE

  final format = NumberFormat("###,###.##");
  return format.format(number);

  /// MODIFY CODE ONLY ABOVE THIS LINE
}
  1. the last function is optional but you need it if you want to use the input to calculate

double? clearnMoneyFormat(String input) {
  /// MODIFY CODE ONLY BELOW THIS LINE

  String cleanedString = input.replaceAll(RegExp(r'[^\d.]+'), '');
  return double.parse(cleanedString);

  /// MODIFY CODE ONLY ABOVE THIS LINE
}

in this example, I create a simple text field and text to show the output of the text field.

on text field turn on Update Page On Text Change and set the delay to 500 ms

in the OnChange action of the text field select SetForm field action and select the text field.

Set the text field value equal to the money format function and the function's input is the text field value.

and that is it. Here is the example: https://app.flutterflow.io/project/textfield-example-b1dxcx


hope this helps :)

1