phoneTextField method
Widget
phoneTextField(
- BuildContext context,
- String? label,
- TextEditingController? controller,
- FocusNode focusNode,
- String initialPhonePrefix,
- dynamic onPrefixChange(), {
- bool isEnabled = true,
- Widget? trailing,
- dynamic onChange()?,
- Color? bgColor,
Implementation
Widget phoneTextField(
BuildContext context,
String? label,
TextEditingController? controller,
FocusNode focusNode,
String initialPhonePrefix,
Function(String) onPrefixChange,
{bool isEnabled = true,
Widget? trailing,
Function(String)? onChange,
Color? bgColor}) {
return CustomTextField(label, controller, focusNode,
enabled: isEnabled,
suffixIcon: trailing ?? const SizedBox.shrink(),
prefixIcon: CountryPicker(
initialSelection: initialPhonePrefix,
favorite: const ['+376', '+34', '+33', '+351'],
onChanged: (country) {
onPrefixChange(country!.countryCode ?? '');
},
),
showPrefixSeparator: true,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(12),
],
keyboardType: TextInputType.phone,
onChange: onChange,
bgColor: bgColor,);
}