パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.1.2

ola_like_country_picker

新しいFlutterパッケージ、国ピッカー用。ola_like_country_pickerは、リストから国(国旗とダイアルコード)を選択できるボトムシートを提供します(オプション)。

30日間ダウンロード
40
いいね数
19
Pub ポイント
40

パッケージをインストール

flutter pub add ola_like_country_picker

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

国を選び、国旗とオプションのダイヤルコードを表示するためのフローティングシートを提供するFlutterパッケージです。国選択に適した洗練された、使いやすいインターフェースを提供しており、国際電話番号入力が必要なフォームに最適です。軽量で既存のFlutterアプリにスムーズに統合できます。カスタマイズに対応しており、モダンで直感的なUXを意識して設計されています。

用途

  • 国際電話番号入力
  • ユーザープロフィール国選択
  • マルチ言語アプリのローカライゼーション
  • 旅行または配送フォームの国選択
  • 認証フロー国選択

主な機能

  • ボトムシート UI
  • 国際的な国旗の表示
  • オプションのダイヤルコードサポート
  • カスタマイズ可能な外観
  • Flutter フォームとの簡単な統合
  • 軽量で高速

適している対象

  • 国選択が必要なモバイルアプリ
  • 電話番号の入力を必要とするフォーム
  • グローバルユーザーをターゲットにするアプリ
  • 簡単な国選択機能を求める開発者
  • UI中心のFlutterプロジェクト

注意事項

  • 国とダイヤルコードのみに制限
  • 組み込みの検索機能がありません
  • 地域フィルタリングをサポートしていません
  • 選択された国データの手動処理が必要です
  • オフラインモードが指定されていません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Ola Like Country Picker

A new country picker Flutter package built in Dart.

Introduction

It is Flutter plug-n-play country picker package.

  1. Simple two lines of code. Initialize and Launch.
CountryPicker countryPicker = CountryPicker(
                                onCountrySelected:(country){
                                    print(country);
                                },
                              );
countryPicker.launch(context)

Installation

https://pub.dev/packages/ola_like_country_picker#-installing-tab-

  1. To use the Country Picker look at the example below :
Example Usage:
class _MyHomePageState extends State<MyHomePage> {
  CountryPicker countryPicker;
  Country country = Country.fromJson(countryCodes[0]); // select initial country 

  @override
  void initState() {
    super.initState();
    countryPicker = CountryPicker(onCountrySelected: (Country country) {
      print(country);
      setState(() {
        this.country = country;
      });
    });
  }
  
    @override
  Widget build(BuildContext context) {
    // To simply launch the country picker
    // use countryPicker.launch(context)
    // to forcefully dismiss use countryPicker.dismiss()
    // simple example could be
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image:
                AssetImage(country.flagUri, package: 'ola_like_country_picker'),
          ),
        ),
      ),
      onTap: () {
        countryPicker.launch(context);
      },
    );

  }  
}
Output
Parameters
parameter default required type remark
onCountrySelected null yes OnCountrySelectedCallback called when country is selected.
showTitle true no bool whether to show title or not.
titleText "Select your country" no String text for title.
  1. To simply use country list view any where use CountryListView() and to modify attributes like flagWidth, flagHeight, countryTitle style etc use below arguments like
CountryListView(flagWidth:50, flagHeight:50 , itemTitleStyle: TextStyle(fontSize:20)); 
Example Usage:
return MaterialApp(
  theme: ThemeData(primarySwatch: Colors.purple),
  home: Scaffold(
    appBar: AppBar(
      title: Text('Select Country'),
    ),
    body: CountryListView(),
  ),
);
Output
Parameters
parameter default required type remark
countryJsonList country_codes no List<Map<String, String>> can be used to specify own set of sublist of countries from the variable country_codes
flagWidth 25 no double width of flag
flagHeight 25 no double height of flag
showFlag true no bool whether to show flag or not
showDialCode true no bool whether to show dial code or not
dialCodePrefix '+' no String The prefix added to the dial code for e.g +91 here prefix is '+'
itemTitleStyle null no TextStyle Used to change style of Country title e.g TextStyle(fontSize:30)
dialCodeStyle null no TextStyle Used to change style of Country's dial code e.g TextStyle(backgroundColor:Colors.green[400])
onSelected null no OnCountrySelectedCallback When Any Country is selected what callback has to be executed e.g CountryListView(onSelected: (Country country){ print(country.toString() });
  1. To use the own version of CountryListView() with CountryPicker() use setCountryListView() method before calling launch() e.g.
    c = CountryPicker(onCountrySelected: (Country country) {
      print(country);
      setState(() {
        this.country = country;
      });
    });
    CountryListView clv = CountryListView(showFlag:false); //own version of CountryListView
    c.setCountryListView(clv);
    ...
    ...
    // Call c.launch(context) in GestureDetector() or other listeners 
    ...
    ...
    

Support

The simplest way to show your support is by giving the project a star.

You can also support by becoming a patron on Patreon:

Patreon

Or by making a single donation by buying a coffee:

Buy Me A Coffee

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。