local_country_picker 1.1.0 copy "local_country_picker: ^1.1.0" to clipboard
local_country_picker: ^1.1.0 copied to clipboard

A self-contained Flutter country picker. 205 countries, bundled flag PNGs (round + rect), EN/NL translations, theme-aware styling. No network calls.

local_country_picker #

A self-contained country picker for Flutter. 205 countries, flag images bundled in two shapes (rounded and rectangular), translations for English and Dutch, theme-aware colors that fall back to your ThemeData. No network calls — everything is local.

Country list Search filter
Country list Search filter

Install #

dependencies:
  local_country_picker: ^0.1.0

Usage #

import 'package:local_country_picker/local_country_picker.dart';

final result = await showCountryPicker(
  context,
  selected: const Country(alpha2: 'NL'),
  shape: CountryFlagShape.round,
);

if (result != null) {
  // result.alpha2 == 'NL', 'US', ...
  final name = countryNameOf(context, result.alpha2);
  print('${result.alpha2} — $name');
}

Returned object #

class Country {
  final String alpha2; // ISO 3166-1 alpha-2 ('NL', 'US', ...)
}

Display names are looked up at render time (so they track locale changes correctly), via:

  • countryNameOf(context, code) — sync, in widget code, requires the delegate registered (see Localizations below).
  • countryNameFor(code, {locale}) — async, anywhere.

Flag shape #

CountryFlagShape.round  // default — circular flags (24×24)
CountryFlagShape.rect   // rectangular flags

Theme #

Every color and the font family are taken from Theme.of(context) by default. Override any subset:

showCountryPicker(
  context,
  theme: const CountryPickerTheme(
    selectedColor: Color(0xFFFF4500),
  ),
);
Field Default
backgroundColor theme.scaffoldBackgroundColor
surfaceColor colorScheme.surface
selectedColor colorScheme.primary
onSurfaceColor colorScheme.onSurface
iconColor colorScheme.onSurface
searchFieldFillColor surface tinted slightly toward onSurface
hintColor colorScheme.onSurface @ 50%

Localizations #

For instant load (no spinner on picker open), register the delegate in your MaterialApp:

MaterialApp(
  localizationsDelegates: const [
    CountryPickerLocalizations.delegate,
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,
  ],
  supportedLocales: CountryPickerLocalizations.supportedLocales,
)

Without it, showCountryPicker falls back to loading translations on demand, briefly showing a spinner.

Locale #

Translations follow the ambient Localizations by default. Pass locale: to force one:

showCountryPicker(context, locale: const Locale('nl', 'NL'));

Supported out of the box: en_US, nl_NL. Other locales fall back to English.

1
likes
160
points
15
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A self-contained Flutter country picker. 205 countries, bundled flag PNGs (round + rect), EN/NL translations, theme-aware styling. No network calls.

Repository (GitHub)
View/report issues

Topics

#country #picker #flag #localization #offline

License

MIT (license)

Dependencies

flutter, flutter_localizations, flutter_svg

More

Packages that depend on local_country_picker