Skip to content

Oh-Kang94/flutter_country_selector

 
 

Repository files navigation

Flutter Country Selector

Country selector of the phone_form_field package exported in its own package.

Features

  • localization: lots of supported languages
  • semantics applied

Demo

Demo available here: https://cedvdb.github.io/flutter_country_selector/

Usage

Use CountrySelector.page if you need to show the selector inside a widget that is full screen. If you need to show the selector inside a modal of some sort, use CountrySelector.sheet instead.

Navigator.of(context).push(
  MaterialPageRoute(
    builder: (ctx) => CountrySelector.page(
      onCountrySelected: (country) => Navigator.of(context).pop(country),
    ),
  ),
)

Localization

Dynamic localization

Use CountrySelectorLocalization.of(context)?.countryName(isoCode) when you need to dynamically localize the name of a country.

Supported languages

  • ar
  • de
  • el
  • en
  • es
  • fa
  • fr
  • hi
  • hu
  • it
  • ku
  • nb
  • nl
  • pt
  • ru
  • sv
  • tr
  • uk
  • uz
  • zh

Setup

Example setup:

const MaterialApp(
  locale: Locale('en'),
  supportedLocales: [
    Locale('en'),
  ],
  localizationsDelegates: [
    GlobalMaterialLocalizations.delegate,
    CountrySelectorLocalization.delegate,
  ],
  // ...
)

Overwriting or adding custom flags

Some users have expressed their need to change some flags due to political reasons, or stylistic reasons. You might also wish to add your own flags. To do so refer to this issue: cedvdb/phone_form_field#222

About

A country selector for flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 88.6%
  • C++ 5.6%
  • CMake 4.7%
  • HTML 0.4%
  • Swift 0.4%
  • C 0.3%