country_list_pick_with_nation 2.0.3 copy "country_list_pick_with_nation: ^2.0.3" to clipboard
country_list_pick_with_nation: ^2.0.3 copied to clipboard

Flutter plugin project to pick country code, will show code country, dial code, flag country, and name country.

example/lib/main.dart

import 'package:country_list_pick_with_nation/country_list_pick.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final countryStateKey = GlobalKey<CountryListPickState>();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Country Code Pick'),
          backgroundColor: Colors.amber,
        ),
        body: Center(
            child: Column(children: [
          CountryListPick(
            key: countryStateKey,
            appBar: AppBar(
              backgroundColor: Colors.amber,
              title: Text('Pick your country'),
            ),
            // if you need custome picker use this
            // pickerBuilder: (context, CountryCode countryCode) {
            //   return Row(
            //     children: [
            //       Image.asset(
            //         countryCode.flagUri,
            //         package: 'country_list_pick_with_nation',
            //       ),
            //       Text(countryCode.code),
            //       Text(countryCode.dialCode),
            //     ],
            //   );
            // },
            theme: CountryTheme(
                isShowFlag: true,
                isShowTitle: true,
                isShowCode: true,
                isDownIcon: true,
                showEnglishName: false,
                displayAsNationality: true),
            initialSelection: '+62',
            onChanged: (CountryCode code) {
              print(code.name);
              print(code.code);
              print(code.dialCode);
              print(code.flagUri);
            },
          ),
        ])),
      ),
    );
  }
}
2
likes
70
pub points
31%
popularity

Publisher

unverified uploader

Flutter plugin project to pick country code, will show code country, dial code, flag country, and name country.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, google_fonts

More

Packages that depend on country_list_pick_with_nation