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

adigladi/country_flags

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Country Flags

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

A Flutter package for displaying the SVG image of a country's flag.

The flag can be generated using either a country code or a language code.

View the complete list of supported countries here.

For a list of supported languages, visit www.lingoes.net/en/translator/langcode.htm (please note that not all language codes on the list are supported).

Showcase

Installation

Simply add country_flags to your pubspec.yaml file.

dependencies:
  country_flags: ^2.2.0

Usage

Create a flag using 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

Special thanks to jovial_svg which is utilized to render the SVG images from binary files. Many thanks to bgoncharuck for the implementation.

Acknowledgments to the flag-icons project for providing the necessary 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 89.0%
  • HTML 8.3%
  • Swift 1.9%
  • Other 0.8%