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).
Simply add country_flags
to your pubspec.yaml file.
dependencies:
country_flags: ^2.2.0
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,
),
),
),
);
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: CountryFlag.fromLanguageCode('en'),
),
),
);
}
}
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.