country_flags 2.0.0 copy "country_flags: ^2.0.0" to clipboard
country_flags: ^2.0.0 copied to clipboard

A Flutter package to show a flag icon from a ISO country code.

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 all the supported languages list here (not all the langauge codes in the list are supported).

Showcase

Installation #

Just add country_flags to your pubspec.yml file

dependencies:
  country_flags: ^1.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 the amazing project flutter-svg

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

Alternatives #

87
likes
0
pub points
98%
popularity

Publisher

verified publisherfluttered.io

A Flutter package to show a flag icon from a ISO country code.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, flutter_svg, intl

More

Packages that depend on country_flags