搜尋套件、儲存庫與 APP 分類

country_currency_pickers 封面
套件詳情v3.0.0

country_currency_pickers

國家、代碼、旗幟、貨幣以及多種選擇方式,皆可為您服務……只需一個組件即可實現...

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2380
喜歡數
39
Pub 分數
150

安裝套件

flutter pub add country_currency_pickers

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,提供完整的國家與貨幣選擇功能,包含國家名稱、代碼、旗幟及貨幣細節。它提供單一組件來選擇國家與貨幣,並支援可自訂的 UI 選項。非常適合需要國際化、付款表單或使用者位置設定的應用程式。此套件支援所有主要平台:Android、iOS、Web、macOS、Windows 與 Linux。

適用情境

  • 國際表單輸入
  • 支付中的貨幣選擇
  • 使用者資料本地化
  • 多語言應用程式設定
  • 旅行和物流應用
  • 使用者入門,包含國家選擇

主要特色

  • 內建國家與貨幣資料
  • 旗幟圖示支援
  • 可自訂的選擇器元件
  • 支援多個平台
  • 與 Flutter 表單輕鬆整合
  • 可搜尋且可篩選的清單

適合對象

  • 電子商務應用
  • 全球旅行應用
  • 金融與銀行工具
  • 多語言行動應用程式
  • 使用者註冊流程

使用建議

  • 需要網路以取得最新資料更新
  • 由於內嵌資料導致初始套件體積過大
  • 對內部 UI 元件的自訂有限
  • 可能需要額外的樣式以相容深色模式
  • 未針對非常大的資料集進行優化

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

country_currency_pickers

Countries, codes, flags, currency and several way of picking them at your service...one widget away...

CountryPickerDropdown example
 CountryPickerDropdown(
            initialValue: 'tr',
            itemBuilder: _buildDropdownItem,
            onValuePicked: (Country country) {
              print("${country.name}");
            },
          ),
 Widget _buildDropdownItem(Country country) => Container(
        child: Row(
          children: <Widget>[
            CountryPickerUtils.getDefaultFlagImage(country),
            SizedBox(
              width: 8.0,
            ),
            Text("+${country.phoneCode}(${country.isoCode})"),
          ],
        ),
      );
CurrencyPickerDropdown example
 CurrencyPickerDropdown(
            initialValue: 'INR',
            itemBuilder: _buildCurrencyDropdownItem,
            onValuePicked: (Country country) {
              print("${country.name}");
            },
          ),
 Widget _buildCurrencyDropdownItem(Country country) => Container(
        child: Row(
          children: <Widget>[
            CountryPickerUtils.getDefaultFlagImage(country),
            SizedBox(
              width: 8.0,
            ),
            Text("${country.currencyCode}"),
          ],
        ),
      );
CountryPickerDialog example
void _openCountryPickerDialog() => showDialog(
        context: context,
        builder: (context) => Theme(
            data: Theme.of(context).copyWith(primaryColor: Colors.pink),
            child: CountryPickerDialog(
                titlePadding: EdgeInsets.all(8.0),
                searchCursorColor: Colors.pinkAccent,
                searchInputDecoration: InputDecoration(hintText: 'Search...'),
                isSearchable: true,
                title: Text('Select your phone code'),
                onValuePicked: (Country country) =>
                    setState(() => _selectedDialogCountry = country),
                itemBuilder: _buildDialogItem)),
      );
CurrencyPickerDialog example
void _openCurrencyPickerDialog() => showDialog(
        context: context,
        builder: (context) => Theme(
            data: Theme.of(context).copyWith(primaryColor: Colors.pink),
            child: CurrencyPickerDialog(
                titlePadding: EdgeInsets.all(8.0),
                searchCursorColor: Colors.pinkAccent,
                searchInputDecoration: InputDecoration(hintText: 'Search...'),
                isSearchable: true,
                title: Text('Select your Currency'),
                onValuePicked: (Country country) =>
                    setState(() => _selectedDialogCountry = country),
                itemBuilder: _buildCurrencyDialogItem)),
      );
CountryPickerCupertino example
 void _openCupertinoCountryPicker() => showCupertinoModalPopup<void>(
      context: context,
      builder: (BuildContext context) {
        return CountryPickerCupertino(
          pickerSheetHeight: 300.0,
          onValuePicked: (Country country) =>
              setState(() => _selectedCupertinoCountry = country),
        );
      });
CurrencyPickerCupertino example
 void _openCupertinoCurrencyPicker() => showCupertinoModalPopup<void>(
      context: context,
      builder: (BuildContext context) {
        return CurrencyPickerCupertino(
          pickerSheetHeight: 300.0,
          onValuePicked: (Country country) =>
              setState(() => _selectedCupertinoCountry = country),
        );
      });

Credits

Forked from country_pickers repo. Thanks goes to country-flags repo for the flag image assets. Learn Pain Less | Code Academy (learn to code)

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。