1.3.0
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:country_code_picker/country_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
||||
void main() => runApp(new MyApp());
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
@override
|
||||
@@ -17,54 +19,67 @@ class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: const Text('CountryPicker Example'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
CountryCodePicker(
|
||||
onChanged: print,
|
||||
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
|
||||
initialSelection: 'IT',
|
||||
favorite: ['+39', 'FR'],
|
||||
//Get the country information relevant to the initial selection
|
||||
onInit: (code) => print("${code.name} ${code.dialCode}"),
|
||||
),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CountryCodePicker(
|
||||
onChanged: print,
|
||||
initialSelection: 'TF',
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
alignLeft: true,
|
||||
builder: (countryCode) {
|
||||
return Text('${countryCode.code}');
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CountryCodePicker(
|
||||
onChanged: print,
|
||||
initialSelection: 'TF',
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
favorite: ['+39', 'FR']),
|
||||
),
|
||||
),
|
||||
],
|
||||
supportedLocales: [
|
||||
Locale('en'),
|
||||
Locale('it'),
|
||||
Locale('en'),
|
||||
],
|
||||
localizationsDelegates: [
|
||||
CountryLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: const Text('CountryPicker Example'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
CountryCodePicker(
|
||||
onChanged: print,
|
||||
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
|
||||
initialSelection: 'IT',
|
||||
favorite: ['+39', 'FR'],
|
||||
//Get the country information relevant to the initial selection
|
||||
onInit: (code) => print("${code.name} ${code.dialCode}"),
|
||||
),
|
||||
)));
|
||||
SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CountryCodePicker(
|
||||
onChanged: print,
|
||||
initialSelection: 'TF',
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
alignLeft: true,
|
||||
builder: (countryCode) {
|
||||
return Text('${countryCode.code}');
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CountryCodePicker(
|
||||
onChanged: print,
|
||||
initialSelection: 'TF',
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
favorite: ['+39', 'FR'],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user