paperTextInput
PaperTextInput
paperTextInput(
Create a Paper TextInput with full type safety.
final input = paperTextInput(
props: (label: 'Email', placeholder: 'Enter email',
mode: 'outlined', disabled: null, editable: null,
secureTextEntry: null, value: null,
activeOutlineColor: '#6200EE',
activeUnderlineColor: null, textColor: null, style: null),
onChangeText: (text) => setState(text),
);
Implementation
PaperTextInput paperTextInput({
PaperTextInputProps? props,
void Function(String)? onChangeText,
String? value,
}) {
final p = <String, dynamic>{};
if (props != null) {
if (props.label != null) p['label'] = props.label;
if (props.placeholder != null) p['placeholder'] = props.placeholder;
if (props.mode != null) p['mode'] = props.mode;
if (props.disabled != null) p['disabled'] = props.disabled;
if (props.editable != null) p['editable'] = props.editable;
if (props.secureTextEntry != null) {
p['secureTextEntry'] = props.secureTextEntry;
}
if (props.value != null) p['value'] = props.value;
if (props.activeOutlineColor != null) {
p['activeOutlineColor'] = props.activeOutlineColor;
}
if (props.activeUnderlineColor != null) {
p['activeUnderlineColor'] = props.activeUnderlineColor;
}
if (props.textColor != null) p['textColor'] = props.textColor;
if (props.style != null) p['style'] = props.style;
}
if (onChangeText != null) p['onChangeText'] = onChangeText;
if (value != null) p['value'] = value;
return PaperTextInput._create(
npmComponent(
'react-native-paper',
'TextInput',
props: p.isEmpty ? null : p,
),
);
}