Flutter package to show and pick country code

Overview

country list pick

Flutter plugin to pick country with output name, code, dialcode and flag of country

Usage

To use this plugin, add country_list_pick as a dependency in your pubspec.yaml.

    CountryListPick(
        appBar: AppBar(
          backgroundColor: Colors.blue,
          title: Text('Choisir un pays'),
        ),
        
        // if you need custome picker use this
        // pickerBuilder: (context, CountryCode countryCode){
        //   return Row(
        //     children: [
        //       Image.asset(
        //         countryCode.flagUri,
        //         package: 'country_list_pick',
        //       ),
        //       Text(countryCode.code),
        //       Text(countryCode.dialCode),
        //     ],
        //   );
        // },

        // To disable option set to false
        theme: CountryTheme(
          isShowFlag: true,
          isShowTitle: true,
          isShowCode: true,
          isDownIcon: true,
          showEnglishName: true,
        ),
        // Set default value
        initialSelection: '+62',
        // or
        // initialSelection: 'US'
        onChanged: (CountryCode code) {
          print(code.name);
          print(code.code);
          print(code.dialCode);
          print(code.flagUri);
        },
        // Whether to allow the widget to set a custom UI overlay
        useUiOverlay: true,
        // Whether the country list should be wrapped in a SafeArea
        useSafeArea: false
        ),

To call feedback or getting data from this widget, you can make function in onChanged

Special Thanks

  • Salvatore Giordano, CountryCodePicker CountryCodePicker
  • @tomrozb and @dev-fema for changelog 1.0.0+3
  • @giaotuancse for changelog 1.0.0+4
  • @joshuachinemezu for changelog 1.0.0+6 - 1.0.0+8
  • @u-gin for chaangelog 1.0.0+9
  • @imurnane for chaangelog 1.0.1+1
  • @jpainam for chaangelog 1.0.1+2
  • @d00rman for chaangelog 1.0.1+3
  • @MohammadKashaniJabbari for chaangelog 1.0.1+4
Comments
  • getFlutterEngine(): FlutterEngine' is deprecated. Deprecated in Java

    getFlutterEngine(): FlutterEngine' is deprecated. Deprecated in Java

    Hello @hifiaz I was recently building my project and it returned a warning: getFlutterEngine(): FlutterEngine' is deprecated. Deprecated in Java

    I'm afraid it might lead o breakages in future builds.

    If there's anything that can be done.

    Thanks

    opened by Kasre96 3
  • How do I set the default country to the United States? Now initialSelection='+1', which displays the Canadian

    How do I set the default country to the United States? Now initialSelection='+1', which displays the Canadian

    How do I set the default country to the United States? Now initialSelection='+1', which displays the Canadian

    country_list_pick: ^1.0.1+2 Flutter (Channel stable, 1.22.4

    image

    opened by 978740431 2
  • Update alphabet sidebar while scrolling

    Update alphabet sidebar while scrolling

    I noticed when using the country picker, the sidebar containing the alphabet letter of the countries does not update with what is displayed on screen. It would be nice if the sidebar updates with the current country's letter that is on screen as the user scrolls through the list.

    opened by flikkr 2
  • Accessibility warning for search button

    Accessibility warning for search button

    First of all great library! Thanks for your hard work.

    Would you consider improving accessibility for the country list? There's a warning for e.g. search button (top right corner).

    This item may not have a label readable by screen readers.

    Also the check button displays below the alphabet letters. Looks like it can also be improved.

    22

    opened by tomrozb 2
  • Issue 45

    Issue 45

    I added a field named labelColor to CountryTheme class to change color of "Search" and "Last pick" labels, which is one of the parameters of the CountryListPick class and this class passes it to the SelectionList.

    Then I added style to those two Texts and I put the color parameter in TextStyle. If you leave labelColor null, the color will be black.

    In the end, tested this in the example/lib/main.dart. As you can see, I added labelColor parameter to theme parameter of CountryListPick object and it works fine:

    image_2021-07-15_020920

    I hope it helps you!

    can close issue #45

    opened by MohammadKashaniJabbari 1
  • Refactor code

    Refactor code

    If you want to not hardcode the alphabet list

    List _alphabet = List.generate(26, (i) => String.fromCharCode('A'.codeUnitAt(0) + i)))

    https://github.com/hifiaz/country-list-pick/blob/0dc7f81e86c39178ded26c072ca6145bd1f6d71e/lib/selection_list.dart#L61

    opened by Mun0nKado 1
  • Make using the UI overlay optional and allow using SafeArea

    Make using the UI overlay optional and allow using SafeArea

    When country_list_pick is used inside an app that uses SafeArea, using the widget's country selection list messes with the notification area of the device. This commit allows clients to choose whether SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle() should be applied and allows them to have the country selection list wrapped inside a SafeArea widget.

    opened by d00rman 1
  • add appBar builder and placeholder result builder instead of hardcoding it

    add appBar builder and placeholder result builder instead of hardcoding it

    Hi, nice library,

    could you provide an appBar builder and a placeholder result builder instead of hardcoding the appbar (currently, the title is centered) and the result of the selection. This is allow more custumization.

    I can provide a pull request if you are willing to integrate it.

    opened by jpainam 1
  • Invalid plugin specification country_list_pick.

    Invalid plugin specification country_list_pick.

    flutter pub get results in the following error after adding the plugin.

    Invalid plugin specification country_list_pick. Cannot find the flutter.plugin.platforms key in the pubspec.yaml file. An instruction to format the pubspec.yaml can be found here: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms

    opened by felixagbavor 1
  • unable to locate flags

    unable to locate flags

    ════════ Exception caught by image resource service ════════════════════════════════════════════════ Unable to load asset: packages/country_list_pick/flags/af.png ════════════════════════════════════════════════════════════════════════════════════════════════════

    <<<< [ +4 ms] Error while trying to load an asset: Failed to load asset at "assets/packages/country_list_pick/flags/cu.png" (404) >>>>

    opened by digitpk 1
  • Default country selection is

    Default country selection is "Select country" if used didn't select any. Theme tweaks

    Added country to the map, default country selection is "Select country" until country is selected transparent flag for "Select country" Theme tweaks, colours are now defined by variables, provided on the CountryTheme

    opened by VladPhi 0
  • country cannot be selected when you use the pickerBuilder and countryBuilder paramters together.

    country cannot be selected when you use the pickerBuilder and countryBuilder paramters together.

    When I use the pickerBuilder parameter to build the widget for the picker, before the country list fragment displays for picking the country, I can select a country. But when I use the countryBuilder to customize it. I cant select a country again.

    opened by dubemezeagwu 1
  • No country if not selected, instead of Afganistan

    No country if not selected, instead of Afganistan

    While user did not select the country, it's preferable to maintain text like "Select Country" instead of Selecting [0]

    selectedItem = elements[0];

    By default. May be added to the Map?

    opened by VladPhi 1
  • RangeError (index): Invalid value: Not in inclusive range (iOS)

    RangeError (index): Invalid value: Not in inclusive range (iOS)

    Whenever I scroll to the top of the country list an exception always happens in iOS which is:

    RangeError (index): Invalid value: Not in inclusive range 0..241: -3
    

    I traced the code and found that the problem is in selection_list.dart line 305:

    String? countryName = countries.elementAt(scrollPosition).name;
    

    when scrollPosition is a negative number.

    Fix:

    Change the condition in line 304 to:

    if (scrollPosition < countries.length && scrollPosition >= 0)
    
    opened by Hassanmohsaid 0
Owner
fiaz
Freelance Flutter Developer https://lthfi.netlify.com
fiaz
A Flutter widget to show an icon collection to pick. This widget extend TextField and has a similar behavior as TextFormField

icon_picker A Flutter widget to show an icon collection to pick. This widget extend TextField and has a similar behavior as TextFormField Usage In the

m3uzz Soluções em TI 11 Sep 27, 2022
A flutter package for showing a country code selector.

country_code_picker A flutter package for showing a country code selector. It supports i18n for 70 languages. Check the example on web! https://imtoor

Salvatore Giordano 221 Jan 5, 2023
A Dart package that provides a customizable country phone code picker for your Flutter application

A Flutter package that provides an easy and customizable country phone code picker widget! Features This package comes with a lot of customization all

Samit Kapoor 1 Oct 1, 2022
A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your iss

PengHui Li 112 Nov 11, 2022
An app to pick, upload and display images from camera and gallery with size and extension constraints.

image_uploader A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Ehmad Saeed⚡ 4 Mar 7, 2022
Show a draggable floating chat icon button and show messages on screens

Show a draggable floating chat icon button and show messages on screens Features A widget for displaying a chat icon (or custom widget) on top of a ba

CU Apps 4 May 5, 2022
It is a Flutter mobile and web application that allows you to search for universities worldwide by name and country.

Search Universities App It is a Flutter mobile and web application that allows you to search for universities worldwide by name and country. Data sour

Enes 1 Feb 4, 2022
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

Johannes Milke 30 Dec 28, 2022
Imagepickerweb - A picker with which you can pick images and videos from your Flutter web app

ImagePickerWeb This Web-Plugin allows Flutter Web to pick images (as File, Widget or Uint8List) and videos (as File or Uint8List). Many thanks goes to

Rebar Ahmad 40 Sep 26, 2022
In this repo you will see how to pick images from the image library and also, see how to store the selected images on Firebase.

flutterimageapp Flutter Tutorial - Upload Images using Firebase Storage. Flutter Tutorial - Upload Images using Firebase Storage Video series can be w

Whatsupcoders 60 Nov 4, 2022
A simple, private tool to help pick a baby name.

Nom de Bébé A simple, private tool to help pick a baby name. https://nomdebebe.app/ Motivation I need to choose a name. There's lots of tools and apps

Kenton Hamaluik 257 Nov 23, 2022
FormField to pick one or more locations from open streat map

FormField to pick one or more locations from open streat map Features Pick single location Pick multi locations display open street maps can work with

Mohamed Dawood 13 Dec 15, 2022
A Sample Flutter project to show how to integrate native kotlin code with flutter

kotlin_flashlight A Sample Flutter project to show how to integrate native kotlin code with flutter. Getting Started Visit this docs for Flutter setup

null 0 Apr 4, 2022
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.

Dart_Native Dart_Native operates as both a code generator tool and a bridge to communicate between Dart and native APIs. Replaces the low-performing F

DartNative 893 Jan 4, 2023
Flutter package for Android and iOS allow you to show a wide range of hyperlinks either in the input field or in an article view

Tagtly package help you to detect a lot of hyperlink text such as.. email, url, social media tags, hashtag and more either when user type in text field or when appear a text read only.

Mohamed Nasr 4 Jul 25, 2022
A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

A package that gives us a modern way to show animated border as a placeholder while loading our widget with easy customization and ready to use.

Mohit Chauhan 8 Oct 3, 2022
Flutter-context-menus - A flutter package to show context menus on right-click or long-press

context_menus A package to show context menus on right-click or long-press. ?? I

null 0 Jan 18, 2022
Flutter package to to show bulletins in your application

Bulletin Flutter package to to show bulletins in your application. Show some ❤️ and ⭐ the repo || Features ✅ Show Flash Cards ✅ Pop up cards ✅ Animati

Devs On Flutter 5 Aug 27, 2022
A Flutter app to show how to implement in-app purchase using the in-app-purchase package

Flutter in-app purchase A Flutter project to show to implement in-app purchase using the in_app_purchase package Simple UI but it's okay ?? ?? WhatsAp

António Nicolau 5 Jul 26, 2022