country code
flutter plugin to pick country with output name, code, dialcode and flag of country.
usage
to use this plugin, add country_list_pick
as a dependency in your pubspec.yaml.
countrylistpick(
// to show or hide flag
isshowflag: true,
// true to show title country
isshowtitle: true,
// true to show code phone country
isshowcode: true,
// to show or hide down icon
isdownicon: true,
// to initial code number countrey
initialselection: '+62',
// to get feedback data from picker
onchanged: (countrycode code) {
// name of country
print(code.name);
// code of country
print(code.code);
// code phone of country
print(code.dialcode);
// path flag of country
print(code.flaguri);
},
),
to call feedback or getting data from this widget, you can make function in onchanged
example
import 'package:country_list_pick/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> {
@override
void initstate() {
super.initstate();
}
@override
widget build(buildcontext context) {
return materialapp(
home: scaffold(
appbar: appbar(
title: const text('country code pick'),
),
body: center(
child: countrylistpick(
isshowflag: true,
isshowtitle: true,
isshowcode: true,
isdownicon: true,
initialselection: '+62',
onchanged: (countrycode code) {
print(code.name);
print(code.code);
print(code.dialcode);
print(code.flaguri);
},
),
),
),
);
}
}
Comments are closed.