Closed khsater closed 3 years ago
@khsater Thank you for using.
This is just for formatter.
You can initialize value like below.
https://stackoverflow.com/questions/43214271/how-do-i-supply-an-initial-value-to-a-text-field
@gtgalone , please consider:
double myCurrencyValue;
TextFormField(
initialValue: myCurrencyValue.toString(),
onSaved: (value) {
myCurrencyValue = double.parse(value);
},
inputFormatters: [
CurrencyTextInputFormatter(
decimalDigits: 2,
symbol: "\$",
)],
...
),
In this case, the initial value is not formatted by the formatter. It would be helpful to have access to a static method for this situation when a value must be saved as a double not a formatted string.
@khsater That is good idea!
Would you like to make a pull request?
Or I will do it?
is this implemented now? it would be very helpful to have it initially formatted
@FilipKvestak Not yet.
Feel free to contribute.
If nobody do this, I will do it.
@khsater @FilipKvestak
Thank you guys!
I have just published for this with 2.1.0
Please use new release :)
It is useful to have a static method for use in pre-filled forms and data tables. Can you please add a static method to format strings for initial values?