arturograu / country_flags

Easy to use library that allows you to render SVG flags of countries and languages
https://pub.dev/packages/country_flags
MIT License
11 stars 19 forks source link

How to show circular flag image? #20

Closed KrishnendraPrakash closed 4 months ago

KrishnendraPrakash commented 1 year ago

How to show circular flag image? As this CountryFlag.fromCountryCode returns ClipRRect .

But image still showing in rectangle form .

Please make a use case where I can show flag image in circle.

vietstone-ng commented 9 months ago

Hi, this is my working code:

        SizedBox(
          width: 24,
          height: 24,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(12),
            child: FittedBox(
              fit: BoxFit.cover,
              child: CountryFlag.fromLanguageCode(
                'fr',
              ),
            ),
          ),
        ),
arturograu commented 4 months ago

I added the ability to show the circular flag here https://github.com/arturograu/country_flags/pull/36.

To do it you can:

CountryFlag.fromCountryCode(
  'ES',
  shape: const Circle(),
);