I want to create a TextField in Flutter. The TextField is for decimal numbers. So i set keyboardType: TextInputType.numberWithOptions(decimal: true)
. Now I get a number keyboard on iOS, but this number keyboard has a period (.) instead of a comma (,). The language of the iOS device is German.
My current TextField:
TextField(
key: Key("pricePerLiter"),
style: TextStyle(color: inputTextColor),
textAlign: TextAlign.end,
focusNode: pricePerLiterFocusNode,
keyboardType:
TextInputType.numberWithOptions(decimal: true),
decoration: inputDecoration.copyWith(
suffixText: "€", errorText: pricePerLiterError),
controller: pricePerLiterTextController,
onEditingComplete: () {},
onChanged: (value) {},
)
My Localization is set up like following in my Material app:
MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('de', 'DE'),
],
home: MyHomePage(),
)
What do I need to change to get a number keyboard with a comma (,) instead of a period (.)?
keyboardType
so obviously you will get period to be able to type decimal number. Don't give the type if you don't want that to happen. - Keerti Purswani