pick_country 1.0.0 copy "pick_country: ^1.0.0" to clipboard
pick_country: ^1.0.0 copied to clipboard

A simple Flutter package to display a country picker with flag emojis, either in a dialog or a draggable bottom sheet. It includes a search feature for easy filtering.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Pick Country',
        debugShowCheckedModeBanner: false,
        home: CountryExampleScreen());
  }
}

class CountryExampleScreen extends StatefulWidget {
  const CountryExampleScreen({super.key});

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

class CountryExampleScreenState extends State<CountryExampleScreen> {
  String? countryNameBySheet;
  String? countryNameByDialog;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              //Country Sheet--->>
              ElevatedButton.icon(
                onPressed: () async {
                  final result = await PickCountry.sheet(context);
                  if (result != null) {
                    setState(() => countryNameBySheet = result);
                  }
                },
                icon: const Icon(Icons.public),
                label: Text(countryNameBySheet ?? 'Tap from sheet'),
              ),

              SizedBox(
                height: 20,
              ),
              //Country Dialog--->>
              ElevatedButton.icon(
                onPressed: () async {
                  final result = await PickCountry.dialog(context);
                  if (result != null) {
                    setState(() => countryNameByDialog = result);
                  }
                },
                icon: const Icon(Icons.public),
                label: Text(countryNameByDialog ?? 'Tap from dialog'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
160
points
19
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple Flutter package to display a country picker with flag emojis, either in a dialog or a draggable bottom sheet. It includes a search feature for easy filtering.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on pick_country