Reputation: 495
I am creating an app which has a login page. In that login page there is a textformfield which accepts only numbers that is if i click on the textformfield it shows only English numbers. But the problem is if the mobile device is in arabic language and click on textformfield it doesn't show English numbers instead it shows arabic numbers in the keyboard. So how to force or show the English numbers in the keyboard even if the mobile phone is in arabic language.
TextFormField(
keyboardType: TextInputType.phone,
style: new TextStyle(color: Colors.black),
validator: (val) => val.length == 0 ? mobile : null,
controller: mobileNumber,
decoration: new InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
hintText: mobile,
fillColor: Colors.grey[200],
filled: true,
),
),
Upvotes: 0
Views: 3204
Reputation: 495
I found the answer i use this code inside textfieldform widget. This will help to show English Numerical Numbers even if the mobile device language is different not in English.
inputFormatters: [new WhitelistingTextInputFormatter(RegExp("[0-9]"))],
Upvotes: 2