gtgalone / currency_text_input_formatter

Currency Text Input Formatter for Flutter.
https://pub.dev/packages/currency_text_input_formatter
MIT License
50 stars 29 forks source link

Issue on format with CurrencyTextInputFormatter #49

Closed atsen-dev closed 11 months ago

atsen-dev commented 1 year ago

Hi,

I just want to share an issue than annoy me with CurrencyTextInputFormatter is that if I want to format that value : 20.0 , It will format as 2.00 for example.

In my case I want to init an input with 131.0 (double value) as value and that is my output using formatter : image

Did you know that issue ?

atsen-dev commented 1 year ago

The issue come from this part of the plugin (line 95) : image

EDIT :

As you can see input is 131 but after line 95, _newNum is 1.31

The only workaround I found is to format every value with thr right precision like this : image

I thinks It would be great If we can improve that to be able to set a double value without the need of the workaround

pedrolemoz commented 1 year ago

I had the same issue as you. Instead of using .format method, use .formatDouble.