country_selector_widget 0.1.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

Country Selector Widget provides CountrySelectorWidget and showCountrySelectorBottomSheet to fulfill the needed usage.

Country Selector Widget

Country Selector Widget written by Dart and Flutter supports three locales with the country's name, achieved lazy loading, and animation FadeIn. This package provides CountrySelectorWidget and showCountrySelectorBottomSheet to fulfill the needed usage.

AndroidiOSLinuxmacOSWebWindows
SupportAnyAnyAnyAnyAnyAny

To see examples of the following animations on a device or simulator:

cd example/
flutter run

Usage

To use this plugin, add country_selector_widget as a [dependency in your pubspec.yaml file].

Examples

Here are the examples that show you how to use the CountrySelectorWidget and showCountrySelectorBottomSheet.

Usage of CountrySelectorWidget

  • the default locale is SelectedLocale.en, you would change to SelectedLocale.zhCH or SelectedLocale.zhHK
  • once the country is selected and clicked the continue btn it will trigger the valueChangedCallback called onSelectedCountry and return the Country
CountrySelectorWidget(
    onSelectedCountry: (Country country) async {
        // selected country callback 
    },
)

Usage of showCountrySelectorBottomSheet

  • the different between CountrySelectorWidget and showCountrySelectorBottomSheet are showCountrySelectorBottomSheet is wrap with the showModalBottomSheet
  • showCountrySelectorBottomSheet will also do the Navigator.pop(context) for you once the continue button are clicked
showCountrySelectorBottomSheet(
    context: context,
    onSelectedCountry: (Country country) async {
        // selected country callback 
    };

Parameters

ParameterDescription
withDialCodeUsed to determine whether show the dialCode of country or not
refCountryCodeSets the default selected country
customAppBarSets the Custom AppBar instead of using provided default AppBar
bottomAppBarHeightSets the height for the bottom Continue Section widget
continueBtnPaddingThe Padding between the bottom Continue Section and Continue Button widget
selectedLocaleUses to determine the default label with locale, there are three SelectedLocale. They are SelectedLocale.en, SelectedLocale.zhCH and SelectedLocale.zhHK
showSelectedWidgetUses to determine wether show the CountryCardWidget or not when the country is selected in the ListView
aniDurationDuration of the FadeIn Animation of CountryCardWidget
onSelectedCountryCallback of onSelectedCountry when the country is selected from ListView and ContinueButton is Clicked
appBarTextUses to replace the default text of the AppBar
searchTextUses to replace the hintText of TextField
selectedCountryTextUses to replcae the title of the SelectedCountryCardWidget
withoutMatchTextUses to replace the hintText when there are does not country match with the search pattern
continueBtnTextUses to replace the text of the Continue Button
textFieldTextStyleUses to determine the textStyle of the TextField
appBarTextStyleUses to determine the textStyle of the AppBar
searchTextStyleUses to determine the textStyle of the SearchText
selectedCountryTextStyleUses to determine the textStyle of the selectedCountry
withoutMatchTextStyleUses to determine the textStyle of the WitoutMatchText when there does not the match match with serach pattern
continueBtnTextStyleUses to determine the textStyle of Continue Button
focusedBorderColorUses to determine the borderColor of TextField when it is selected
selectedCardColorUses to determine the color of Card when the CountryCardWidget is selected
continueBtnBgColorUses to determine the background color of Contuinue Button
continueBtnOverlayColorUses to determine overlay color of Contuinue Button
textFieldborderRadiusUses to determine borderRadius of TextField
continueBtnRadiusUses to determine borderRadius of Continue Button

Demonstration of CountrySelectorWidget - Flutter Web

"CountrySelectorWidget - SelectedLocale.zhCH"

Demonstration of showCountrySelectorBottomSheet - Flutter Web

"showCountrySelectorBottomSheet - SelectedLocale.en"

Demonstration of CountrySelectorWidget - Android

"Demonstration of showCountrySelectorBottomSheet - Android"

Demonstration of CountrySelectorWidget - IOS

"Demonstration of showCountrySelectorBottomSheet - IOS"

Demonstration of showCountrySelectorBottomSheet - MacOS

"Demonstration of showCountrySelectorBottomSheet - MacOS"

MIT License

Copyright (c) 2022 hkk97

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.