Giter Site home page Giter Site logo

jeffosmith / phone_form_field Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cedvdb/phone_form_field

0.0 0.0 0.0 4.84 MB

Flutter phone number input

License: MIT License

Kotlin 0.61% Swift 1.99% Objective-C 0.19% Dart 89.24% HTML 7.49% Shell 0.48%

phone_form_field's Introduction

phone_form_field

Flutter phone input integrated with flutter internationalization

Features

  • Totally cross platform, this is a dart only package / dependencies
  • Internationalization support, without bloated json with all translations.
  • Phone number validation
  • Extends Flutter's FormField
  • Uses dart phone_number_parser for parsing

Demo

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

demo img

Usage

PhoneFormField(
  initialValue: phoneNumber,
  autofocus: true,
  decoration: InputDecoration(
    labelText: 'Phone',
    border: OutlineInputBorder(),
    // ...
  ),
  onChanged: (p) => setState(() => phoneNumber = p!),
  onSaved: (p) => setState(() => phoneNumber = p),
),

Internationalization

Include the delegate

  return MaterialApp(
    localizationsDelegates: [
      ...GlobalMaterialLocalizations.delegates,
      PhoneFieldLocalization.delegate
    ],
    supportedLocales: [
      const Locale('en', ''),
      const Locale('es', ''),
      const Locale('fr', ''),
      const Locale('ru', ''),
      // ...
    ],

Tnat's it.

A bunch of languages are built-in:

- 'ar',
- 'de',
- 'en',
- 'es',
- 'fr',
- 'hin',
- 'it',
- 'nl',
- 'pt',
- 'ru',
- 'zh',

If one of the language you target is not supported you can submit a pull request with the translated file in assets/translation

phone_form_field's People

Contributors

cedvdb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.