tbib_phone_form_field 1.0.1 copy "tbib_phone_form_field: ^1.0.1" to clipboard
tbib_phone_form_field: ^1.0.1 copied to clipboard

discontinuedreplaced by: phone_form_field

This library work with phone_form_field and localization with new attribute.

About #

this library with phone form field but add some future like add icon dropdown after country code.

Demo #

Demo available at https://cedvdb.github.io/phone_form_field/

Usage #

Example #

    PhoneFormField(
          // new attribute
          // v.03
          forceShowFlagDropDown: true, // Default
          // v0.1
          showDropDownIcon: true, // Default : false
          dropDownIcon: Icons.arrow_drop_down, // Default
          dropDownIconSize: 16, // Default

         key: inputKey,
         // controller: controller,
         shouldFormat: shouldFormat,
         autofocus: true,
         initialValue: PhoneNumber.fromRaw('+336787678'),
         autofillHints: const [AutofillHints.telephoneNumber],
         countrySelectorNavigator: selectorNavigator,
         defaultCountry: IsoCode.US,
         decoration: InputDecoration(
           label: withLabel ? const Text('Phone') : null,
           border: outlineBorder
               ? const OutlineInputBorder()
               : const UnderlineInputBorder(),
           hintText: withLabel ? '' : 'Phone',
         ),
         enabled: true,
         showFlagInInput: true,
         validator: _getValidator(),
         autovalidateMode: AutovalidateMode.onUserInteraction,
         cursorColor: Theme.of(context).colorScheme.primary,
         // ignore: avoid_print
         onSaved: (p) => print('saved $p'),
         // ignore: avoid_print
         onChanged: (p) => print('changed $p'),
       ),
  • please us it in pubspec to use translation phone form field
 flutter_localizations: #Add this line
    sdk: flutter

Validation #

  • You can validation in any functions
bool alertPhoneValid=false;
String phone='';
void setAlertPhoneEvent(PhoneNumber? phone) {
    alertPhoneValid = PhoneNumber(
            isoCode: phone?.isoCode ?? IsoCode.EG, nsn: phone?.nsn ?? '0')
        .validate();
    String countryCode = phone?.countryCode ?? '0';
    String phoneNum = phone?.nsn ?? '0';
    phone = "$countryCode $phoneNum";
  }

4
likes
50
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

This library work with phone_form_field and localization with new attribute.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

circle_flags, dart_countries, diacritic, flutter, flutter_localizations, intl, phone_numbers_parser

More

Packages that depend on tbib_phone_form_field