Giter Site home page Giter Site logo

iamevansobeng / country_state_picker Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 3.0 375 KB

Country and State Field Picker for Flutter

Home Page: https://pub.dev/packages/country_state_picker

License: BSD 3-Clause "New" or "Revised" License

Dart 93.97% Kotlin 0.88% Swift 4.88% Objective-C 0.27%
flutter flutter-package flutter-packages country-picker flutter-widget state-picker

country_state_picker's Introduction

Description

This package provides drop-down items for selecting countries and states.

Features
  • Select Country
  • Select State per selected country
  • Pass validators to validate country and state when submitting form
Parameters
Param Required Default Type Description
onCountryChanged null Function (String) Handle Country Selection
onStateChanged null Function (String) Handle State Selection
onStateTap null void Handle Input onTap Event
onStateTap null void Handle Input onTap Event
flagSize 22.0 double Size of Country Flag on Input Label
listFlagSize 22.0 double Size of Country Flag on List Label
inputDecoration -- InputDecoration Style for InputFields
hintTextStyle -- TextStyle Style for Hint Text of Input
itemTextStyle -- TextStyle Style for Text of DropdownItem
dropdownColor Grey Color Style for Text of DropdownItem
elevation 0 int Elevation of Dropdown List
isExpanded true bool Determines if Input field should fill parent width
divider -- Widget Widget to create space or style between the country and state field
countryLabel -- Widget Label for country field
stateLabel -- Widget Label for state field
countryHintText -- String hintText for country field
stateHintText -- String hintText for state field
noStateFoundText -- String Hint to ack no states exist on the selected country (eg. Aruba)
onCountryChanged null Function (String) Validate Country Selection on Submition
onStateChanged null Function (String) Validate State Selection on Submition

How To Use

  1. Import the package

    import 'package:country_state_picker/country_state_picker.dart';
    
  2. Provide at least the required params

    CountryStatePicker(
      onCountryChanged: (ct) => setState(() {
          country = ct;
          state = null;
        }),
        onStateChanged: (st) => setState(() {
          state = st;
        }),
     ),
    
    

Todo

  • Select Country
  • Select State
  • Validate Country
  • Validate State
  • Create Select City
  • Add Select City
  • Add Variants to the widget

country_state_picker's People

Contributors

iamevansobeng avatar julianasalafia avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

country_state_picker's Issues

Selection of different Country Twice Error

I installed this package in my project, when I selected country for the first time there was no issue, but when I tried selecting it again this is the error I got in the state dropdown menu. If you select a country, and then you select a state, now try to select a different country without leaving the current screen

Screenshot_20231116-170230

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.