Created
November 9, 2021 09:54
-
-
Save abdullahmansss/3e18b91913fc3ca774fa6cbb604f1efb to your computer and use it in GitHub Desktop.
text form field with country picker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Directionality( | |
textDirection: TextDirection.ltr, | |
child: TextFormField( | |
controller: phoneController, | |
style: Theme.of(context).textTheme.subtitle1!.copyWith( | |
fontWeight: FontWeight.w500, | |
), | |
keyboardType: TextInputType.phone, | |
decoration: InputDecoration( | |
border: const OutlineInputBorder( | |
borderRadius: BorderRadius.all( | |
Radius.circular(5.0), | |
), | |
), | |
// focusedBorder: OutlineInputBorder( | |
// borderRadius: BorderRadius.circular(5.0,), | |
// borderSide: BorderSide( | |
// color: HexColor('07b055'), | |
// ), | |
// ), | |
prefixIcon: Padding( | |
padding: const EdgeInsetsDirectional.only( | |
start: 15.0, | |
), | |
child: CountryCodePicker( | |
padding: EdgeInsets.zero, | |
onChanged: print, | |
initialSelection: 'AE', | |
favorite: const ['+971', 'AE'], | |
showCountryOnly: false, | |
showOnlyCountryWhenClosed: false, | |
alignLeft: false, | |
showDropDownButton: false, | |
textStyle: Theme.of(context).textTheme.subtitle1!.copyWith( | |
fontWeight: FontWeight.w500, | |
), | |
), | |
), | |
suffixIconConstraints: BoxConstraints( | |
minHeight: pxToDp( | |
26.0, | |
), | |
minWidth: pxToDp( | |
26.0, | |
), | |
), | |
suffixIcon: Padding( | |
padding: const EdgeInsetsDirectional.only( | |
end: 15.0, | |
), | |
child: Container( | |
width: pxToDp( | |
26.0, | |
), | |
height: pxToDp( | |
26.0, | |
), | |
decoration: BoxDecoration( | |
shape: BoxShape.circle, | |
color: HexColor('07b055'), | |
), | |
padding: EdgeInsets.symmetric( | |
horizontal: pxToDp( | |
8.0, | |
), | |
), | |
child: SvgPicture.asset( | |
'assets/images/check.svg', | |
), | |
), | |
), | |
hintText: 'xxx xxx xxxx', | |
hintStyle: Theme.of(context).textTheme.subtitle1!.copyWith( | |
fontWeight: FontWeight.w500, | |
color: secondaryVariant, | |
), | |
), | |
), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment