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

retractedoutdated

Generated country class with country_generator using countries.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const CountryExample(),
    );
  }
}

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

  @override
  _CountryExampleState createState() => _CountryExampleState();
}

class _CountryExampleState extends State<CountryExample> {
  Country? country;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Column(
          children: [
            if (country != null) Text(country!.flagEmoji),
            DropdownButtonFormField<Country>(
              items: [
                for (final country in Countries.values)
                  DropdownMenuItem(
                    child: Text(country.isoShortName),
                    value: country,
                  ),
              ],
              onChanged: (value) {
                setState(() {
                  country = value;
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
24
likes
0
points
6.35k
downloads

Publisher

unverified uploader

Weekly Downloads

Generated country class with country_generator using countries.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on country