From db7f0afbedaaedd7644bff086b9702f7d356598d Mon Sep 17 00:00:00 2001
From: Rutger Bresjer <rutger@woost.tech>
Date: Thu, 16 Dec 2021 13:16:34 +0100
Subject: [PATCH 1/4] =?UTF-8?q?Removed=20Netherlands=20Antilles,=20added?=
 =?UTF-8?q?=20BES=20&=20Cura=C3=A7ao?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/country_codes.dart | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/country_codes.dart b/lib/country_codes.dart
index 7e7c0823..eb6b1519 100644
--- a/lib/country_codes.dart
+++ b/lib/country_codes.dart
@@ -134,6 +134,11 @@ const List<Map<String, String>> codes = [
     "code": "BO",
     "dial_code": "+591",
   },
+  {
+    "name": "Bonaire, Saint Eustatius and Saba",
+    "code": "BQ",
+    "dial_code": "+599",
+  },
   {
     "name": "Bosna i Hercegovina",
     "code": "BA",
@@ -204,6 +209,11 @@ const List<Map<String, String>> codes = [
     "code": "KY",
     "dial_code": "+1345",
   },
+  {
+    "name": "Curaçao",
+    "code": "CW",
+    "dial_code": "+5999",
+  },
   {
     "name": "Ködörösêse tî Bêafrîka",
     "code": "CF",
@@ -779,11 +789,6 @@ const List<Map<String, String>> codes = [
     "code": "NL",
     "dial_code": "+31",
   },
-  {
-    "name": "Netherlands Antilles",
-    "code": "AN",
-    "dial_code": "+599",
-  },
   {
     "name": "Nouvelle-Calédonie",
     "code": "NC",

From 2aee7d3fb5102b14d482f8b6122331149f9ea92d Mon Sep 17 00:00:00 2001
From: Rutger Bresjer <rutger@woost.tech>
Date: Thu, 16 Dec 2021 13:19:59 +0100
Subject: [PATCH 2/4] Removed obsolete NL Antilles flag

---
 flags/an.png | Bin 650 -> 0 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 flags/an.png

diff --git a/flags/an.png b/flags/an.png
deleted file mode 100644
index 6f5557f743798fd50dfb010d3c5e7d6cde02b926..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 650
zcmV;50(Jd~P)<h;3K|Lk000e1NJLTq002Ay001Wl0{{R3WHZ|s0003dP)t-s|NsB$
zb9UPf6x<gb>vMM84io<V|J)ZG+!!3w+3M5V>%(SwxDzM28ZWpSE;CP@Gf<r`H-jxD
zaxEuxEhlp@D0NXqg#ajp04aw6D~JFnhY&T6gP6vIn8pDrhXE;v04RnLHH?v=$`Lh<
z0xO6KFNy&uh5#yt1}up)Q=J7Yi84{1Q*5jeG>rl)hXE^x1uTdFDTW6uh<S{@vAo$S
zN0$I6g#aptDMptADTZNqvxb($AV8BBJCPnglL{}23NVTnJCFh@hXE*u9Y2#oUZfH>
zjRPr%T5zthz1lWXo&hI@04IhuQl46HuT*ZXps&+0Ql2tWo}sYQRBo>=BXLDLe^*I|
zIx>1KCUaOxheSJn#AkWA6DGMDF1Q&jxf?FJ8ZJuv7mEM@0Ut?3K~#7F?9<a?<zO5|
z@wMZOZTo5-W?p`5yKWD6zts3w*X{2hTyaE9602+z%Gj5~93RCZR%pzs%tJz|2n|$%
zj0^*pgwzsI0tf?6h!oY%v7|2CC2j~wpk!==O&r%@YLZMsqcMpb#!*^I3qUR5VjgJh
zf%g^bxTKz8{*3ShpxQq1e|xQ4Y;|6pA0$`#PI4t1+WxzrSl1-Iu36W6X#1P@^LYAO
zp63m;bh<%P<aN+SG54z<@7>a#Cpn)+oc+k|Lv+}&Gnb?nz!Uq|1hM=yp{p0uv0u(-
zo)$E1IYX%E5&C$ckOrTitTg&);&_3GbWBpy=cF^KXCLUTdZxueGuD3)SofdQ{ET4#
kXQe?&GFs8mR`aN40GT^%g&NMst^fc407*qoM6N<$f~eOIEdT%j


From 060c7b4dee100c8ba885cf61d6502a56be1a634f Mon Sep 17 00:00:00 2001
From: Rutger Bresjer <rutger@woost.tech>
Date: Thu, 16 Dec 2021 14:01:00 +0100
Subject: [PATCH 3/4] Fix for clean names

---
 lib/country_code.dart          | 10 ++--------
 lib/country_localizations.dart |  8 +++++++-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/country_code.dart b/lib/country_code.dart
index 3d1a6b47..9fa23322 100644
--- a/lib/country_code.dart
+++ b/lib/country_code.dart
@@ -56,7 +56,7 @@ class CountryCode {
 
   factory CountryCode.fromJson(Map<String, dynamic> json) {
     return CountryCode(
-      name: json['name'],
+      name: json['name'] is List ? json['name'].first : json['name'],
       code: json['code'],
       dialCode: json['dial_code'],
       flagUri: 'flags/${json['code'].toLowerCase()}.png',
@@ -68,11 +68,5 @@ class CountryCode {
 
   String toLongString() => "$dialCode ${toCountryStringOnly()}";
 
-  String toCountryStringOnly() {
-    return '$_cleanName';
-  }
-
-  String? get _cleanName {
-    return name?.replaceAll(RegExp(r'[[\]]'), '').split(',').first;
-  }
+  String toCountryStringOnly() => name ?? '';
 }
diff --git a/lib/country_localizations.dart b/lib/country_localizations.dart
index 3020f78e..6d7ad7f9 100644
--- a/lib/country_localizations.dart
+++ b/lib/country_localizations.dart
@@ -26,7 +26,13 @@ class CountryLocalizations {
     Map<String, dynamic> jsonMap = json.decode(jsonString);
 
     _localizedStrings = jsonMap.map((key, value) {
-      return MapEntry(key, value.toString());
+      if (value is String) {
+        return MapEntry(key, value);
+      } else if (value is List) {
+        return MapEntry(key, value.first.toString());
+      } else {
+        return MapEntry(key, value.toString());
+      }
     });
 
     return true;

From 929a9080673728074856a805cea738f394018bb9 Mon Sep 17 00:00:00 2001
From: Rutger Bresjer <rutger@woost.tech>
Date: Wed, 20 Apr 2022 11:59:06 +0200
Subject: [PATCH 4/4] Allow using root navigator for displaying the dialog

---
 lib/country_code_picker.dart | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart
index c979e12b..5d941523 100644
--- a/lib/country_code_picker.dart
+++ b/lib/country_code_picker.dart
@@ -49,6 +49,9 @@ class CountryCodePicker extends StatefulWidget {
   /// shows the name of the country instead of the dialcode
   final bool showOnlyCountryWhenClosed;
 
+  /// whether to show the dialog using the root navigator
+  final bool useRootNavigator;
+
   /// aligns the flag and the Text left
   ///
   /// additionally this option also fills the available space of the widget.
@@ -97,6 +100,7 @@ class CountryCodePicker extends StatefulWidget {
     this.dialogTextStyle,
     this.emptySearchBuilder,
     this.showOnlyCountryWhenClosed = false,
+    this.useRootNavigator = false,
     this.alignLeft = false,
     this.showFlag = true,
     this.showFlagDialog,
@@ -327,6 +331,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
       showMaterialModalBottomSheet(
         barrierColor: widget.barrierColor ?? Colors.grey.withOpacity(0.5),
         backgroundColor: widget.backgroundColor ?? Colors.transparent,
+        useRootNavigator: widget.useRootNavigator,
         context: context,
         builder: (context) => Center(
           child: SelectionDialog(