Skip to content

Easy to use library that allows you to render SVG flags of countries and languages

License

Notifications You must be signed in to change notification settings

MilosKarakas/country_flags

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Country Flags

Pub GitHub Workflow Status (with branch) Pull Requests are welcome codecov Null safety

A Flutter package to show a SVG image of the flag of a country.

The flag can be created from a country code or a language code.

This package includes the SVG flags from the project flag-icons and fixes the rendering problems of the flags from this list:

  • ar
  • aw
  • ky
  • gd
  • ht
  • je
  • kr
  • pe
  • rs
  • lk
  • tc
  • fk

You can find all the supported countries list here.

You can find the supported languages list in www.lingoes.net/en/translator/langcode.htm (not all the langauge codes in the list are supported).

Showcase

Installation

Just add country_flags to your pubspec.yml file

dependencies:
  country_flags: ^2.1.0

Usage

Create a flag from a country code

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: CountryFlag.fromCountryCode(
            'ES',
            height: 48,
            width: 62,
            borderRadius: 8,
          ),
        ),
      ),
    );
  }
}

Create a flag from a language code

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: CountryFlag.fromLanguageCode('en'),
        ),
      ),
    );
  }
}

Credits

Thanks to jovial_svg which is used to render the SVG images from binary files. And many thanks to bgoncharuck for doing the implementation.

Thanks to the project flag-icons for providing with the required SVG flags.

Alternatives

About

Easy to use library that allows you to render SVG flags of countries and languages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 88.1%
  • HTML 9.1%
  • Swift 2.0%
  • Other 0.8%