搜索插件、代码仓与 APP 分类

插件详情v0.1.0+2

address

处理国际化库。以各种语言格式化各种物理地址,并构建本地化的地址表单。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
12
喜欢数
26
Pub 分数
160

安装插件

flutter pub add address

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

地址包是一个专为 Flutter/Dart 设计的库,用于物理地址的国际化。它可根据不同地区的惯例格式化地址,并支持创建本地化的地址输入表单。该库以全球可用性为目标,处理地址结构的差异,例如街道、城市和邮政编码的顺序,确保在各国之间准确表示。该包可无缝集成到需要多语言地址处理的应用程序中,从而在国际环境中提升用户体验。

适合场景

  • 多语言地址格式化
  • 本地化形式生成
  • 国际运输集成
  • 全球用户入门
  • 跨境电子商务
  • 旅行和物流应用

主要特点

  • 支持多种语言和地区
  • 动态地址结构自适应
  • 国家特定格式的预定义模板
  • 与 Flutter 表单轻松集成
  • 可扩展的国家配置
  • 跨平台的一致性用户界面

适合对象

  • 面向全球受众的应用
  • 支持国际配送的电商平台
  • 旅行和预订服务
  • 具有国际用户的用户资料系统
  • 政府或企业软件需要地址验证

使用建议

  • 需要为不太常见的国家手动设置
  • 仅限预定义的国家模板
  • 可能需要额外的验证逻辑
  • 取决于正确的区域设置配置
  • 未针对实时地址自动补全进行优化
  • 最好与专用的地址验证库配合使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

address

Pub Version GitHub test workflow status

Addresses internationalization library. Format various physical addresses in various languages and build localized address forms.

Usage

Formatting address to display

Given you have some address:

final address = Address(
  fullName: 'Nicole Martin',
  addressLine1: '123 Sherbrooke St',
  city: 'Montreal',
  zone: 'QC',
  postalCode: 'H3G 2A6',
  country: 'CA',
);

You can format it to your desired format:

final englishFormatter = AddressFormatter('en');
print(englishFormatter.formatDisplay(address));

// [
//   'NICOLE MARTIN',
//   '123 SHERBROOKE ST',
//   'MONTREAL QC  H3G 2A6',
//   'CANADA'
// ]

final frenchFormatter = AddressFormatter('fr');
print(frenchFormatter.formatDisplay(address));

// [
//   'Nicole Martin',
//   '123 Sherbrooke St',
//   'Montreal (Québec)  H2G 2A6',
//   'CANADA'
// ]

Address form layout

You can also get localized format of an address form with all obligatory and optional fields along with their labels and descriptions.

final addressFormatter = AddressFormatter('en');
final formFormat = addressFormatter.formatForm('US');

// formFormat = [
//   // other fields: full name, addressLine1, addressLine2, city
//   AddressFormFieldInformation(
//     label: 'State',
//     obligatory: true,
//     availableValues: {
//       // (...)
//       'TX': 'Texas',
//       // (...)
//     },
//   ),
//   // other fields: zip code
// ]

You can use this information to build e.g. a Flutter form. You can see how to do this by looking into the example.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。