搜索插件、代码仓与 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)

所属分类

源码仓库

使用此插件的项目

暂无相关数据。