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

パッケージ詳細v1.0.4

ccp_dialog

国コード、国旗、通貨、通貨ISOをダイアログおよびボトムシートに表示するためのCCP Dialogパッケージ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
80
いいね数
28
Pub ポイント
140

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

flutter pub add ccp_dialog

パッケージ概要

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

CCP Dialog は、国コード、国旗、通貨、通貨 ISO をダイアログまたはボトムシートで表示するように設計された Flutter パッケージです。アプリ内に国選択機能を簡単に統合できるようにし、ユーザーが自分の国を選択できるクリーンでカスタマイズ可能な UI を提供します。地域固有のデータ入力が必要な国際化アプリに最適であり、Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしています。選択時に国旗や通貨情報などの視覚的ヒントを提供することで、ユーザー体験を向上させます。

用途

  • 国際アプリオンボーディング
  • 国選択付きの電話番号入力
  • 通貨対応フォーム入力
  • マルチリージョンeコマースアプリ
  • 旅行および物流アプリケーション

主な機能

  • 国際の国旗とコードを表示します
  • 通貨および通貨ISOを表示
  • ダイアログおよびボトムシートモードをサポートしています
  • クロスプラットフォーム互換性
  • カスタマイズ可能な UI 要素
  • pub add を通じた簡単な統合

適している対象

  • グローバルアプリを開発する開発者
  • 国選択が必要なアプリ
  • 地域データを必要とするフォームビルダー
  • ローカライゼーションが必要なモバイルおよびウェブアプリケーション
  • ユーザーエクスペリエンスを重視したインターフェース

注意事項

  • 完全な国データの取得にはインターネット接続が必要です(動的の場合)
  • 英語以外のロケール向けにカスタマイズが必要な場合があります
  • 事前に定義された国リストに限定
  • 大規模なデータセットによるパフォーマンスへの影響
  • オフライン専用のユースケースには適していません

元の README

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

Flutter CCP dialog

Features

Flexible CCP dialog for getting Country code, Calling code, isoCode and Currency in Dialog and Bottom sheet.


# Installation
  1. Add the latest version of package to your pubspec.yaml (and dart pub get):
dart
  dependencies:
    flutter:
      sdk: flutter
    ccp_dialog: any
  1. Import the package and use it in your App.

Usage Example

import 'package:ccp_dialog/country_picker/flutter_country_picker.dart';

Example

import 'package:ccp_dialog/country_picker/flutter_country_picker.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Country Piker Dialog'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String countryCode ="+91";
  Country selectedCountry = Country.IN;

  _updateCountry(Country country){
    selectedCountry = country;
    countryCode = "+${country.dialingCode}";
    setState(() {

    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Select Country',
            ),
            Container(
                height: 45,
                 width: MediaQuery.of(context).size.width/2,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    color: Colors.white),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                   CountryPicker(
                      selectedCountry: selectedCountry,
                      dense: true ,
                       //displays arrow, true by default
                      showLine: true,
                       //displays line, false by default If dense true Line not show
                      showFlag: false,
                       //displays flag, true by default
                         showFlagCircle: true,
                       //displays flagCircle, false by default
                      dialingCodeTextStyle:const TextStyle(fontSize: 18),
                      showDialingCode: true,
                      //displays dialing code, false by default
                      showName: false,
                       //displays Name, true by default
                      withBottomSheet: true,
                      //displays country name, true by default
                      showCurrency: false,
                      //eg. 'British pound'
                      showCurrencyISO: false,
                      onChanged:_updateCountry
                   ),
                   const Text('9876541230',style: TextStyle(fontSize: 20),),
                ]))
          ],
        ),
      ),
    );
  }
}

Using Getx

Example:-

  Rx<Country> selectedCountry = Country.IN.obs;
  var countryCode = "+91".obs;
  updateCountry(Country country)
  {
      selectedCountry.value = country;
      countryCode.value = "+" + country.dialingCode.toString();
  }
  Obx(
  () => CountryPicker(
  selectedCountry: _controller.selectedCountry.value,
  dense: false,
  showFlag: false,
  showFlagCircle: true,
  showDialingCode: true,                                      
  showName: false,
  showCurrency: false,                                         
  showCurrencyISO: false,
  onChanged: _controller.updateCountry
  ),
 )

How to get Default Country

Country? country =  await getCountryByCountryCode(Get.context!, '+91');

Future<Country?> getCountryByCountryCode(BuildContext context, String countryCode) async {
const list = Country.ALL;
return list.firstWhere((element) => element.dialingCode == countryCode);
}

simulator_screenshot_24795F01-DE84-46B5-977D-C23CED7D1EE1

Simulator Screen Shot - iPhone 14 - 2023-05-31 at 15 11 38

Simulator Screen Shot - iPhone 14 - 2023-05-31 at 15 12 12

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

カテゴリー

ソースリポジトリ

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

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