Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added selector decoration and dropdown button can be removed #357

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"libphonenumber","path":"/Users/nathaniel.ogunye/.pub-cache/hosted/pub.dartlang.org/libphonenumber-2.0.2/","native_build":true,"dependencies":[]},{"name":"libphonenumber_plugin","path":"/Users/nathaniel.ogunye/.pub-cache/hosted/pub.dartlang.org/libphonenumber_plugin-0.2.3/","native_build":true,"dependencies":["libphonenumber"]}],"android":[{"name":"libphonenumber","path":"/Users/nathaniel.ogunye/.pub-cache/hosted/pub.dartlang.org/libphonenumber-2.0.2/","native_build":true,"dependencies":[]},{"name":"libphonenumber_plugin","path":"/Users/nathaniel.ogunye/.pub-cache/hosted/pub.dartlang.org/libphonenumber_plugin-0.2.3/","native_build":true,"dependencies":["libphonenumber"]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"libphonenumber_web","path":"/Users/nathaniel.ogunye/.pub-cache/hosted/pub.dartlang.org/libphonenumber_web-0.2.0+1/","dependencies":[]}]},"dependencyGraph":[{"name":"libphonenumber","dependencies":[]},{"name":"libphonenumber_plugin","dependencies":["libphonenumber_web","libphonenumber"]},{"name":"libphonenumber_web","dependencies":[]}],"date_created":"2022-09-21 11:56:42.923067","version":"3.3.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"libphonenumber_plugin","path":"/Users/macbook/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.2.5/","native_build":true,"dependencies":[]}],"android":[{"name":"libphonenumber_plugin","path":"/Users/macbook/.pub-cache/hosted/pub.dev/libphonenumber_plugin-0.2.5/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"libphonenumber_web","path":"/Users/macbook/.pub-cache/hosted/pub.dev/libphonenumber_web-0.2.0+1/","dependencies":[]}]},"dependencyGraph":[{"name":"libphonenumber_plugin","dependencies":["libphonenumber_web"]},{"name":"libphonenumber_web","dependencies":[]}],"date_created":"2024-06-17 12:09:23.581637","version":"3.13.8"}
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -39,8 +39,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.intlphonenumberinputtest"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:name="${applicationName}"
android:label="intlphonenumberinputtest"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
13 changes: 8 additions & 5 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.8.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.2.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -26,6 +29,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
21 changes: 18 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,41 @@ PODS:
- Flutter
- libPhoneNumber-iOS
- libPhoneNumber-iOS (0.9.15)
- libphonenumber_plugin (0.0.1):
- Flutter
- PhoneNumberKit
- PhoneNumberKit (3.6.3):
- PhoneNumberKit/PhoneNumberKitCore (= 3.6.3)
- PhoneNumberKit/UIKit (= 3.6.3)
- PhoneNumberKit/PhoneNumberKitCore (3.6.3)
- PhoneNumberKit/UIKit (3.6.3):
- PhoneNumberKit/PhoneNumberKitCore

DEPENDENCIES:
- Flutter (from `Flutter`)
- libphonenumber (from `.symlinks/plugins/libphonenumber/ios`)
- libphonenumber_plugin (from `.symlinks/plugins/libphonenumber_plugin/ios`)

SPEC REPOS:
trunk:
- libPhoneNumber-iOS
- PhoneNumberKit

EXTERNAL SOURCES:
Flutter:
:path: Flutter
libphonenumber:
:path: ".symlinks/plugins/libphonenumber/ios"
libphonenumber_plugin:
:path: ".symlinks/plugins/libphonenumber_plugin/ios"

SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
libphonenumber: bd14d5abfc5939ab0b0767234e2d8e2593af258e
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
libphonenumber_plugin: e8a7d64a6624a7c25f2c4ab0b7ead2a8e341e35e
PhoneNumberKit: bdfa83dbfbd0d537eb56605133a8310b256b126e

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d

COCOAPODS: 1.9.3
COCOAPODS: 1.15.2
34 changes: 24 additions & 10 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -164,7 +164,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -230,10 +230,12 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -249,15 +251,17 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/PhoneNumberKit/PhoneNumberKit.framework",
"${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework",
"${BUILT_PRODUCTS_DIR}/libphonenumber/libphonenumber.framework",
"${BUILT_PRODUCTS_DIR}/libphonenumber_plugin/libphonenumber_plugin.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PhoneNumberKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libphonenumber.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libphonenumber_plugin.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -266,6 +270,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -353,7 +358,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -375,7 +380,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -435,7 +443,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -484,7 +492,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -507,7 +515,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand All @@ -534,7 +545,10 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
34 changes: 25 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class MyApp extends StatelessWidget {

return MaterialApp(
title: 'Demo',
themeMode: ThemeMode.dark,
darkTheme: darkTheme,
// themeMode: ThemeMode.dark,
// darkTheme: darkTheme,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Directionality(
textDirection: TextDirection.rtl,
textDirection: TextDirection.ltr,
child: Scaffold(
appBar: AppBar(title: Text('Demo')),
body: MyHomePage(),
Expand All @@ -36,35 +36,52 @@ class _MyHomePageState extends State<MyHomePage> {

final TextEditingController controller = TextEditingController();
String initialCountry = 'NG';
PhoneNumber number = PhoneNumber(isoCode: 'NG');
PhoneNumber number = PhoneNumber(isoCode: 'NG', phoneNumber: '8130101049', number: '8130101049');

@override
Widget build(BuildContext context) {
return Form(
key: formKey,
child: Container(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InternationalPhoneNumberInput(
isShowSelectorArrow: false,
onInputChanged: (PhoneNumber number) {
print(number.phoneNumber);
print(number.number);
},
onInputValidated: (bool value) {
print(value);
},
showSeparator: true,
separatorBorderSide: BorderSide(
color: Colors.grey,
width: 1
),
selectorDecoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(left: Radius.circular(8))
),
selectorConfig: SelectorConfig(
selectorType: PhoneInputSelectorType.BOTTOM_SHEET,
leadingPadding: 4,
showFlags: true,
),
inputDecoration: InputDecoration(
hintText: 'Phone number',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
)
),
ignoreBlank: false,
spaceBetweenSelectorAndTextField: 0,
autoValidateMode: AutovalidateMode.disabled,
selectorTextStyle: TextStyle(color: Colors.black),
initialValue: number,
textFieldController: controller,
formatInput: false,
keyboardType:
TextInputType.numberWithOptions(signed: true, decimal: true),
inputBorder: OutlineInputBorder(),
keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true),
onSaved: (PhoneNumber number) {
print('On Saved: $number');
},
Expand Down Expand Up @@ -96,7 +113,6 @@ class _MyHomePageState extends State<MyHomePage> {
void getPhoneNumber(String phoneNumber) async {
PhoneNumber number =
await PhoneNumber.getRegionInfoFromPhoneNumber(phoneNumber, 'US');

setState(() {
this.number = number;
});
Expand Down
6 changes: 3 additions & 3 deletions example/lib/main_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
ElevatedButton(
onPressed: () {
formKey.currentState.validate();
formKey.currentState?.validate();
},
child: Text('Validate'),
),
Expand All @@ -78,13 +78,13 @@ class _MyHomePageState extends State<MyHomePage> {
controller.text = parsableNumber;

setState(() {
initialCountry = number.isoCode;
initialCountry = number.isoCode!;
});
}

@override
void dispose() {
controller?.dispose();
controller.dispose();
super.dispose();
}
}
Loading