https://github.com/moazelsawaf/dash_flags
A Flutter package for displaying Countries and Languages flags ๐
https://github.com/moazelsawaf/dash_flags
flags flutter pub
Last synced: 6 months ago
JSON representation
A Flutter package for displaying Countries and Languages flags ๐
- Host: GitHub
- URL: https://github.com/moazelsawaf/dash_flags
- Owner: moazelsawaf
- License: bsd-3-clause
- Created: 2022-12-13T10:39:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-08T03:01:09.000Z (over 2 years ago)
- Last Synced: 2024-11-16T03:26:42.036Z (about 1 year ago)
- Topics: flags, flutter, pub
- Language: Dart
- Homepage: https://pub.dev/packages/dash_flags
- Size: 14.2 MB
- Stars: 25
- Watchers: 1
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://github.com/MohmmedAshraf/blade-flags) package for Laravel by [Mohamed Ashraf](https://github.com/MohmmedAshraf) from Egypt.
The package uses flags from [TwEmoji Countries & Languages Flags](https://github.com/twitter/twemoji) by Twitter
This GIF is taken from the Example Project
## ๐ป Usage
Import the package:
```dart
import 'package:dash_flags/dash_flags.dart';
```
Display a flag of a country:
```dart
CountryFlag(
country: Country.eg, // OR Country.fromCode('eg')
height: 50,
)
```
Display a flag of a language:
```dart
LanguageFlag(
language: Language.ar, // OR Language.fromCode('ar')
height: 50,
)
```
Display a flag of a timezone:
```dart
TimezoneFlag(
timezone: Timezone.africa_cairo, // OR Timezone.fromString('Africa/Cairo')
height: 50,
)
```
๐ You can checkout the complete API Reference [here](https://pub.dev/documentation/dash_flags/latest/)
## ๐ Notes
### Countries & Languages Codes:
- If you have the `Country Code` or `Language Code` as `Strings`, then you can use `Country.fromCode(countryCode)` or `Language.fromCode(languageCode)`.
- If the the `Country Code` or `Language Code` consists of more than one part, then you will find it separated by an `underscore`, for example: `sh_ac` and `en_au`.
- If the the `Country Code` or `Language Code` is a reserved keyword in Dart, then you will find it prefixed with `c_` or `l_` respectively, for example: `c_as` and `l_as`.
- If an unknown `Country Code` or `Language Code` used 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 `Timezone` contains minus `-` sign, then you will find it replaced with `_minus_`, for example: `US_East_minus_Indiana`, `US_Indiana_minus_Starke`, and `Asia_Ust_minus_Nera`
- If the `Timezone` contains plus `+` sign, then you will find it replaced `_plus_`, for example: `Etc_GMT_plus_0`, `Etc_GMT_plus_1`, and `Etc_GMT_plus_10`
- If the `Timezone` is 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`, and `Africa_Johannesburg_SZ`
- If you have the `Timezone` as `String` and you want to get the corresponding `Timezone` enum member, then you can use `.fromString()` method.
- If you want to use the `Timezone` with 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 `Country` or `Language`, such as, `Country.autoDetect` & `Language.autoDetect` ๐ต๐ปโโ๏ธ
## ๐ Laravel Version
If you are looking for a Laravel Version of this package, check [blade-flags](https://github.com/MohmmedAshraf/blade-flags), the original parent package of this library which that provides a set of flags for all countries and languages by [Mohamed Ashraf](https://github.com/MohmmedAshraf) 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](https://github.com/moazelsawaf/dash_flags/issues).
If you fixed a bug or implemented a feature, please send a [Pull Request](https://github.com/moazelsawaf/dash_flags/pulls).
Made with [contrib.rocks](https://contrib.rocks).