diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd7e365..bf3852d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 2.0.0
+
+- support 70 languages
+- use modal_bottom_sheet 2.0.0
+- nullable integration
+
## 1.7.0
- Update modal_bottom_sheet to 1.0.0+1
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 1d526a1..919434a 100644
--- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
+ location = "self:">
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 2094ab7..1e511d3 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -15,14 +15,76 @@ class _MyAppState extends State {
Widget build(BuildContext context) {
return new MaterialApp(
supportedLocales: [
- Locale('en'),
- Locale('it'),
- Locale('fr'),
- Locale('es'),
- Locale('de'),
- Locale('pt'),
- Locale('ko'),
- Locale('zh'),
+ 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: [
CountryLocalizations.delegate,
diff --git a/lib/country_code.dart b/lib/country_code.dart
index 627b0c6..7bd3fa0 100644
--- a/lib/country_code.dart
+++ b/lib/country_code.dart
@@ -1,3 +1,4 @@
+import 'package:collection/collection.dart' show IterableExtension;
import 'package:country_code_picker/country_codes.dart';
import 'package:country_code_picker/country_localizations.dart';
import 'package:flutter/cupertino.dart';
@@ -10,16 +11,16 @@ class CElement = CountryCode with ToAlias;
/// Country element. This is the element that contains all the information
class CountryCode {
/// the name of the country
- String name;
+ String? name;
/// the flag of the country
- final String flagUri;
+ final String? flagUri;
/// the country code (IT,AF..)
- final String code;
+ final String? code;
/// the dial code (+39,+93..)
- final String dialCode;
+ final String? dialCode;
CountryCode({
this.name,
@@ -29,16 +30,10 @@ class CountryCode {
});
factory CountryCode.fromCode(String isoCode) {
- final Map jsonCode = codes.firstWhere(
+ final Map? jsonCode = codes.firstWhereOrNull(
(code) => code['code'] == isoCode,
- orElse: () => null,
);
-
- if (jsonCode == null) {
- return null;
- }
-
- return CountryCode.fromJson(jsonCode);
+ return CountryCode.fromJson(jsonCode!);
}
CountryCode localize(BuildContext context) {
diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart
index c20b6d2..f3f1b2c 100644
--- a/lib/country_code_picker.dart
+++ b/lib/country_code_picker.dart
@@ -1,5 +1,6 @@
library country_code_picker;
+import 'package:collection/collection.dart' show IterableExtension;
import 'package:country_code_picker/country_code.dart';
import 'package:country_code_picker/country_codes.dart';
import 'package:country_code_picker/selection_dialog.dart';
@@ -9,39 +10,39 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
export 'country_code.dart';
class CountryCodePicker extends StatefulWidget {
- final ValueChanged onChanged;
- final ValueChanged onInit;
- final String initialSelection;
+ final ValueChanged? onChanged;
+ final ValueChanged? onInit;
+ final String? initialSelection;
final List favorite;
- final TextStyle textStyle;
+ final TextStyle? textStyle;
final EdgeInsetsGeometry padding;
final bool showCountryOnly;
final InputDecoration searchDecoration;
- final TextStyle searchStyle;
- final TextStyle dialogTextStyle;
- final WidgetBuilder emptySearchBuilder;
- final Function(CountryCode) builder;
+ final TextStyle? searchStyle;
+ final TextStyle? dialogTextStyle;
+ final WidgetBuilder? emptySearchBuilder;
+ final Function(CountryCode?)? builder;
final bool enabled;
final TextOverflow textOverflow;
final Icon closeIcon;
/// Barrier color of ModalBottomSheet
- final Color barrierColor;
+ final Color? barrierColor;
/// Background color of ModalBottomSheet
- final Color backgroundColor;
+ final Color? backgroundColor;
/// BoxDecoration for dialog
- final BoxDecoration boxDecoration;
+ final BoxDecoration? boxDecoration;
/// the size of the selection dialog
- final Size dialogSize;
+ final Size? dialogSize;
/// Background color of selection dialog
- final Color dialogBackgroundColor;
+ final Color? dialogBackgroundColor;
/// used to customize the country list
- final List countryFilter;
+ final List? countryFilter;
/// shows the name of the country instead of the dialcode
final bool showOnlyCountryWhenClosed;
@@ -58,15 +59,15 @@ class CountryCodePicker extends StatefulWidget {
final bool hideMainText;
- final bool showFlagMain;
+ final bool? showFlagMain;
- final bool showFlagDialog;
+ final bool? showFlagDialog;
/// Width of the flag images
final double flagWidth;
/// Use this property to change the order of the options
- final Comparator comparator;
+ final Comparator? comparator;
/// Set to true if you want to hide the search part
final bool hideSearch;
@@ -106,7 +107,7 @@ class CountryCodePicker extends StatefulWidget {
this.dialogSize,
this.dialogBackgroundColor,
this.closeIcon = const Icon(Icons.close),
- Key key,
+ Key? key,
}) : super(key: key);
@override
@@ -114,15 +115,15 @@ class CountryCodePicker extends StatefulWidget {
List