搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。