world_countries 1.6.0 world_countries: ^1.6.0 copied to clipboard
Sealed world data in form of Flutter widgets (country, phone, currency pickers, etc.).
1.6.0 #
NEW FEATURES
The package now uses CountryFlag
from the world_flags
package to display flags in the default country and phone code pickers. This approach offers several benefits:
- More customization:
CountryFlag
provides greater flexibility for customizing the appearance of flags. - Improved performance: These flags offer better performance compared to the assets.
- Platform independence: They work seamlessly across different platforms.
- No assets required: Since they are drawn using Flutter's
CustomPainter
, they don't require additional platform dependant and heavy font assets.
Asset based
EmojiFlag
s are being deprecated, but you can still use them until the next major update, you will be also able to use them after v2.0.0 withEmojiFlag.custom
if needed.
MaterialApp(
...
theme: ThemeData(
extensions: const <ThemeExtension>[
/// The `emojiFamily` will work until v2.0.0, with old, assets based flags.
CountryTileThemeData(emojiFamily: EmojiFamily.twemoji),
/// Instead you can migrate to FlagThemeData, where you can specify way more properties.
FlagThemeData(
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(4))),
),
],
)
);
1.5.0 #
NEW FEATURES
- 🎉 All translations in the eco-system packages now support all GlobalMaterialLocalizations and GlobalCupertinoLocalizations locales.
- 🦾 Countries translations now also support all
GlobalMaterialLocalization
+GlobalCupertinoLocalizations
locales. - The
locale
parameter in themaybeTranslation
method is now nullable. - The
permissive
constructors are now even more permissive, onlyname
andcode
parameters remain required. - Changed Vatican city
unMember
field tofalse
and fix Cape Verde coordinates Link - Added new
DurationExtension
to thehelpers
library. - Added new
TypedLocaleExtension
with acopyWithTranslationsCache(Async)
method. - Added
asyncTranslationCacheProcessing
parameter for theTypedLocaleDelegate
. - Added
withTranslationsCache
constructor forTypedLocale
andIsoLocale
. - Set default value for
startWithSearch
in the country and phone code pickers also tofalse
, to unify behavior across the pickers.
1.4.0 #
NEW FEATURES
- 🦾 Language translations now also support all
GlobalMaterialLocalization
+GlobalCupertinoLocalizations
locales. - You can now provide translation caches list in
TypedLocaleDelegate
and it's newselectiveCache
constructor. This is useful when you don't want to cache the translations for the specific unused ISO objects. For example you are only using country pickers, so you might not need currency an language translations. In this case you can provide onlycountriesForTranslationCache
for the countries translation cache. - The
TypedLocale
(so andIsoLocale
) has new fields for storing translations cache (see the point above). - The
TypedLocale
(so andIsoLocale
) are now inherited fromBasicLocale
(so andJsonEncodable
), so they can be used in the translations directly. - Added
copyWith
method in inTypedLocale
(so andIsoLocale
). - Added new
internationalName
getter inIsoStandardized
interface, representing the international name of the ISO object. - Added new
UpperCaseMap
class, thatUpperCaseIsoMap
extends, a simple version ofUpperCaseIsoMap
without key length checks andIsoStandardized
values requirement. - The
map
in theRegionalBloc
is nowUpperCaseMap
(with all it's benefits). - Added new
maybeFromAcronym
factory method in theRegionalBloc
. - Added new
BasicLocale
class, thatTranslatedName
extends. Representing a type-safe world locale (language, country/region code and script). - Deprecated
maybeTranslate
andtranslate
methods for translated classes (usemaybeTranslation
andtranslation
instead). - Added new
commonNamesCacheMap
method for all ISO based sealed classes collections, which allows to create a cache map of common names translations for the givenBasicLocale
.
BREAKING CHANGES
Because of the BasicLocale
changes (described above), translation()
and maybeTranslation()
methods on the Translated
classes now require BasicLocale
input. If you are not using those methods directly, then you don't need to change anything, otherwise you will need to do small adjustment - wrap the content of those methods with a BasicLocale
.
Before:
print(iso?.maybeTranslation(LangPor()));
After:
print(iso?.maybeTranslation(BasicLocale(LangPor())));
Or just:
- Enable Regular Expressions in your IDE's Find and Replace panel.
- In the Find field, enter the regex:
(translation\()(.*)(\))
- In the Replace field, enter:
$1BasicLocale($2)$3
- Execute the replace operation.
1.3.1 #
NEW FEATURES
- Use of UX/UI interpretation of Hick's Law for conditionally showing search bar in the SearchableIndexedListViewBuilder - If no
showSearchBar
value specified, it usesPickersThemeData.showHeader
value as before but instead of falling back to default hardcodedfalse
value it fallbacks to items count conditionif (items.length > 5)
. PickersThemeData.showHeader
is now nullable.- Fix thousands separator for CHF.
codeOther
is no longer nullable (in allIsoStandardized
classes).- Added new compile time constant and case-insensitive code maps (
UpperCaseIsoMap
s) in every ISO class (accessible as static constants via.map
,.codeMap
,.codeNumericMap
, etc.). - Factory constructors and methods now using those maps if no (optional) array is provided there.
- Factory constructors and methods in
IsoStandardized
classes now allow non-String inputs - anyObject
, for example you can now useStringBuffer
orEnum
instances directly:
enum IsoEnum {de, fr, ar} // On .fromCode(IsoEnum.de) call it will use "DE" input.
or you can basically use any custom class with toString()
override:
class CustomIsoCodeClass {
const CustomIsoCodeClass({String code = '123', this.foo}) : _code = code;
final String _code;
final Foo? foo;
@override
String toString() => _code; // Has to override toString() with ISO value.
}
// On .fromAnyCode(CustomIsoCodeClass(code: ' 321 ')) call it will use "321" input.
REFACTOR
- Refactored asserts in
maybeMapIsoCode
method. - Fixed typos in CHANGELOG and README.
1.2.0 #
NEW FEATURES
- Added new static
maybeFrom*
methods and refactored old ones. They are also now accept anyObject?
input instead of justString?
. - Added new and refactored old tests with a performance in mind.
- Added new
firstIsoWhere*
extensions on ISO iterables. - Improved annotations.
- Added
is*
boolean getters for all ISO objects, for example:
if (isoObject.isFra) return _onFrench();
is more readable and shorter equivalent of this check:
if (isoObject == const LangFra()) return _onFrench();
1.1.0 #
NEW FEATURES
-
Added new constructor called
permissive
- which allow the creation of custom class instances that are not fully compatible with the ISO standard. -
Translated
class is now sealed - which means you can now directly compare instances of different ISO classes directly (for example in switch statements). -
Added theme extensions that you can specify in your
ThemeData
to provide global theme to your pickers. You can findPickersThemeData
,CountryTileThemeData
,CurrencyTileThemeData
andLanguageTileThemeData
:
MaterialApp(
...
theme: ThemeData(
/// And also [CurrencyTileThemeData], [LanguageTileThemeData], [CountryTileThemeData]...
extensions: const <ThemeExtension>[
PickersThemeData(primary: true), // Specify global pickers theme.
],
)
);
This way you can specify for example that all your pickers lists are primary and define globally use of Twemoji as main flags font emoji family in all Country/Phone pickers in the app.
1.0.0 #
🎉 First anniversary and first stable release!
NEW FEATURES
-
Added new getter for
TranslatedName
name calledcommon
, which might be useful in some cases whenname
is being used by a parent class. -
Added a lot of translations from the Symfony.
-
Currencies translations now support all GlobalMaterialLocalizations and GlobalCupertinoLocalizations locales.
-
Updated LICENSE.
-
Added CLI tool for removing unused emoji font families on the Web platform
dart run world_countries:clean_build [--keep twemoji,notoemoji,openmoji]
-
Added
fromSubtags
constructors forIsoLocale
andTypedLocale
classes. -
Added
defaultLocaleMapResolution
for aTypedLocaleDelegate
that maps:fil
Filipino (Pilipino) totl
Tagalog.gsw
Swiss German Alemannic Alsatian tode_CH
German (Switzerland).bs_Cyrl
Bosnian (written in the Cyrillic script) tosr
Serbian.
BREAKING CHANGES
- Removed code marked as
Deprecated
in previous releases. - Replaced old
FiatCurrency.list
with a newFiatCurrency.listExtended
. - Removed
FiatCurrency.regularList
(please useFiatCurrency.list
instead). - Marked Croatian Kuna as
Deprecated
(currencies). - Moved helpers of world_country package to separate library:
BuildContextExtension
,FunctionalPlatform
,NameTextInput
,ClearButton
andUiConstants
. To migrate just use IDE suggestions or manually replace old references:
import "package:world_countries/world_countries.dart";
to a new one:
import "package:world_countries/helpers.dart";
0.9.0 #
NEW FEATURES
- Added new interface
IsoTranslated
which combinesTranslated
andIsoStandardized
interfaces. - Added
standard*
static constants in theWorldCountry
class referencing different names of the ISO 3166-1 standard. - Added
standard*
static constants in theFiatCurrency
class referencing different names of the ISO 4217 standard. - Improved documentation in README, added FAQ and demo web-site (Flutter WASM).
REFACTORING
- Removed
NavigatorContextExtension
from exports, so you don't need to specify it no longer viahide
.
0.8.0 #
NEW FEATURES
- Added new factories to ISO classes -
fromAnyCode
, which do the length and type checks and redirects to otherfromCode\*
constructors - Added new static methods to ISO classes -
maybeFromAnyCode
, which works same way asfromAnyCode
, but doesn't throwsStateErrors
if no currency object is found. - Added
maybeMapIsoCode
method toString
extensions, which is used under the hood of(maybe)fromAnyCode
. - Added the
TypedLocaleDelegate
class, which can be used in thelocalizationsDelegates
(such as inMaterialApp
). It attempts to convert the string-basedLocale
to a strongly typedTypedLocale
, which is then used in all pickers to provide translations for country/currency/language names. The detected TypedLocale? is also accessible viaTypedLocaleDelegate.maybeOf(context)
or simplycontext.maybeLocale
. - All pickers can have a local translation override via the
translation
parameter (which will be used instead of the TypedLocale translation). - Translated classes now also have translate() and maybeTranslate() methods to translate it's data (country/currency/language names).
REFACTOR
- Slightly changed UI of default picker's tiles - added padding on top of the leading widget and swapped title with subtitle (because of translations provided to title).
- Named classes now has boolean flag (
short
, defaults totrue
). TranslatedName
class by default returns.name
value ontoString()
.- Refactored dollar symbols in
toString()
methods.
BREAKING CHANGE
- Country and phone code pickers now using
TypedLocale
as translation parameter (to migrate just wrap your previous language there withIsoLocale()
).
0.7.0 #
This is a general update that synchronizes underlying Dart package updates (related to translations and interfaces), as a preparation for a bigger upcoming update for localization delegates.
NEW FEATURES
WorldCountry
class now contains way more translations of language name to other languages (79 translations for each language minimum).- Refactored factory constructors - there is an optional parameter to provide custom list.
- Added
regularList
getter for the list of regular currencies (excludes 10 currencies from thespecialPurposeList
). FiatCurrency
class now contains translations of language name to other languages (79 translations for each language minimum).- Those translations are also accessible from the
translation
andmaybeTranslation
methods. - Added
TranslatedName
class for thetranslations
. - Implement new abstract interfaces for currencies:
Named
andTranslated
. - Added a new sealed class called
Script
, based on the ISO 15924 standard. - The
NaturalLanguage
class now contains information about scripts (writing systems) and translations of the language name to other languages.
FIX
- Fixed several English currency names.
0.6.0 #
NEW FEATURES
- New searchSuggestions method in every picker (for use in
suggestionsBuilder
of SearchAnchor) - Added search suggestions for search anchors.
- Added
copyWith
,toJson
etc. to theWorldCountry
,FiatCurrency
,NaturalLanguage
classes. - Added copyWith, toJson etc. to all country-related sub-classes.
- Added new interfaces (
IsoStandardized
,JsonEncodable
) and typedef (JsonMap
) to the model. - Refactoring in existing functional methods (sorting params to match list sorting).
- Translations are now
List<TranslatedName>
instead ofList<CountryName>
, howeverCountryName
is just an extension on top ofTranslatedName
(you can reference to name instead ofcommon
andfullName
instead of official). There will be way more translations provided in upcoming version 0.7.0. - Renaming of extensions to follow the eco-system naming pattern.
REFACTOR
- Added new mixins.
- Improve example and docs.
0.5.0 #
- Factory constructors and static methods for data classes creation now implicitly trimming and comparing uppercase string inputs.
- Fixing old ignores and new linter rules.
- Updates in
dev_dependencies
. - Added new data sealed classes related to world blocs.
- Regional blocs are now part of the world country data.
- Added regional blocs in the example
FIX
- Zimbabwean Dollar (ZWL) is now properly placed as last item in currencies list.
- Timezones for the Netherlands.
DOCUMENTATION
- Added web (Flutter WASM) example of data provided in this package.
BREAKING CHANGES
WorldCountry.list
is now sorted alphabetically by the (3 letter)code
.- Compile time static const. data in lists are now sorted alphabetically by the (3 letter) code.
0.2.2 #
- Renamed BuildContextExtensions > BuildContextExtension
- Added extensions for Locale
REFACTOR
- Updates in
dev_dependencies
.
0.2.1 #
DOCUMENTATION
- Provided structure screenshot.
0.2.0 #
TEST
- Increase code coverage to 96%.
0.1.0 #
DOCUMENTATION
- Provided code coverage links and badge.
0.0.1 #
- Initial release.