bhrott / flutter-masked-text

A masked text for Flutter.
https://pub.dartlang.org/packages/flutter_masked_text
MIT License
276 stars 124 forks source link

This does not work with TextFormField #50

Closed chitgoks closed 4 years ago

chitgoks commented 4 years ago

text_form_field.dart': Failed assertion: line 123 pos 15: 'initialValue == null || controller == null': is not true.

final MoneyMaskedTextController moneyMask = MoneyMaskedTextController();
TextFormField(
                        controller: moneyMask,
                        decoration: InputDecoration(labelText: 'Currency'),
                        initialValue: 0,
                        keyboardType: TextInputType.numberWithOptions(decimal: true),
                        onChanged: (value) {
                          value = moneyMask.text;
                          print(value);
                        },
                        onSaved: (value) {
                          moneyMask.updateValue(double.parse(value));
                        },
                      ),
KelseyJr commented 4 years ago

Hey, did you solve this problem? I'm facing this problem right now.

chitgoks commented 4 years ago

yes. you do not use both controller and initialValue at the same time

KelseyJr commented 4 years ago

Many thanks @chitgoks