There seems to be a bug in Flutter that keyboardType: TextInputType.number is currently disabled when autofillHints: [AutofillHints.creditCardNumber] is specified.
The keyboard is not fixed to NumberPad and can be switched.
If you remove keyboardType: TextInputType.number, keyboardType: TextInputType.number is enabled and the keyboard is now number-only as expected.
The autofillHints: [AutofillHints.creditCardNumber] seems to have been added when the TextFormField was added to PostalCode.
If you have any other workarounds, please let me know, but currently removing AutofillHints.creditCardNumber seems to be the easiest solution.
The issue was confirmed on Flutter 2.0.6, iOS14.5 | 15 Beta.
There seems to be a bug in Flutter that
keyboardType: TextInputType.number
is currently disabled whenautofillHints: [AutofillHints.creditCardNumber]
is specified. The keyboard is not fixed to NumberPad and can be switched.If you remove
keyboardType: TextInputType.number
,keyboardType: TextInputType.number
is enabled and the keyboard is now number-only as expected.The
autofillHints: [AutofillHints.creditCardNumber]
seems to have been added when the TextFormField was added to PostalCode.If you have any other workarounds, please let me know, but currently removing
AutofillHints.creditCardNumber
seems to be the easiest solution.The issue was confirmed on Flutter 2.0.6, iOS14.5 | 15 Beta.
Related Issues
TextField 'keyboardType: TextInputType.number' doesn't bring the number keyboard https://github.com/flutter/flutter/issues/58510
Screenshot
Before
After