getKeyboardType function
Returns TextInputType for the given FormFieldType.
Implementation
String getKeyboardType(String type) {
var fieldType = FieldPropertyType.string;
try {
fieldType = FieldPropertyType.values.firstWhere((e) => e.toString().split('.').last == type.toLowerCase());
} catch (e) {
print('FieldPropertyType not found: $type');
}
switch (fieldType) {
case FieldPropertyType.currency:
case FieldPropertyType.doubleNumber:
case FieldPropertyType.intNumber:
return 'TextInputType.number';
case FieldPropertyType.date:
return 'TextInputType.datetime';
case FieldPropertyType.email:
return 'TextInputType.emailAddress';
case FieldPropertyType.name:
return 'TextInputType.name';
case FieldPropertyType.phone:
return 'TextInputType.phone';
case FieldPropertyType.streetAddress:
return 'TextInputType.streetAddress';
case FieldPropertyType.url:
return 'TextInputType.url';
case FieldPropertyType.multiLine:
return 'TextInputType.multiline';
default:
return 'TextInputType.text';
}
}