flutter_country_utility 3.0.6 copy "flutter_country_utility: ^3.0.6" to clipboard
flutter_country_utility: ^3.0.6 copied to clipboard

Flutter extension function by using country, generated country class by using countries.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_country_utility/flutter_country_utility.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.isoLocalizedShortName(
                        Localizations.localeOf(context))),
                    value: country,
                  ),
              ],
              onChanged: (value) {
                setState(() {
                  country = value;
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
160
points
649
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter extension function by using country, generated country class by using countries.

Homepage
Repository (GitHub)
View/report issues

Topics

#country #countries

Documentation

API reference

License

MIT (license)

Dependencies

collection, country, flutter

More

Packages that depend on flutter_country_utility