forked from imtoori/CountryCodePicker
-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathmain.dart
More file actions
157 lines (141 loc) · 4.13 KB
/
main.dart
File metadata and controls
157 lines (141 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import 'package:country_code_picker/country_code_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
supportedLocales: const [
Locale("af"),
Locale("am"),
Locale("ar"),
Locale("az"),
Locale("be"),
Locale("bg"),
Locale("bn"),
Locale("bs"),
Locale("ca"),
Locale("cs"),
Locale("da"),
Locale("de"),
Locale("el"),
Locale("en"),
Locale("es"),
Locale("et"),
Locale("fa"),
Locale("fi"),
Locale("fr"),
Locale("gl"),
Locale("ha"),
Locale("he"),
Locale("hi"),
Locale("hr"),
Locale("hu"),
Locale("hy"),
Locale("id"),
Locale("is"),
Locale("it"),
Locale("ja"),
Locale("ka"),
Locale("kk"),
Locale("km"),
Locale("ko"),
Locale("ku"),
Locale("ky"),
Locale("lt"),
Locale("lv"),
Locale("mk"),
Locale("ml"),
Locale("mn"),
Locale("ms"),
Locale("nb"),
Locale("nl"),
Locale("nn"),
Locale("no"),
Locale("pl"),
Locale("ps"),
Locale("pt"),
Locale("ro"),
Locale("ru"),
Locale("sd"),
Locale("sk"),
Locale("sl"),
Locale("so"),
Locale("sq"),
Locale("sr"),
Locale("sv"),
Locale("ta"),
Locale("tg"),
Locale("th"),
Locale("tk"),
Locale("tr"),
Locale("tt"),
Locale("uk"),
Locale("ug"),
Locale("ur"),
Locale("uz"),
Locale("vi"),
Locale("zh")
],
localizationsDelegates: const [
CountryLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
home: Scaffold(
backgroundColor: Colors.red,
appBar: AppBar(
title: const Text('CountryPicker Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
CountryCodePicker(
showCodeOnly: false,
withoutBottomSheetheight: 0.80 ,
boxDecoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: Colors.red,
// Border color
width: 2.0, // Border width
), ),
showBottomSheetheight: 0.80,
txtFieldHintTxt: "البحث",
clickableFilepicker:true,
hideLineAbovFiled:false ,
textDirection: TextDirection.rtl,
flagDecoration:BoxDecoration(
color: Colors.white.withOpacity(0.7),
shape: BoxShape.circle, // Make the container circular
border: Border.all(color: Colors.grey)),
textStyle:TextStyle(color: Colors.black , fontWeight: FontWeight.bold , fontSize: 13),
/*flagDecoration:BoxDecoration(
color: Colors.white.withOpacity(0.7),
shape: BoxShape.circle, // Make the container circular
border: Border.all(color: Colors.grey),
),*/
onChanged: (value) {
// Handle country code change
print(value);
},
// Initial selection and favorite country
initialSelection: 'SA',
// Add Saudi Arabia to the favorites
favorite: ['+966', 'SA'],
),
],
),
),
),
);
}
}