Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Remove the inherent padding in the flag icon area and add both a No Country and None selected option for the countries #177

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added flags/--.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added flags/xx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions lib/country_code_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CountryCodePicker extends StatefulWidget {
this.initialSelection,
this.favorite = const [],
this.textStyle,
this.padding = const EdgeInsets.all(8.0),
this.padding = const EdgeInsets.all(80.0),
this.showCountryOnly = false,
this.searchDecoration = const InputDecoration(),
this.searchStyle,
Expand Down Expand Up @@ -163,8 +163,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
child: widget.builder!(selectedItem),
);
else {
_widget = TextButton(
onPressed: widget.enabled ? showCountryCodePickerDialog : null,
_widget = GestureDetector(
onTap: () => widget.enabled ? showCountryCodePickerDialog() : null,
child: Padding(
padding: widget.padding,
child: Flex(
Expand All @@ -183,8 +183,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
: Clip.hardEdge,
decoration: widget.flagDecoration,
margin: widget.alignLeft
? const EdgeInsets.only(right: 16.0, left: 8.0)
: const EdgeInsets.only(right: 16.0),
? EdgeInsets.zero
: EdgeInsets.zero,
child: Image.asset(
selectedItem!.flagUri!,
package: 'country_code_picker',
Expand All @@ -197,8 +197,8 @@ class CountryCodePickerState extends State<CountryCodePicker> {
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
child: Text(
widget.showOnlyCountryWhenClosed
? selectedItem!.toCountryStringOnly()
: selectedItem.toString(),
? ' '+selectedItem!.toCountryStringOnly()
: ' '+selectedItem.toString(),
style:
widget.textStyle ?? Theme.of(context).textTheme.button,
overflow: widget.textOverflow,
Expand Down
10 changes: 10 additions & 0 deletions lib/country_codes.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
const List<Map<String, String>> codes = [
{
"name": "None",
"code": "--",
"dial_code": "",
},
{
"name": "No Country",
"code": "XX",
"dial_code": "+000",
},
{
"name": "افغانستان",
"code": "AF",
Expand Down
4 changes: 3 additions & 1 deletion lib/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"--": "None",
"XX": "No Country",
"AF": "Afghanistan",
"AL": "Albania",
"DZ": "Algeria",
Expand Down Expand Up @@ -266,4 +268,4 @@
"SS": "South Sudan",
"XK": "Kosovo",
"no_country": "No country found"
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
flutter:
sdk: flutter

modal_bottom_sheet: ^2.0.0
modal_bottom_sheet: ^2.0.1
collection: ^1.15.0
universal_platform: ^1.0.0+1

Expand Down