country_flag_widget 0.0.3 copy "country_flag_widget: ^0.0.3" to clipboard
country_flag_widget: ^0.0.3 copied to clipboard

A Flutter package to display country flags based on country names.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:country_flag_widget/country_flag_widget.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    // Fetch all country flags once when the app starts
    CountryFlagManager().fetchAllCountryFlags();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Country Flag Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Country Flag Example'),
        ),
        body: const Center(
          child: Column(
            children: [
              // Replace "Pakistan" with the desired country name
            CountryFlagWidget(
              countryName: 'Pakistan',
              width: 200,
              height: 120,
            ),
            SizedBox(height: 20),
            CountryFlagWidget(
              countryName: 'India',
              width: 200,
              height: 120,
            ),
            SizedBox(height: 20),
            CountryFlagWidget(
              countryName: 'United States',
              width: 200,
              height: 120,
            ),
            // Add more flags as needed
            ],
          ),
        ),
      ),
    );
  }
}
13
likes
0
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to display country flags based on country names.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http

More

Packages that depend on country_flag_widget