diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 2b5c865..7648d98 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"libphonenumber","dependencies":[]}]} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"libphonenumber","path":"C:\\\\Users\\\\xuanh\\\\Documents\\\\development\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\libphonenumber-1.0.1\\\\","dependencies":[]}],"android":[{"name":"libphonenumber","path":"C:\\\\Users\\\\xuanh\\\\Documents\\\\development\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\libphonenumber-1.0.1\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"libphonenumber","dependencies":[]}],"date_created":"2020-11-01 17:55:17.452964","version":"1.22.1"} \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 594ac20..902b3e9 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,10 +1,15 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/ordgen/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/ordgen/code/android/flutter-international-phone-input/example" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_ROOT=C:\Users\xuanh\Documents\development\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\xuanh\Documents\development\flutter-international-phone-input\example" +export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/ordgen/flutter/bin/cache/artifacts/engine/ios" +export "SYMROOT=${SOURCE_ROOT}/../build\ios" +export "OTHER_LDFLAGS=$(inherited) -framework Flutter" +export "FLUTTER_FRAMEWORK_DIR=C:\Users\xuanh\Documents\development\flutter\bin\cache\artifacts\engine\ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/pubspec.lock b/example/pubspec.lock index 4a3017e..3c825c6 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.39.7" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" args: dependency: transitive description: @@ -35,14 +28,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0-nullsafety.1" built_collection: dependency: transitive description: @@ -57,20 +50,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0-nullsafety.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -106,6 +113,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" fixnum: dependency: transitive description: @@ -158,13 +172,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" international_phone_input: dependency: "direct main" description: @@ -187,7 +194,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3-nullsafety.2" libphonenumber: dependency: transitive description: @@ -208,14 +215,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -223,13 +230,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.6+3" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" node_interop: dependency: transitive description: @@ -271,28 +271,21 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" + version: "1.10.0-nullsafety.2" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0-nullsafety.2" pub_semver: dependency: transitive description: @@ -346,84 +339,84 @@ packages: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "2.1.0-nullsafety.3" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.9" + version: "0.10.10-nullsafety.2" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test: dependency: transitive description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.9.4" + version: "1.16.0-nullsafety.5" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.19-nullsafety.2" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.3.12-nullsafety.5" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" vm_service: dependency: transitive description: @@ -445,13 +438,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - xml: + webkit_inspection_protocol: dependency: transitive description: - name: xml + name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "0.7.3" yaml: dependency: transitive description: @@ -460,4 +453,4 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" diff --git a/lib/src/international_phone_input.dart b/lib/src/international_phone_input.dart index 31f20a7..fd50816 100644 --- a/lib/src/international_phone_input.dart +++ b/lib/src/international_phone_input.dart @@ -20,6 +20,7 @@ class InternationalPhoneInput extends StatefulWidget { final TextStyle errorStyle; final TextStyle hintStyle; final TextStyle labelStyle; + final TextStyle style; final int errorMaxLines; final List enabledCountries; final InputDecoration decoration; @@ -27,6 +28,8 @@ class InternationalPhoneInput extends StatefulWidget { final bool showCountryFlags; final Widget dropdownIcon; final InputBorder border; + final TextStyle countryCodeStyle; + final EdgeInsets scrollPadding; InternationalPhoneInput( {this.onPhoneNumberChange, @@ -38,13 +41,15 @@ class InternationalPhoneInput extends StatefulWidget { this.errorStyle, this.hintStyle, this.labelStyle, + this.style, this.enabledCountries = const [], this.errorMaxLines, this.decoration, this.showCountryCodes = true, this.showCountryFlags = true, this.dropdownIcon, - this.border}); + this.border, + this.countryCodeStyle, this.scrollPadding}); static Future internationalizeNumber(String number, String iso) { return PhoneService.getNormalizedPhoneNumber(number, iso); @@ -66,9 +71,9 @@ class _InternationalPhoneInputState extends State { TextStyle errorStyle; TextStyle hintStyle; TextStyle labelStyle; - + TextStyle countryCodeStyle; int errorMaxLines; - + TextStyle style; bool hasError = false; bool showCountryCodes; bool showCountryFlags; @@ -76,6 +81,7 @@ class _InternationalPhoneInputState extends State { InputDecoration decoration; Widget dropdownIcon; InputBorder border; + EdgeInsets scrollPadding; _InternationalPhoneInputState(); @@ -89,15 +95,16 @@ class _InternationalPhoneInputState extends State { errorStyle = widget.errorStyle; hintStyle = widget.hintStyle; labelStyle = widget.labelStyle; + style = widget.style; errorMaxLines = widget.errorMaxLines; decoration = widget.decoration; showCountryCodes = widget.showCountryCodes; showCountryFlags = widget.showCountryFlags; dropdownIcon = widget.dropdownIcon; - + countryCodeStyle = widget.countryCodeStyle; phoneTextController.addListener(_validatePhoneNumber); phoneTextController.text = widget.initialPhoneNumber; - + scrollPadding = widget.scrollPadding; _fetchCountryData().then((list) { Country preSelectedItem; @@ -212,8 +219,8 @@ class _InternationalPhoneInputState extends State { ) ], if (showCountryCodes) ...[ - SizedBox(width: 4), - Text(value.dialCode) + SizedBox(width: 9), + Text(value.dialCode, style: countryCodeStyle,) ] ], ), @@ -225,6 +232,8 @@ class _InternationalPhoneInputState extends State { ), Flexible( child: TextField( + style: style, + scrollPadding: scrollPadding, keyboardType: TextInputType.phone, controller: phoneTextController, decoration: decoration ?? diff --git a/pubspec.lock b/pubspec.lock index f787941..6c01c30 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.39.6" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" args: dependency: transitive description: @@ -35,14 +28,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0-nullsafety.1" built_collection: dependency: transitive description: @@ -57,20 +50,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.0.9" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0-nullsafety.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -99,6 +106,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.1" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" fixnum: dependency: transitive description: @@ -151,13 +165,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" io: dependency: transitive description: @@ -171,7 +178,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3-nullsafety.2" libphonenumber: dependency: "direct main" description: @@ -192,14 +199,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -207,13 +214,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.6+3" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" node_interop: dependency: transitive description: @@ -255,28 +255,21 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" + version: "1.10.0-nullsafety.2" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.0-nullsafety.2" pub_semver: dependency: transitive description: @@ -330,84 +323,84 @@ packages: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "2.1.0-nullsafety.3" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.9" + version: "0.10.10-nullsafety.2" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.9.4" + version: "1.16.0-nullsafety.5" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.19-nullsafety.2" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.3.12-nullsafety.5" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" vm_service: dependency: transitive description: @@ -429,13 +422,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - xml: + webkit_inspection_protocol: dependency: transitive description: - name: xml + name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "0.7.3" yaml: dependency: transitive description: @@ -444,4 +437,4 @@ packages: source: hosted version: "2.2.0" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0"