FLUTTER ECOSYSTEM

leancodepl/address

अंतर्राष्ट्रीयकरण लाइब्रेरी का संबंध है। विभिन्न भाषाओं में विभिन्न भौतिक पतों को प्रारूपित करें और स्थानीयकृत पता फॉर्म बनाएं।

पता प्रोजेक्ट कवर
Stars
12
Forks
1
अंतिम पुश (UTC)
15 अग॰ 2023
प्रोजेक्ट स्थिति
सक्रिय
LeanCode GitHub avatar
GITHUB Organization

LeanCode ↗

We're a custom software studio that delivers end-to-end solutions for various industries. Experts in Flutter, .NET, and React.

भाषाएँDartSwiftKotlinObjective-C

तकनीकी विषय

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 3 आइटम
  • meta^1.3.0
  • lintडेवलपमेंट^1.5.1
  • testडेवलपमेंट^1.16.4

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

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.