All Projects → Daniel-Ioannou → flutter_country_picker

Daniel-Ioannou / flutter_country_picker

Licence: MIT License
A flutter package to select a country from a list of countries.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to flutter country picker

file manager
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
Stars: ✭ 38 (-11.63%)
Mutual labels:  flutter-package
lang table
lang_table is a dart plugin to generate string files from a source. Use a table to manage all multi-language resources. Inspired by fetch-mobile-localization-from-airtable
Stars: ✭ 17 (-60.47%)
Mutual labels:  flutter-package
glider
Server-side rendering for mobile apps, powered by Flutter
Stars: ✭ 20 (-53.49%)
Mutual labels:  flutter-package
flutter-devicelocale
A Flutter package to read and return the set device locales
Stars: ✭ 45 (+4.65%)
Mutual labels:  flutter-package
reactive state
An easy to understand reactive state management solution for Flutter.
Stars: ✭ 19 (-55.81%)
Mutual labels:  flutter-package
flutter material showcase
Material Design components showcase for Flutter apps. Use to check ThemeData with most Material widgets.
Stars: ✭ 22 (-48.84%)
Mutual labels:  flutter-package
Columbus
A feature-rich country picker for iOS, tvOS and watchOS.
Stars: ✭ 23 (-46.51%)
Mutual labels:  country-picker
emoji picker
A Flutter package that provides an Emoji Keyboard widget
Stars: ✭ 82 (+90.7%)
Mutual labels:  flutter-package
flutter feather icons
Flutter package for Feather Icons
Stars: ✭ 33 (-23.26%)
Mutual labels:  flutter-package
Flutter-firestore-auth
Flutter mobile app with firestore authentication including Email and Social auth.
Stars: ✭ 95 (+120.93%)
Mutual labels:  flutter-package
bouncing widget
A widget that enables you to add a bouncing animation on a widget.
Stars: ✭ 34 (-20.93%)
Mutual labels:  flutter-package
nepali date picker
Material Style Date Picker with Bikram Sambat(Nepali) Calendar Support. Supports both Android and ios.
Stars: ✭ 30 (-30.23%)
Mutual labels:  flutter-package
eva icons flutter
Flutter package for Eva Icons. Eva Icons is a pack of more than 480 beautifully crafted Open Source icons for common actions and items. https://pub.dartlang.org/packages/eva_icons_flutter
Stars: ✭ 80 (+86.05%)
Mutual labels:  flutter-package
CustomSwitch
Custom Switch package created in Flutter
Stars: ✭ 56 (+30.23%)
Mutual labels:  flutter-package
sliding clipped nav bar
Bottom navigation bar with sliding clip effect.
Stars: ✭ 46 (+6.98%)
Mutual labels:  flutter-package
IQPlayer
Simple video player with subtitle for flutter.
Stars: ✭ 16 (-62.79%)
Mutual labels:  flutter-package
water drop nav bar
flutter navigation bar with water drop effect.
Stars: ✭ 29 (-32.56%)
Mutual labels:  flutter-package
getwidget-web-kit
Get Widget Web app Demo
Stars: ✭ 40 (-6.98%)
Mutual labels:  flutter-package
injector io
InjectorIO - Dependency Injection for Flutter
Stars: ✭ 73 (+69.77%)
Mutual labels:  flutter-package
time chart
A scrollable time chart in Flutter.
Stars: ✭ 21 (-51.16%)
Mutual labels:  flutter-package

Country picker

pub package

A flutter package to select a country from a list of countries.

n1

Getting Started

Add the package to your pubspec.yaml:

country_picker: ^2.0.14

In your dart file, import the library:

import 'package:country_picker/country_picker.dart';

Show country picker using showCountryPicker:

showCountryPicker(
  context: context,
  showPhoneCode: true, // optional. Shows phone code before the country name.
  onSelect: (Country country) {
    print('Select country: ${country.displayName}');
  },
);

For localization:

Add the CountryLocalizations.delegate in the list of your app delegates.

MaterialApp(
      supportedLocales: [
        const Locale('en'),
        const Locale('el'),
        const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans'), // Generic Simplified Chinese 'zh_Hans'
        const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'), // Generic traditional Chinese 'zh_Hant'
      ],
      localizationsDelegates: [
        CountryLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      home: HomePage(),
 );

Parameters:

  • onSelect: Called when a country is selected. The country picker passes the new value to the callback (required)
  • onClosed: Called when CountryPicker is dismissed, whether a country is selected or not (optional).
  • showPhoneCode: Can be used to show phone code before the country name.
  • searchAutofocus Can be used to initially expand virtual keyboard
  • showWorldWide An optional argument for showing "World Wide" option at the beginning of the list
  • countryListTheme: Can be used to customize the country list's bottom sheet and widgets that lie within it. (optional).
    showCountryPicker(
      context: context,
      countryListTheme: CountryListThemeData(
        flagSize: 25,
        backgroundColor: Colors.white,
        textStyle: TextStyle(fontSize: 16, color: Colors.blueGrey),
        bottomSheetHeight: 500, // Optional. Country list modal height
        //Optional. Sets the border radius for the bottomsheet.
          borderRadius: BorderRadius.only(
          topLeft: Radius.circular(20.0),
          topRight: Radius.circular(20.0),
        ),
        //Optional. Styles the search field.
        inputDecoration: InputDecoration(
          labelText: 'Search',
          hintText: 'Start typing to search',
          prefixIcon: const Icon(Icons.search),
          border: OutlineInputBorder(
            borderSide: BorderSide(
              color: const Color(0xFF8C98A8).withOpacity(0.2),
            ),
          ),
        ),
      ),
      onSelect: (Country country) => print('Select country: ${country.displayName}'),
    );
  • exclude: Can be used to exclude(remove) one or more country from the countries list (optional).
    showCountryPicker(
      context: context,
      exclude: <String>['KN', 'MF'], //It takes a list of country code(iso2).
      onSelect: (Country country) => print('Select country: ${country.displayName}'),
    );
  • countryFilter: Can be used to filter the countries list (optional).
    • It takes a list of country code(iso2).
    • Can't provide both exclude and countryFilter

Contributions

Contributions of any kind are more than welcome! Feel free to fork and improve country_code_picker in any way you want, make a pull request, or open an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].