Upgrade follow latest

This commit is contained in:
Chandra Abdul Fattah
2023-03-07 22:11:56 +07:00
parent a4b2fe3179
commit 370c56908c
161 changed files with 1903 additions and 431 deletions

View File

@@ -1,20 +1,21 @@
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(MyApp());
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({Key key}) : super(key: key);
@override
_MyAppState createState() => new _MyAppState();
MyAppState createState() => MyAppState();
}
class _MyAppState extends State<MyApp> {
class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
supportedLocales: [
return MaterialApp(
supportedLocales: const [
Locale("af"),
Locale("am"),
Locale("ar"),
@@ -86,13 +87,13 @@ class _MyAppState extends State<MyApp> {
Locale("vi"),
Locale("zh")
],
localizationsDelegates: [
localizationsDelegates: const [
CountryLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
home: new Scaffold(
appBar: new AppBar(
home: Scaffold(
appBar: AppBar(
title: const Text('CountryPicker Example'),
),
body: Center(
@@ -103,26 +104,26 @@ class _MyAppState extends State<MyApp> {
onChanged: print,
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
initialSelection: 'IT',
favorite: ['+39', 'FR'],
countryFilter: ['IT', 'FR'],
favorite: const ['+39', 'FR'],
countryFilter: const ['IT', 'FR'],
showFlagDialog: false,
comparator: (a, b) => b.name.compareTo(a.name),
//Get the country information relevant to the initial selection
onInit: (code) =>
print("on init ${code.name} ${code.dialCode} ${code.name}"),
onInit: (code) => debugPrint(
"on init ${code.name} ${code.dialCode} ${code.name}"),
),
CountryCodePicker(
onChanged: print,
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
initialSelection: 'IT',
favorite: ['+39', 'FR'],
countryFilter: ['IT', 'FR'],
favorite: const ['+39', 'FR'],
countryFilter: const ['IT', 'FR'],
// flag can be styled with BoxDecoration's `borderRadius` and `shape` fields
flagDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
),
),
SizedBox(
const SizedBox(
width: 400,
height: 60,
child: CountryCodePicker(
@@ -141,11 +142,11 @@ class _MyAppState extends State<MyApp> {
width: 400,
height: 60,
child: CountryCodePicker(
onChanged: (e) => print(e.toLongString()),
onChanged: (element) => debugPrint(element.toLongString()),
initialSelection: 'TF',
showCountryOnly: true,
showOnlyCountryWhenClosed: true,
favorite: ['+39', 'FR'],
favorite: const ['+39', 'FR'],
),
),
SizedBox(
@@ -157,7 +158,7 @@ class _MyAppState extends State<MyApp> {
initialSelection: 'TF',
showCountryOnly: true,
showOnlyCountryWhenClosed: true,
favorite: ['+39', 'FR'],
favorite: const ['+39', 'FR'],
),
),
],