Viewing version 7.0.0. Open the latest package page.
circle_flags
7.0.0A collection of round flags
Readme
circle_flags
A collection of circular country flags.
Demo
to view all flags https://hatscripts.github.io/circle-flags/gallery
Usage
// use a valid country code
CircleFlag('us');
CircleFlag('fr');
CircleFlag(Flag.US);
Preloading
You might want to preload images for a smoother list scrolling experience:
CircleFlag.preload(['fr', 'us']);
// or await it to know when the flags are ready to be painted
await CircleFlag.preload(Flag.values);
Flags are read from the DefaultAssetBundle of the given context, or from
rootBundle when there is none. To preload from a bundle of your own, pass it:
await CircleFlag.preload(['fr', 'us'], assetBundle: myAssetBundle);
Iso codes are case insensitive, 'us', 'US' and Flag.US all show the same
flag.
Overwriting or adding custom flags
Some users have expressed their need to change some flags due to political reasons, or stylistic reasons. You might also wish to add your own flags. To do so refer to this issue: https://github.com/cedvdb/phone_form_field/issues/222
Contributing & issues
Bugs and feature requests go to https://github.com/cedvdb/flutter_circle_flags/issues, see CONTRIBUTING.md for how to set up the project, run the checks and release.
Flags live in assets/svg/, one <code>.svg file per flag; that directory is
the source of truth and lib/src/flag.dart is generated from it. Never edit
lib/src/flag.dart by hand, instead add or change the asset and run:
dart run tool/generate_flag.dart
Changelog
[7.0.0]
- [Breaking] removed the public
CircleFlag.cachefield, preloading goes throughCircleFlag.preloadinstead.CircleFlag.preloadis now typedFuture<void>(it was untyped) and accepts an optionalcontext/assetBundleto preload from another asset bundle - iso codes are now case insensitive,
CircleFlag('US')shows the same flag asCircleFlag('us')andCircleFlag.preload(['US'])preloads that same flag - added
excludeFromSemanticsandsemanticsLabeloptions - the "?" fallback of unknown flags no longer relies on
Future.catchError, which never completes inside the fake async zone of widget tests - a flag is cached under a package namespaced svg cache key, so the decoded flag can not collide with the svg cache key of another loader
- added analysis_options.yaml and extended the test suite
- moved the flag generator to
tool/generate_flag.dart(pub layout convention) - the flag generator now refuses flag file names that can not be exposed as a
Flagconstant, see CONTRIBUTING.md - added CONTRIBUTING.md, it documents how flags are added and regenerated
- the
assets/svg_hatscriptsworking copy is no longer published, seeassets/.pubignore - removed the unused
build_runnerdev dependency
[6.0.0]
- upgrade to material_ui
[5.0.1]
- Fix for build runner issue
[5.0.0]
- Use latest files from hatscripts
- Remove unnecessary files
- Add note in readme on how to add your own flags
- [Breaking] renamed Flags in Flag
[4.0.2]
- Exclude from semantics
[4.0.1]
- Accept iterable in preloading method
[4.0.0]
- [Breaking] Use
CircleFlag.preload([isoCode])to preload a flag. FlagCache is no longer exported.
[3.0.1]
- made it easier to use cache, some breaking changes to just introduced cache api (doesn't warrant upgrade due to it just being introduced)
[3.0.0]
- unknown flags display "?"
- revert to assets with preloading mechanism
- allow usage of other asset bundles
[2.0.9]
- recreate loader when iso code changes
[2.0.8]
- Change just introduced caching api
[2.0.7]
- Fix issue with network flags not correctly loaded
- improve caching
[2.0.0]
- use network image to reduce size
- added ability to preload images
[1.0.4]
- increase
package:flutter_svgversion - fix redering issue on some platforms
[1.0.3]
- (Re)-added netherlands antilla's flag
[1.0.2]
- add clipOval around flag for better rendering of svgs on the web
[1.0.1]
- use sensible defaults for svgs placeholders
[1.0.0]
- use svg for smaller memory footprint
[0.0.3]
- added 3 missing flags
[0.0.2]
- fix casing problems in country code
[0.0.1] - 22/03/2021
- initial release
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'circle_flags:7.0.0'pubspec.yaml
name: circle_flags
description: A collection of round flags
version: 7.0.0
repository: https://github.com/cedvdb/flutter_circle_flags
issue_tracker: https://github.com/cedvdb/flutter_circle_flags/issues
topics:
- flags
- country-flags
- svg
environment:
sdk: ">=3.13.0 <4.0.0"
flutter: ">=3.47.0"
dependencies:
flutter:
sdk: flutter
flutter_svg: ^2.3.0
material_ui: ^1.4.0
dev_dependencies:
flutter_lints: ^6.0.0
flutter_test:
sdk: flutter
path: any
flutter:
assets:
- assets/svg/
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1 | On demand | Download | f99fb4f3…dd2b9f |
| 0.0.2 | On demand | Download | 911bc175…13fe05 |
| 0.0.3 | On demand | Download | d83ec86d…f9c20d |
| 1.0.0 | On demand | Download | 33298561…ab6824 |
| 1.0.1 | On demand | Download | 58713d68…7dca23 |
| 1.0.2 | On demand | Download | 4ac9eb7f…c49552 |
| 1.0.3 | On demand | Download | 96ab4c2c…c079f2 |
| 1.0.4 | On demand | Download | 87102c61…c95924 |
| 2.0.0 | On demand | Download | 9e4a2c62…4e3fc6 |
| 2.0.6 | On demand | Download | b941f84f…ed8f47 |
| 2.0.7 | On demand | Download | 547b252f…488a24 |
| 2.0.8 | On demand | Download | 6995cce5…68b7af |
| 2.0.9 | On demand | Download | 793f94a7…798715 |
| 3.0.0 | On demand | Download | 90fe37fc…4f95e1 |
| 3.0.1 | On demand | Download | cac0fe72…b47ac4 |
| 4.0.0 | On demand | Download | bf798dd8…256611 |
| 4.0.1 | On demand | Download | 61bccd6a…55bbae |
| 4.0.2 | On demand | Download | 028d5ca1…af2daa |
| 5.0.0 | On demand | Download | 875cd64e…fb2f52 |
| 5.0.1 | On demand | Download | 22268452…34c181 |
| 6.0.0 | On demand | Download | 836bcf32…db4930 |
| 7.0.0 | Cached · Upstream SHA-256 matched | Download | aa4adae6…d05b75 |
Dependencies
flutter {
"sdk": "flutter"
}
flutter_svg "^2.3.0"
material_ui "^1.4.0"