dash_flags 0.1.0
dash_flags: ^0.1.0 copied to clipboard
A package for displaying flags of countries and languages with a set of widgets and enums
Dash Flags
π‘ Overview #
A Flutter package for displaying Countries and Languages flags π
This package provides a set of widgets and enums to display flags of countries and languages inspired by blade-flags package for Laravel by Mohamed Ashraf from Egypt.
The package uses flags from TwEmoji Countries & Languages Flags by Twitter
This GIF is taken from the Example Project
π» Usage #
Import the package:
import 'package:dash_flags/dash_flags.dart';
Display a flag of a country:
CountryFlag(
country: Country.eg, // OR Country.fromCode('eg')
height: 50,
)
Display a flag of a language:
LanguageFlag(
language: Language.ar, // OR Language.fromCode('ar')
height: 50,
)
Display a flag of a timezone:
TimezoneFlag(
timezone: Timezone.africa_cairo, // OR Timezone.fromString('Africa/Cairo')
height: 50,
)
π You can checkout the complete API Reference here
π Notes #
Countries & Languages Codes: #
- If you have the
Country CodeorLanguage CodeasStrings, then you can useCountry.fromCode(countryCode)orLanguage.fromCode(languageCode). - If the the
Country CodeorLanguage Codeconsists of more than one part, then you will find it separated by anunderscore, for example:sh_acanden_au. - If the the
Country CodeorLanguage Codeis a reserved keyword in Dart, then you will find it prefixed withc_orl_respectively, for example:c_asandl_as. - If an unknown
Country CodeorLanguage Codeused with.fromCode(String)method, an unknown flag would be displayed.
Timezones Codes: #
- The forward slash sign
/in the name of the timezone is replaced with an underscore_. - If the
Timezonecontains minus-sign, then you will find it replaced with_minus_, for example: US_East_minus_Indiana, US_Indiana_minus_Starke, Asia_Ust_minus_Nera - If the
Timezonecontains plus+sign, then you will find it replaced_plus_, for example: Etc_GMT_plus_0, Etc_GMT_plus_1, Etc_GMT_plus_10 - If the
Timezoneis associated with more than one country, then you will find a default enum member for it and other enum members for each country, for example: Africa_Johannesburg, Africa_Johannesburg_ZA, Africa_Johannesburg_LS, Africa_Johannesburg_SZ - If you have the
TimezoneasStringand you want to get the correspondingTimezoneenum member, then you can use.fromString()method. - If you want to use the
Timezonewith its original name without the above changes, then use.fromString()method, for example: Timezone.fromString('Africa/Cairo')
β Roadmap #
- β Add Tests π§ͺ
- β Add a simple way to use the raw svg assets π¨
- β Make an online Gallery with all the available flags π
- β Add the ability to use the flags from the internet, such as,
CountryFlag.network(...)π - β Add the ability to automatically detect the current
CountryorLanguage, such as,Country.autoDetect&Language.autoDetectπ΅π»ββοΈ
π Laravel Version #
If you are looking for a Laravel Version of this package, check blade-flags, the original parent package of this library which that provides a set of flags for all countries and languages by Mohamed Ashraf from Egypt.
πͺπ» Contribution Guide #
I would be happy to have your contributions π
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an Issue.
If you fixed a bug or implemented a feature, please send a Pull Request.
Made with contrib.rocks.
