├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── kotlin │ └── io │ │ └── github │ │ └── itzmeanjan │ │ └── intent │ │ ├── IntentPlugin.kt │ │ └── MyProvider.kt │ └── res │ └── xml │ └── file_paths.xml ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── io │ │ │ │ │ └── github │ │ │ │ │ └── itzmeanjan │ │ │ │ │ └── intent_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m ├── lib │ └── main.dart ├── pubspec.lock └── pubspec.yaml ├── image_capture.gif ├── intent.iml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── IntentPlugin.h │ └── IntentPlugin.m └── intent.podspec ├── lib ├── action.dart ├── category.dart ├── extra.dart ├── flag.dart ├── intent.dart └── typedExtra.dart ├── pubspec.yaml └── test └── intent_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | *.lock 5 | .packages 6 | .pub/ 7 | .idea/ 8 | .vscode/ 9 | 10 | node_modules/ 11 | 12 | build/ 13 | 14 | .flutter-plugins 15 | android/key.properties 16 | 17 | ios/Runner.app.dSYM.zip 18 | ios/Runner.ipa 19 | ios/fastlane/report.xml 20 | ios/Flutter/flutter_export_environment.sh 21 | android/fastlane/report.xml 22 | 23 | gen/ 24 | example/ios/Flutter/flutter_export_environment.sh 25 | example/ios/Podfile 26 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.4.0 2 | 3 | * Updated `androidx.core` dependency to latest version 4 | * Added optional `type` param support for `Intent.putExtra(String extra, dynamic data, {String type})`` method 5 | * This change is backward compatible 6 | * Now you can specify which type this extra value to be casted into, in android platform code 7 | * If no type information provided uses default behaviour, where it simply gets casted to `String` 8 | * Supported extra data types are put inside `TypedExtra` class 9 | 10 | ## 1.3.4 11 | 12 | * Activity identifier code updated in Kotlin, using 998 for handling both image & video capture Intent(s) 13 | * Image & video temp filename format changed, using locale date format ( i.e. ddmmyyyy_HHmmss.* ) 14 | * Updated activity call back handler section, returning result from `else` block of code ( prior to it, it was out of scope of `else` block ) 15 | 16 | ## 1.3.3 17 | 18 | * Fixed sourceCompatibility & targetCompatibility issue, set to jdk1.8 19 | * Fixed image & video capture failure issue 20 | 21 | ## 1.3.2 22 | 23 | * Removed cover photo from Github README.md 24 | 25 | ## 1.3.1 26 | 27 | * **Critical bug fix** - in previous release I made a big mistake by not considering `package` is a JAVA keyword, which needs to be escaped in Kotlin code 28 | * Added `setPackage` support for `startActivityForResult` method in Intent class 29 | * Updated Android SDK version, Kotlin version 30 | * Thanks for being so patient :) 31 | 32 | ## 1.3.0 33 | 34 | * Intent class now lets you set specific package name for resolving intent 35 | * Assuming that, requested package is present on system, otherwise it'll simply throw PlatformException 36 | * Thanks to PR submitted by [togiberlin](https://github.com/togiberlin) :) 37 | * Usage can be found [here](https://github.com/itzmeanjan/intent#create-precomposed-email-) 38 | * Thanks for using `intent` :) 39 | 40 | ## 1.2.0 41 | 42 | * Prior to this release on a single device, > 1 app could not use `intent` package, due to name conflict issue, which has been resolved by pull request submitted by [agniswarm](https://github.com/agniswarm) 43 | * Added platform specificness in pubspec.yaml to denote usage of package only on android platform 44 | * Now serving `intent` on pub.dev using verified publisher 45 | 46 | ## 1.1.0 47 | 48 | * `intent` - your one stop solution for android activity, can now get you back result from launched activity 49 | * Can pick documents/ multimedia using their default activity, and get you back a `List`, which holds result. 50 | * There might be some situation in which you want to pick multiple documents, which is why `Intent.startActivityForResult()` returns a `List`. 51 | * Most important news, `intent` can capture image using default Camera Activity and get you back path to captured image. 52 | 53 | ## 1.0.0 54 | 55 | * `intent` is your one stop solution for handling different Android Intents from Flutter app. 56 | 57 | **Enjoy :)** 58 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Anjan Roy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > **Warning** I've stopped maintaining this project ! 2 | 3 | # intent 4 | 5 | A simple flutter plugin to deal with Android Intents - your one stop solution for Android Intents, written with :heart:. 6 | 7 | Show some :heart: by putting :star: 8 | 9 | **`intent` tries to help you in launching another android activity using *Android Intents.* This Dart API replicates Android Intent API, so for detailed information on how to use it efficiently, when to send what kind of data, you may be interested in taking a look [here](https://developer.android.com/reference/android/content/Intent.html#intent-structure), which explains things more elaborately.** 10 | 11 | `intent` is readily available for [use](https://pub.dev/packages/intent). 12 | 13 | ## what does it do ? 14 | - `intent` is your one stop solution for handling different Android Intents from Flutter app. 15 | - It provides an easy to use *Dart* API, which can be used to launch different kind of Android Activities 16 | - You can view / create documents 17 | - Pick document(s) from Document Tree 18 | - Open default Assist Activity 19 | - Perform a Web Search 20 | - Request definition of a certain string to default Assist Activity 21 | - Open image for editing / viewing 22 | - Share text / multimedia to another activity 23 | - Send Email to specific user, while also setting `CC` & `BCC` 24 | - Share multiple documents at a time 25 | - Sync system content 26 | - Translate text 27 | - Set Wallpaper 28 | - Open any `URL` 29 | - Open Dialer for calling a specific number 30 | - Can pick a contact from your default phone activity 31 | - Can capture a photo using default _Camera Activity_ 32 | 33 | ### latest addition 34 | 35 | **Newest Addition: You can pass extra data's type information, while invoking `Intent.putExtra(String extra, dynamic data, {String type})` as optional named param `type`. You don't even need to hardcode type names as Strings, rather a class named `TypedExtra` has been given to developers, which has all currently supported type names as static variables. Consider using them. And last but not least, this is _not_ a breaking change !!!** 36 | 37 | ```dart 38 | import 'package:intent/intent.dart' as android_intent; 39 | import 'package:intent/extra.dart' as android_extra; 40 | import 'package:intent/typedExtra.dart' as android_typedExtra; 41 | import 'package:intent/action.dart' as android_action; 42 | 43 | // more codes ... 44 | 45 | android_intent.Intent() 46 | ..setAction(android_action.Action.ACTION_SHOW_APP_INFO) 47 | ..putExtra(android_extra.Extra.EXTRA_PACKAGE_NAME, "com.whatsapp", type: android_typedExtra.TypedExtra.stringExtra) 48 | ..startActivity().catchError((e) => print(e)); 49 | ``` 50 | 51 | ## how to use it ? 52 | Well make sure, you include `intent` in your `pubspec.yaml`. 53 | 54 | ### Define a Term : 55 | ```dart 56 | Intent() 57 | ..setAction(Action.ACTION_DEFINE) 58 | ..putExtra(Extra.EXTRA_TEXT, "json") 59 | ..startActivity().catchError((e) => print(e)); 60 | ``` 61 | ### Show Desired Application Info : 62 | Make sure you address app using its unique package id. 63 | ```dart 64 | Intent() 65 | ..setAction(Action.ACTION_SHOW_APP_INFO) 66 | ..putExtra(Extra.EXTRA_PACKAGE_NAME, "com.whatsapp") 67 | ..startActivity().catchError((e) => print(e)); 68 | ``` 69 | ### Show Application Preference Activity : 70 | ```dart 71 | Intent() 72 | ..setAction(Action.ACTION_APPLICATION_PREFERENCES) 73 | ..startActivity().catchError((e) => print(e)); 74 | ``` 75 | ### Launch Application Error Reporting Activity : 76 | ```dart 77 | Intent() 78 | ..setAction(Action.ACTION_APP_ERROR) 79 | ..startActivity().catchError((e) => print(e)); 80 | ``` 81 | ### Launch Default Assist Activity : 82 | ```dart 83 | Intent() 84 | ..setAction(Action.ACTION_ASSIST) 85 | ..startActivity().catchError((e) => print(e)); 86 | ``` 87 | ### Report Bug : 88 | ```dart 89 | Intent() 90 | ..setAction(Action.ACTION_BUG_REPORT) 91 | ..startActivity().catchError((e) => print(e)); 92 | ``` 93 | ### View a URI : 94 | Which activity to be launched, depends upon type of URI passed. 95 | 96 | In case of passing `tel` URI, opens dialer up. 97 | ```dart 98 | Intent() 99 | ..setAction(Action.ACTION_VIEW) 100 | ..setData(Uri(scheme: "tel", path: "123")) 101 | ..startActivity().catchError((e) => print(e)); 102 | ``` 103 | If you pass a `mailto` URI, it'll open email app. 104 | ```dart 105 | Intent() 106 | ..setAction(Action.ACTION_VIEW) 107 | ..setData(Uri(scheme: "mailto", path: "someone@example.com")) 108 | ..startActivity().catchError((e) => print(e)); 109 | ``` 110 | In case of `http`/ `https` URI, opens browser up. 111 | ```dart 112 | Intent() 113 | ..setAction(Action.ACTION_VIEW) 114 | ..setData(Uri(scheme: "https", host:"google.com")) 115 | ..startActivity().catchError((e) => print(e)); 116 | ``` 117 | ### Dial a Number using Default Dial Activity : 118 | Setting data using `tel` URI, will open dialer, number as input. 119 | ```dart 120 | Intent() 121 | ..setAction(Action.ACTION_DIAL) 122 | ..setData(Uri(scheme: 'tel', path: '121')) 123 | ..startActivity().catchError((e) => print(e)); 124 | ``` 125 | But if you're interested in opening dialer without any numbers dialer, make sure you don't set data field. 126 | ```dart 127 | Intent() 128 | ..setAction(Action.ACTION_DIAL) 129 | ..startActivity().catchError((e) => print(e)); 130 | ``` 131 | ### Calling a Number : 132 | You can simply call a number, but make sure you've necessary permissions to do so. 133 | ```dart 134 | Intent() 135 | ..setAction(Action.ACTION_CALL) 136 | ..setData(Uri(scheme: 'tel', path: '121')) 137 | ..startActivity().catchError((e) => print(e)); 138 | ``` 139 | It'll always be a wise decision to use `ACTION_DIAL`, because that won't require any kind of permissions. 140 | 141 | ### Create Precomposed Email : 142 | ```dart 143 | Intent() 144 | ..setPackage("com.google.android.gm") 145 | ..setAction(Action.ACTION_SEND); 146 | ..setType("message/rfc822"); 147 | ..putExtra(Extra.EXTRA_EMAIL, ["john.doe@exampleemail.com"]); 148 | ..putExtra(Extra.EXTRA_CC, ["jane.doe@exampleemail.com"]); 149 | ..putExtra(Extra.EXTRA_SUBJECT, "Foo bar"); 150 | ..putExtra(Extra.EXTRA_TEXT, "Lorem ipsum"); 151 | ..startActivity().catchError((e) => print(e)); 152 | ``` 153 | 154 | ### Create a Document : 155 | Content type of document is set `text/plain`, category is `CATEGORY_OPENABLE` and file name is passed as an extra i.e. `EXTRA_TITLE`. 156 | ```dart 157 | Intent() 158 | ..setAction(Action.ACTION_CREATE_DOCUMENT) 159 | ..setType("text/plain") 160 | ..addCategory(Category.CATEGORY_OPENABLE) 161 | ..putExtra(Extra.EXTRA_TITLE, "test.txt") 162 | ..startActivity().catchError((e) => print(e)); 163 | ``` 164 | You can also set path of file using data field. But make sure data field is a valid path URI. 165 | 166 | ### Edit Document : 167 | You can edit image/ text or any other kind of data using appropriate activity. 168 | ```dart 169 | Intent() 170 | ..setAction(Action.ACTION_EDIT) 171 | ..setData(Uri(scheme: 'content', 172 | path: 173 | 'path-to-image')) 174 | ..setType('image/*') 175 | ..startActivity().catchError((e) => print(e)); 176 | ``` 177 | ### Add a Contact to your Contact Database : 178 | ```dart 179 | Intent() 180 | ..setAction('com.android.contacts.action.SHOW_OR_CREATE_CONTACT') 181 | ..setData(Uri(scheme: 'tel', path: '1234567890')) 182 | ..startActivity().catchError((e) => print(e)); 183 | ``` 184 | ### Search for a Term : 185 | Opens up a list of eligible candidates, which can provides search activity. 186 | ```dart 187 | Intent() 188 | ..setAction(Action.ACTION_SEARCH) 189 | ..putExtra(Extra.EXTRA_TEXT, 'json') 190 | ..startActivity().catchError((e) => print(e)); 191 | ``` 192 | ### Share Text/ Media : 193 | Make sure you've set appropriate path URI for sharing documents/ media using `EXTRA_STREAM` and also set type properly. 194 | 195 | Following one will share a plain text. For sharing html formatted text, set type to `text/html`. 196 | ```dart 197 | Intent() 198 | ..setAction(Action.ACTION_SEND) 199 | ..setType('text/plain') 200 | ..putExtra(Extra.EXTRA_TEXT, 'json') 201 | ..startActivity().catchError((e) => print(e)); 202 | ``` 203 | But if you're interested in creating a chooser i.e. all eligible candidates shown up system, which can handle this intent, make sure you set `createChooser` named parameter to `true`, which is by default `false`. 204 | 205 | ### Send Email to certain ID while setting Content and CC/ BCC : 206 | ```dart 207 | Intent() 208 | ..setAction(Action.ACTION_SENDTO) 209 | ..setData(Uri(scheme: 'mailto', path: 'anjanroy@yandex.com')) 210 | ..putExtra(Extra.EXTRA_CC, ['someone@example.com']) 211 | ..putExtra(Extra.EXTRA_TEXT, 'Hello World') 212 | ..startActivity().catchError((e) => print(e)); 213 | ``` 214 | ### Translate a Text using default Assist Activity : 215 | ```dart 216 | Intent() 217 | ..setAction(Action.ACTION_TRANSLATE) 218 | ..putExtra(Extra.EXTRA_TEXT, "I Love Computers") 219 | ..startActivity().catchError((e) => print(e)); 220 | ``` 221 | ### Pick a Contact up from Phone : 222 | - Opens default Phone Activity and let user pick a contact up, selected contact will be returned as `Future>` from `startActivityForResult()`. 223 | ```dart 224 | Intent() 225 | ..setAction(Action.ACTION_PICK) 226 | ..setData(Uri.parse('content://contacts')) 227 | ..setType("vnd.android.cursor.dir/phone_v2") 228 | ..startActivityForResult().then((data) => print(data), 229 | onError: (e) => print(e)); 230 | ``` 231 | ### Capture Image using default Camera activity : 232 | Path to captured image can be grabbed from `Intent().startActivityForResult().then(() { ... } )`, which will be provided in form of `List`, open file using that path, `File(data[0])`. Now you can work on that image file. 233 | ```dart 234 | Intent() 235 | ..setAction(Action.ACTION_IMAGE_CAPTURE) 236 | ..startActivityForResult().then((data) => print(data[0]), // gets you path to image captured 237 | onError: (e) => print(e)); 238 | ``` 239 | ![image_capture_using_intent](image_capture.gif) 240 | 241 | If you're not interested in showing default activity launch animation, set following flag. 242 | ```dart 243 | Intent()..addFlag(Flag.FLAG_ACTIVITY_NO_ANIMATION); 244 | ``` 245 | 246 | If you don't want this activity to be displayed in recents, set following flag. 247 | ```dart 248 | Intent()..addFlag(Flag.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 249 | ``` 250 | If you request for certain Activity and no eligible candidate was found, you'll receive one error message, which you can listen for using `Future.catchError((e) {},)` method. 251 | ``` 252 | PlatformException(Error, android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SYSTEM_TUTORIAL }, null) 253 | ``` 254 | 255 | **Currently a limited number of Actions are provided in `Action` class, but you can always use a string constant as an `Action`, which will help you in dealing with many more Activities.** 256 | 257 | Hoping this helps :wink: 258 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'io.github.itzmeanjan.intent' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.3.72' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.6.3' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | sourceSets { 31 | main.java.srcDirs += 'src/main/kotlin' 32 | } 33 | defaultConfig { 34 | minSdkVersion 16 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | } 37 | lintOptions { 38 | disable 'InvalidPackage' 39 | } 40 | compileOptions { 41 | sourceCompatibility = "1.8" 42 | targetCompatibility = "1.8" 43 | } 44 | buildToolsVersion = '29.0.3' 45 | } 46 | 47 | dependencies { 48 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 49 | implementation "androidx.core:core:1.5.0-alpha01" 50 | } 51 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'intent' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /android/src/main/kotlin/io/github/itzmeanjan/intent/IntentPlugin.kt: -------------------------------------------------------------------------------- 1 | package io.github.itzmeanjan.intent 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.net.Uri 6 | import android.os.Environment 7 | import android.provider.ContactsContract 8 | import android.provider.MediaStore 9 | import androidx.core.content.FileProvider 10 | import io.flutter.plugin.common.MethodCall 11 | import io.flutter.plugin.common.MethodChannel 12 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 13 | import io.flutter.plugin.common.MethodChannel.Result 14 | import io.flutter.plugin.common.PluginRegistry.Registrar 15 | import java.io.File 16 | import java.text.SimpleDateFormat 17 | import java.util.* 18 | import kotlin.collections.ArrayList 19 | 20 | class IntentPlugin(private val registrar: Registrar, private val activity: Activity) : MethodCallHandler { 21 | 22 | private var activityCompletedCallBack: ActivityCompletedCallBack? = null 23 | lateinit var toBeCapturedImageLocationURI: Uri 24 | lateinit var tobeCapturedImageLocationFilePath: File 25 | 26 | companion object { 27 | @JvmStatic 28 | fun registerWith(registrar: Registrar) { 29 | val channel = MethodChannel(registrar.messenger(), "intent") 30 | channel.setMethodCallHandler(IntentPlugin(registrar, registrar.activity())) 31 | } 32 | 33 | } 34 | 35 | override fun onMethodCall(call: MethodCall, result: Result) { 36 | 37 | // when an activity will be started for getting some result from it, this callback function will handle it 38 | // then processes received data and send that back to user 39 | registrar.addActivityResultListener { requestCode, resultCode, intent -> 40 | when (requestCode) { 41 | 999 -> { 42 | if (resultCode == Activity.RESULT_OK) { 43 | val filePaths = mutableListOf() 44 | if (intent.clipData != null) { 45 | var i = 0 46 | while (i < intent.clipData?.itemCount!!) { 47 | if (intent.type == ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE) 48 | filePaths.add(resolveContacts(intent.clipData?.getItemAt(i)?.uri!!)) 49 | else 50 | filePaths.add(uriToFilePath(intent.clipData?.getItemAt(i)?.uri!!)) 51 | i++ 52 | } 53 | activityCompletedCallBack?.sendDocument(filePaths) 54 | } else { 55 | if (intent.type == ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE) 56 | filePaths.add(resolveContacts(intent.data!!)) 57 | else 58 | filePaths.add(uriToFilePath(intent.data!!)) 59 | activityCompletedCallBack?.sendDocument(filePaths) 60 | } 61 | true 62 | } else { 63 | activityCompletedCallBack?.sendDocument(listOf()) 64 | false 65 | } 66 | } 67 | 998 -> { 68 | if (resultCode == Activity.RESULT_OK) { 69 | activityCompletedCallBack?.sendDocument(listOf(tobeCapturedImageLocationFilePath.absolutePath)) 70 | true 71 | } else 72 | false 73 | } 74 | else -> { 75 | false 76 | } 77 | } 78 | } 79 | 80 | when (call.method) { 81 | // when we're not interested in result of activity started, we call this method via platform channel 82 | "startActivity" -> { 83 | val intent = Intent() 84 | intent.action = call.argument("action") 85 | if (call.argument("package") != null) 86 | intent.`package` = call.argument("package") 87 | if (call.argument("data") != null) 88 | intent.data = Uri.parse(call.argument("data")) 89 | 90 | // typeInfo parsed into associative array, which can be used for type casting extra data 91 | val typeInfo = call.argument>("typeInfo") 92 | 93 | call.argument>("extra")?.apply { 94 | this.entries.forEach { 95 | when (it.key) { 96 | Intent.EXTRA_DONT_KILL_APP, 97 | Intent.EXTRA_LOCAL_ONLY, 98 | Intent.EXTRA_ALLOW_MULTIPLE, Intent.EXTRA_PROCESS_TEXT_READONLY -> intent.putExtra(it.key, it.value as Boolean) 99 | Intent.EXTRA_EMAIL, 100 | Intent.EXTRA_BCC, 101 | Intent.EXTRA_CC, Intent.EXTRA_MIME_TYPES -> { 102 | val tmp = it.value as ArrayList<*> 103 | intent.putExtra(it.key, tmp.toArray(arrayOfNulls(tmp.size))) 104 | } 105 | Intent.EXTRA_CONTENT_ANNOTATIONS -> intent.putExtra(it.key, (it.value as? ArrayList<*>)?.filterIsInstance() as ArrayList) 106 | Intent.EXTRA_ORIGINATING_URI -> intent.putExtra(it.key, it.value as Uri) 107 | Intent.EXTRA_PROCESS_TEXT, Intent.EXTRA_TEXT, Intent.EXTRA_TITLE -> { 108 | if (listOf(Intent.ACTION_WEB_SEARCH, Intent.ACTION_SEARCH).contains(intent.action!!)) 109 | intent.putExtra("query", it.value as CharSequence) 110 | else 111 | intent.putExtra(it.key, it.value as CharSequence) 112 | } 113 | // here in this block, we'll try to leverage type information 114 | // field passed via platform channel 115 | else -> { 116 | // if type information for this extra key is 117 | // provided by developer, then use that type information 118 | if (typeInfo?.containsKey(it.key)!!) { 119 | 120 | when (typeInfo[it.key]) { 121 | // casting into singular types 122 | 123 | "boolean" -> intent.putExtra(it.key, it.value as Boolean) 124 | "byte" -> intent.putExtra(it.key, it.value as Byte) 125 | "short" -> intent.putExtra(it.key, it.value as Short) 126 | "int" -> intent.putExtra(it.key, it.value as Int) 127 | "long" -> intent.putExtra(it.key, it.value as Long) 128 | "float" -> intent.putExtra(it.key, it.value as Float) 129 | "double" -> intent.putExtra(it.key, it.value as Double) 130 | "char" -> intent.putExtra(it.key, it.value as Char) 131 | "String" -> intent.putExtra(it.key, it.value as String) 132 | 133 | // casting into plural types 134 | 135 | "boolean[]" -> intent.putExtra(it.key, it.value as BooleanArray) 136 | "byte[]" -> intent.putExtra(it.key, it.value as ByteArray) 137 | "short[]" -> intent.putExtra(it.key, it.value as ShortArray) 138 | "int[]" -> intent.putExtra(it.key, it.value as IntArray) 139 | "long[]" -> intent.putExtra(it.key, it.value as LongArray) 140 | "float[]" -> intent.putExtra(it.key, it.value as FloatArray) 141 | "double[]" -> intent.putExtra(it.key, it.value as DoubleArray) 142 | "char[]" -> intent.putExtra(it.key, it.value as CharArray) 143 | "String[]" -> { 144 | val tmp = it.value as ArrayList<*> 145 | intent.putExtra(it.key, tmp.toArray(arrayOfNulls(tmp.size))) 146 | } 147 | // if some unsupported type information supplied by user 148 | else -> intent.putExtra(it.key, it.value as String) 149 | } 150 | 151 | } else { 152 | intent.putExtra(it.key, it.value as String) 153 | } 154 | } 155 | } 156 | } 157 | } 158 | call.argument>("flag")?.forEach { 159 | intent.addFlags(it) 160 | } 161 | call.argument>("category")?.forEach { 162 | intent.addCategory(it) 163 | } 164 | if (call.argument("type") != null) 165 | intent.type = call.argument("type") 166 | try { 167 | if (call.argument("chooser")!!) activity.startActivity(Intent.createChooser(intent, "Sharing")) 168 | else activity.startActivity(intent) 169 | } catch (e: Exception) { 170 | result.error("Error", e.toString(), null) 171 | } 172 | } 173 | // but if we're interested in getting data from activity launched, we need to call this method 174 | // 175 | // cause this method will listen for result of activity launched using onActivityResult callback 176 | // and then send processed URI to destination 177 | "startActivityForResult" -> { 178 | activityCompletedCallBack = object : ActivityCompletedCallBack { 179 | override fun sendDocument(data: List) { 180 | result.success(data) 181 | } 182 | } 183 | val activityImageVideoCaptureCode = 998 184 | val activityIdentifierCode = 999 185 | val intent = Intent() 186 | intent.action = call.argument("action") 187 | if (call.argument("package") != null) 188 | intent.`package` = call.argument("package") 189 | if (call.argument("data") != null) 190 | intent.data = Uri.parse(call.argument("data")) 191 | 192 | // typeInfo parsed into associative array, which can be used for type casting extra data 193 | val typeInfo = call.argument>("typeInfo") 194 | 195 | call.argument>("extra")?.apply { 196 | this.entries.forEach { 197 | when (it.key) { 198 | Intent.EXTRA_DONT_KILL_APP, 199 | Intent.EXTRA_LOCAL_ONLY, 200 | Intent.EXTRA_ALLOW_MULTIPLE, Intent.EXTRA_PROCESS_TEXT_READONLY -> intent.putExtra(it.key, it.value as Boolean) 201 | Intent.EXTRA_EMAIL, 202 | Intent.EXTRA_BCC, 203 | Intent.EXTRA_CC, Intent.EXTRA_MIME_TYPES -> { 204 | val tmp = it.value as ArrayList<*> 205 | intent.putExtra(it.key, tmp.toArray(arrayOfNulls(tmp.size))) 206 | } 207 | Intent.EXTRA_CONTENT_ANNOTATIONS -> intent.putExtra(it.key, (it.value as? ArrayList<*>)?.filterIsInstance() as ArrayList) 208 | Intent.EXTRA_ORIGINATING_URI -> intent.putExtra(it.key, it.value as Uri) 209 | Intent.EXTRA_PROCESS_TEXT, Intent.EXTRA_TEXT, Intent.EXTRA_TITLE -> { 210 | if (listOf(Intent.ACTION_WEB_SEARCH, Intent.ACTION_SEARCH).contains(intent.action!!)) 211 | intent.putExtra("query", it.value as CharSequence) 212 | else 213 | intent.putExtra(it.key, it.value as CharSequence) 214 | } 215 | // here in this block, we'll try to leverage type information 216 | // field passed via platform channel 217 | else -> { 218 | // if type information for this extra key is 219 | // provided by developer, then use that type information 220 | if (typeInfo?.containsKey(it.key)!!) { 221 | 222 | when (typeInfo[it.key]) { 223 | // casting into singular types 224 | 225 | "boolean" -> intent.putExtra(it.key, it.value as Boolean) 226 | "byte" -> intent.putExtra(it.key, it.value as Byte) 227 | "short" -> intent.putExtra(it.key, it.value as Short) 228 | "int" -> intent.putExtra(it.key, it.value as Int) 229 | "long" -> intent.putExtra(it.key, it.value as Long) 230 | "float" -> intent.putExtra(it.key, it.value as Float) 231 | "double" -> intent.putExtra(it.key, it.value as Double) 232 | "char" -> intent.putExtra(it.key, it.value as Char) 233 | "String" -> intent.putExtra(it.key, it.value as String) 234 | 235 | // casting into plural types 236 | 237 | "boolean[]" -> intent.putExtra(it.key, it.value as BooleanArray) 238 | "byte[]" -> intent.putExtra(it.key, it.value as ByteArray) 239 | "short[]" -> intent.putExtra(it.key, it.value as ShortArray) 240 | "int[]" -> intent.putExtra(it.key, it.value as IntArray) 241 | "long[]" -> intent.putExtra(it.key, it.value as LongArray) 242 | "float[]" -> intent.putExtra(it.key, it.value as FloatArray) 243 | "double[]" -> intent.putExtra(it.key, it.value as DoubleArray) 244 | "char[]" -> intent.putExtra(it.key, it.value as CharArray) 245 | "String[]" -> { 246 | val tmp = it.value as ArrayList<*> 247 | intent.putExtra(it.key, tmp.toArray(arrayOfNulls(tmp.size))) 248 | } 249 | // if some unsupported type information supplied by user 250 | else -> intent.putExtra(it.key, it.value as String) 251 | } 252 | 253 | } else { 254 | intent.putExtra(it.key, it.value as String) 255 | } 256 | } 257 | } 258 | } 259 | } 260 | call.argument>("flag")?.forEach { 261 | intent.addFlags(it) 262 | } 263 | call.argument>("category")?.forEach { 264 | intent.addCategory(it) 265 | } 266 | if (call.argument("type") != null) 267 | intent.type = call.argument("type") 268 | try { 269 | if (intent.action == MediaStore.ACTION_IMAGE_CAPTURE) { 270 | intent.resolveActivity(activity.packageManager).also { 271 | getImageTempFile()?.also { 272 | tobeCapturedImageLocationFilePath = it 273 | activity.packageName 274 | toBeCapturedImageLocationURI = FileProvider.getUriForFile(activity.applicationContext, "${activity.packageName}.io.github.itzmeanjan.intent.fileProvider", it) 275 | intent.putExtra(MediaStore.EXTRA_OUTPUT, toBeCapturedImageLocationURI) 276 | activity.startActivityForResult(intent, activityImageVideoCaptureCode) 277 | } 278 | } 279 | } else if (intent.action == MediaStore.ACTION_VIDEO_CAPTURE) { 280 | intent.resolveActivity(activity.packageManager).also { 281 | getVideoTempFile()?.also { 282 | tobeCapturedImageLocationFilePath = it 283 | toBeCapturedImageLocationURI = FileProvider.getUriForFile(activity.applicationContext, "${activity.packageName}.io.github.itzmeanjan.intent.fileProvider", it) 284 | intent.putExtra(MediaStore.EXTRA_OUTPUT, toBeCapturedImageLocationURI) 285 | activity.startActivityForResult(intent, activityImageVideoCaptureCode) 286 | } 287 | } 288 | } else { 289 | if (call.argument("chooser")!!) activity.startActivityForResult(Intent.createChooser(intent, "Sharing"), activityIdentifierCode) 290 | else activity.startActivityForResult(intent, activityIdentifierCode) 291 | } 292 | } catch (e: Exception) { 293 | result.error("Error", e.toString(), null) 294 | } 295 | } 296 | else -> result.notImplemented() 297 | } 298 | } 299 | 300 | private fun getImageTempFile(): File? { 301 | return try { 302 | val timeStamp = SimpleDateFormat("ddMMyyyy_HHmmss", Locale.getDefault()).format(Date()) 303 | val storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES) 304 | File.createTempFile("IMG_${timeStamp}", ".jpg", storageDir) 305 | } catch (e: java.lang.Exception) { 306 | null 307 | } 308 | } 309 | 310 | private fun getVideoTempFile(): File? { 311 | return try { 312 | val timeStamp = SimpleDateFormat("ddMMyyyy_HHmmss", Locale.getDefault()).format(Date()) 313 | val storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_DCIM) 314 | File.createTempFile("VIDEO_${timeStamp}", ".mp4", storageDir) 315 | } catch (e: java.lang.Exception) { 316 | null 317 | } 318 | } 319 | 320 | private fun resolveContacts(uri: Uri): String { 321 | lateinit var contact: String 322 | activity.applicationContext.contentResolver.query(uri, arrayOf(ContactsContract.CommonDataKinds.Phone.NUMBER), null, null, null).apply { 323 | this?.moveToFirst() 324 | contact = this?.getString(getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))!! 325 | close() 326 | } 327 | return contact 328 | } 329 | 330 | private fun uriToFilePath(uri: Uri): String { 331 | val cursor = activity.applicationContext.contentResolver.query(uri, 332 | arrayOf(MediaStore.MediaColumns.DATA), 333 | null, null, null) 334 | cursor?.moveToFirst() 335 | val tmp = cursor?.getString(cursor.getColumnIndex(MediaStore.MediaColumns.DATA)) 336 | cursor?.close() 337 | return tmp!! 338 | } 339 | 340 | } 341 | 342 | interface ActivityCompletedCallBack { 343 | fun sendDocument(data: List) 344 | } 345 | -------------------------------------------------------------------------------- /android/src/main/kotlin/io/github/itzmeanjan/intent/MyProvider.kt: -------------------------------------------------------------------------------- 1 | package io.github.itzmeanjan.intent 2 | 3 | import androidx.core.content.FileProvider 4 | 5 | class MyProvider : FileProvider() -------------------------------------------------------------------------------- /android/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # intent_example 2 | 3 | Demonstrates how to use the `intent` plugin. 4 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 29 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "io.github.itzmeanjan.intent_example" 42 | minSdkVersion 16 43 | targetSdkVersion 29 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | minifyEnabled = true 55 | multiDexEnabled = true 56 | } 57 | } 58 | compileOptions { 59 | sourceCompatibility = '1.8' 60 | targetCompatibility = "1.8" 61 | } 62 | buildToolsVersion = '29.0.3' 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | testImplementation 'junit:junit:4.13' 72 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 73 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 74 | } 75 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/io/github/itzmeanjan/intent_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.github.itzmeanjan.intent_example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.72' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.6.3' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableJetifier=true 3 | android.useAndroidX=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed May 13 00:11:39 IST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 107 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 110 | 97C147021CF9000F007C117D /* Info.plist */, 111 | 97C146F11CF9000F007C117D /* Supporting Files */, 112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 97C146F21CF9000F007C117D /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | 97C146ED1CF9000F007C117D /* Runner */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 132 | buildPhases = ( 133 | 9740EEB61CF901F6004384FC /* Run Script */, 134 | 97C146EA1CF9000F007C117D /* Sources */, 135 | 97C146EB1CF9000F007C117D /* Frameworks */, 136 | 97C146EC1CF9000F007C117D /* Resources */, 137 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = Runner; 145 | productName = Runner; 146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 97C146E61CF9000F007C117D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0910; 156 | ORGANIZATIONNAME = "The Chromium Authors"; 157 | TargetAttributes = { 158 | 97C146ED1CF9000F007C117D = { 159 | CreatedOnToolsVersion = 7.3.1; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Profile; 307 | }; 308 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 314 | DEVELOPMENT_TEAM = S8QB4VV633; 315 | ENABLE_BITCODE = NO; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Flutter", 319 | ); 320 | INFOPLIST_FILE = Runner/Info.plist; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | LIBRARY_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "$(PROJECT_DIR)/Flutter", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = io.github.itzmeanjan.intentExample; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | 97C147041CF9000F007C117D /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 409 | CLANG_WARN_STRICT_PROTOTYPES = YES; 410 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 97C147061CF9000F007C117D /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | ENABLE_BITCODE = NO; 441 | FRAMEWORK_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | LIBRARY_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = io.github.itzmeanjan.intentExample; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Debug; 456 | }; 457 | 97C147071CF9000F007C117D /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 463 | ENABLE_BITCODE = NO; 464 | FRAMEWORK_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "$(PROJECT_DIR)/Flutter", 467 | ); 468 | INFOPLIST_FILE = Runner/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | LIBRARY_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "$(PROJECT_DIR)/Flutter", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = io.github.itzmeanjan.intentExample; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | intent_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intent/intent.dart' as android_intent; 3 | import 'package:intent/action.dart' as android_action; 4 | import 'dart:async' show StreamController; 5 | import 'dart:io'; 6 | 7 | void main() => runApp(MyApp()); 8 | 9 | class MyApp extends StatefulWidget { 10 | @override 11 | _MyAppState createState() => _MyAppState(); 12 | } 13 | 14 | class _MyAppState extends State { 15 | MyAppDataModel _myAppDataModel; 16 | 17 | @override 18 | void initState() { 19 | _myAppDataModel = MyAppDataModel(); 20 | _myAppDataModel.inputClickState.add([]); 21 | super.initState(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return MaterialApp( 27 | home: Scaffold( 28 | appBar: AppBar( 29 | title: const Text( 30 | 'Plugin Example App', 31 | style: TextStyle( 32 | color: Colors.black, 33 | ), 34 | ), 35 | centerTitle: true, 36 | backgroundColor: Colors.cyanAccent, 37 | ), 38 | body: Center( 39 | child: Column( 40 | mainAxisSize: MainAxisSize.min, 41 | mainAxisAlignment: MainAxisAlignment.center, 42 | children: [ 43 | StreamBuilder>( 44 | initialData: [], 45 | stream: _myAppDataModel.outputResult, 46 | builder: (context, snapshot) => Padding( 47 | padding: EdgeInsets.only( 48 | left: 8, 49 | right: 8, 50 | top: 12, 51 | bottom: 24, 52 | ), 53 | child: snapshot.hasData 54 | ? snapshot.data.isNotEmpty 55 | ? ClipRRect( 56 | borderRadius: BorderRadius.circular(24), 57 | child: Image.file( 58 | File(snapshot.data[0]), 59 | fit: BoxFit.cover, 60 | width: MediaQuery.of(context).size.width * .75, 61 | height: 62 | MediaQuery.of(context).size.height * .35, 63 | ), 64 | ) 65 | : Center() 66 | : CircularProgressIndicator(), 67 | ), 68 | ), 69 | RaisedButton( 70 | color: Colors.cyanAccent, 71 | elevation: 16, 72 | onPressed: () => android_intent.Intent() 73 | ..setAction(android_action.Action.ACTION_IMAGE_CAPTURE) 74 | ..startActivityForResult().then( 75 | (data) => print(data), 76 | onError: (e) => print(e.toString()), 77 | ), 78 | child: Text('Intent'), 79 | ), 80 | ], 81 | ), 82 | ), 83 | ), 84 | ); 85 | } 86 | } 87 | 88 | class MyAppDataModel { 89 | StreamController> _streamController = 90 | StreamController>.broadcast(); 91 | 92 | Sink> get inputClickState => _streamController; 93 | 94 | Stream> get outputResult => 95 | _streamController.stream.map((data) => data); 96 | 97 | dispose() => _streamController.close(); 98 | } 99 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.13" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.6.0" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.1" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.0.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.3" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.12" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.4" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.3" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | image: 78 | dependency: transitive 79 | description: 80 | name: image 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "2.1.12" 84 | intent: 85 | dependency: "direct dev" 86 | description: 87 | path: ".." 88 | relative: true 89 | source: path 90 | version: "1.3.4" 91 | matcher: 92 | dependency: transitive 93 | description: 94 | name: matcher 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.12.6" 98 | meta: 99 | dependency: transitive 100 | description: 101 | name: meta 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.1.8" 105 | path: 106 | dependency: transitive 107 | description: 108 | name: path 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.6.4" 112 | petitparser: 113 | dependency: transitive 114 | description: 115 | name: petitparser 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.4.0" 119 | quiver: 120 | dependency: transitive 121 | description: 122 | name: quiver 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "2.1.3" 126 | sky_engine: 127 | dependency: transitive 128 | description: flutter 129 | source: sdk 130 | version: "0.0.99" 131 | source_span: 132 | dependency: transitive 133 | description: 134 | name: source_span 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.7.0" 138 | stack_trace: 139 | dependency: transitive 140 | description: 141 | name: stack_trace 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.9.3" 145 | stream_channel: 146 | dependency: transitive 147 | description: 148 | name: stream_channel 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.0.0" 152 | string_scanner: 153 | dependency: transitive 154 | description: 155 | name: string_scanner 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.0.5" 159 | term_glyph: 160 | dependency: transitive 161 | description: 162 | name: term_glyph 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.0" 166 | test_api: 167 | dependency: transitive 168 | description: 169 | name: test_api 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.2.15" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.1.6" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.8" 187 | xml: 188 | dependency: transitive 189 | description: 190 | name: xml 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "3.6.1" 194 | sdks: 195 | dart: ">=2.6.0 <3.0.0" 196 | flutter: ">=1.12.0 <2.0.0" 197 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: intent_example 2 | author: Anjan Roy 3 | description: Demonstrates how to use the intent plugin. 4 | publish_to: 'none' 5 | homepage: https://github.com/itzmeanjan/intent 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | # The following adds the Cupertino Icons font to your application. 15 | # Use with the CupertinoIcons class for iOS style icons. 16 | cupertino_icons: ^0.1.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | intent: 23 | path: ../ 24 | 25 | # For information on the generic Dart part of this file, see the 26 | # following page: https://www.dartlang.org/tools/pub/pubspec 27 | 28 | # The following section is specific to Flutter. 29 | flutter: 30 | 31 | # The following line ensures that the Material Icons font is 32 | # included with your application, so that you can use the icons in 33 | # the material Icons class. 34 | uses-material-design: true 35 | 36 | # To add assets to your application, add an assets section, like this: 37 | # assets: 38 | # - images/a_dot_burr.jpeg 39 | # - images/a_dot_ham.jpeg 40 | 41 | # An image asset can refer to one or more resolution-specific "variants", see 42 | # https://flutter.dev/assets-and-images/#resolution-aware. 43 | 44 | # For details regarding adding assets from package dependencies, see 45 | # https://flutter.dev/assets-and-images/#from-packages 46 | 47 | # To add custom fonts to your application, add a fonts section here, 48 | # in this "flutter" section. Each entry in this list should have a 49 | # "family" key with the font family name, and a "fonts" key with a 50 | # list giving the asset and other descriptors for the font. For 51 | # example: 52 | # fonts: 53 | # - family: Schyler 54 | # fonts: 55 | # - asset: fonts/Schyler-Regular.ttf 56 | # - asset: fonts/Schyler-Italic.ttf 57 | # style: italic 58 | # - family: Trajan Pro 59 | # fonts: 60 | # - asset: fonts/TrajanPro.ttf 61 | # - asset: fonts/TrajanPro_Bold.ttf 62 | # weight: 700 63 | # 64 | # For details regarding fonts from package dependencies, 65 | # see https://flutter.dev/custom-fonts/#from-packages 66 | -------------------------------------------------------------------------------- /image_capture.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/image_capture.gif -------------------------------------------------------------------------------- /intent.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzmeanjan/intent/4f58e6aa7139e6fa1d852348ffda1b3a367be76d/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/IntentPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface IntentPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/IntentPlugin.m: -------------------------------------------------------------------------------- 1 | #import "IntentPlugin.h" 2 | 3 | @implementation IntentPlugin 4 | + (void)registerWithRegistrar:(NSObject*)registrar { 5 | FlutterMethodChannel* channel = [FlutterMethodChannel 6 | methodChannelWithName:@"intent" 7 | binaryMessenger:[registrar messenger]]; 8 | IntentPlugin* instance = [[IntentPlugin alloc] init]; 9 | [registrar addMethodCallDelegate:instance channel:channel]; 10 | } 11 | 12 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 13 | if ([@"getPlatformVersion" isEqualToString:call.method]) { 14 | result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); 15 | } else { 16 | result(FlutterMethodNotImplemented); 17 | } 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ios/intent.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'intent' 6 | s.version = '0.0.1' 7 | s.summary = 'A simple flutter plugin to deal with Android Intents.' 8 | s.description = <<-DESC 9 | A simple flutter plugin to deal with Android Intents. 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.ios.deployment_target = '8.0' 20 | end 21 | 22 | -------------------------------------------------------------------------------- /lib/action.dart: -------------------------------------------------------------------------------- 1 | class Action { 2 | /// gets a list of available apps 3 | static const String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; 4 | 5 | /// lets adjust application preference 6 | static const String ACTION_APPLICATION_PREFERENCES = 7 | "android.intent.action.APPLICATION_PREFERENCES"; 8 | 9 | /// helps in error reporting 10 | static const String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; 11 | 12 | /// launches google app by default, which can provide user assistance 13 | static const String ACTION_ASSIST = "android.intent.action.ASSIST"; 14 | static const String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; 15 | 16 | /// lets user report bug 17 | static const String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; 18 | 19 | /// lets call a number, opens dialer 20 | /// 21 | /// not all app possesses calling permission, so to stay on safe side, 22 | /// you may be interested in using DIAL action 23 | static const String ACTION_CALL = "android.intent.action.CALL"; 24 | 25 | /// this one will simply open an activity, where user can place a call 26 | /// 27 | /// mostly it'll be opening default phone app installed 28 | static const String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; 29 | 30 | /// requires carrier privilege, opens default activity for modifying carrier setting 31 | static const String ACTION_CARRIER_SETUP = 32 | "android.intent.action.CARRIER_SETUP"; 33 | 34 | /// creates a new document 35 | static const String ACTION_CREATE_DOCUMENT = 36 | "android.intent.action.CREATE_DOCUMENT"; 37 | 38 | /// creates app shortcut 39 | static const String ACTION_CREATE_SHORTCUT = 40 | "android.intent.action.CREATE_SHORTCUT"; 41 | 42 | /// displays specified data to user 43 | /// 44 | /// this is the mostly performed action on data 45 | /// 46 | /// you may be passing a URL, and it'll open list of eligible candidate apps, which can help you in viewing that URL 47 | static const String ACTION_VIEW = "android.intent.action.VIEW"; 48 | 49 | /// quickly opens default assist app, and finds definition for queried text 50 | static const String ACTION_DEFINE = "android.intent.action.DEFINE"; 51 | 52 | /// a certain Uri to be deleted, which is to be specified using data field 53 | static const String ACTION_DELETE = "android.intent.action.DELETE"; 54 | 55 | /// for opening dialer with a number pre filled, you'll be mostly using this action 56 | static const String ACTION_DIAL = "android.intent.action.DIAL"; 57 | 58 | /// lets you edit data, specified using Uri 59 | static const String ACTION_EDIT = "android.intent.action.EDIT"; 60 | 61 | /// opens file picker, gets you content of specified types 62 | /// 63 | /// can be opened for getting images/ videos/ music etc. 64 | static const String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; 65 | 66 | /// you can create new contact using this action 67 | static const String ACTION_INSERT = "android.intent.action.INSERT"; 68 | static const String ACTION_INSERT_OR_EDIT = 69 | "android.intent.action.INSERT_OR_EDIT"; 70 | static const String ACTION_MAIN = "android.intent.action.MAIN"; 71 | 72 | /// opens a document, specified using Uri 73 | static const String ACTION_OPEN_DOCUMENT = 74 | "android.intent.action.OPEN_DOCUMENT"; 75 | 76 | /// opens whole document tree, using default file manager activity 77 | static const String ACTION_OPEN_DOCUMENT_TREE = 78 | "android.intent.action.OPEN_DOCUMENT_TREE"; 79 | static const String ACTION_PASTE = "android.intent.action.PASTE"; 80 | 81 | /// will be made to work in future releases 82 | static const String ACTION_PICK = "android.intent.action.PICK"; 83 | 84 | /// power usage summary displaying activity 85 | static const String ACTION_POWER_USAGE_SUMMARY = 86 | "android.intent.action.POWER_USAGE_SUMMARY"; 87 | 88 | /// processes text 89 | static const String ACTION_PROCESS_TEXT = 90 | "android.intent.action.PROCESS_TEXT"; 91 | static const String ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW"; 92 | 93 | /// search for a certain term, put as EXTRA_TEXT 94 | static const String ACTION_SEARCH = "android.intent.action.SEARCH"; 95 | 96 | /// share text/ document/ multimedia 97 | static const String ACTION_SEND = "android.intent.action.SEND"; 98 | 99 | /// send to a certain user, denoted by data URI 100 | static const String ACTION_SENDTO = "android.intent.action.SENDTO"; 101 | 102 | /// send multiple documents at a time 103 | static const String ACTION_SEND_MULTIPLE = 104 | "android.intent.action.SEND_MULTIPLE"; 105 | 106 | /// set wallpaper activity 107 | static const String ACTION_SET_WALLPAPER = 108 | "android.intent.action.SET_WALLPAPER"; 109 | 110 | /// opens app info displaying activity 111 | static const String ACTION_SHOW_APP_INFO = 112 | "android.intent.action.SHOW_APP_INFO"; 113 | 114 | /// synchronize app data with backend 115 | static const String ACTION_SYNC = "android.intent.action.SYNC"; 116 | static const String ACTION_SYSTEM_TUTORIAL = 117 | "android.intent.action.SYSTEM_TUTORIAL"; 118 | 119 | /// translate data passed with intent 120 | static const String ACTION_TRANSLATE = "android.intent.action.TRANSLATE"; 121 | static const String ACTION_VOICE_COMMAND = 122 | "android.intent.action.VOICE_COMMAND"; 123 | 124 | /// perform a web search using default search activity 125 | static const String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; 126 | 127 | /// intent to capture image, using default camera activity 128 | static const String ACTION_IMAGE_CAPTURE = 129 | "android.media.action.IMAGE_CAPTURE"; 130 | 131 | /// intent used for capturing video, using default camera of system 132 | static const String ACTION_VIDEO_CAPTURE = 133 | "android.media.action.VIDEO_CAPTURE"; 134 | } 135 | -------------------------------------------------------------------------------- /lib/category.dart: -------------------------------------------------------------------------------- 1 | class Category { 2 | static const String CATEGORY_ALTERNATIVE = 3 | "android.intent.category.ALTERNATIVE"; 4 | static const String CATEGORY_APP_BROWSER = 5 | "android.intent.category.APP_BROWSER"; 6 | static const String CATEGORY_APP_CALCULATOR = 7 | "android.intent.category.APP_CALCULATOR"; 8 | static const String CATEGORY_APP_CALENDAR = 9 | "android.intent.category.APP_CALENDAR"; 10 | static const String CATEGORY_APP_CONTACTS = 11 | "android.intent.category.APP_CONTACTS"; 12 | static const String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"; 13 | static const String CATEGORY_APP_FILES = "android.intent.category.APP_FILES"; 14 | 15 | static const String CATEGORY_APP_GALLERY = 16 | "android.intent.category.APP_GALLERY"; 17 | static const String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"; 18 | static const String CATEGORY_APP_MARKET = 19 | "android.intent.category.APP_MARKET"; 20 | static const String CATEGORY_APP_MESSAGING = 21 | "android.intent.category.APP_MESSAGING"; 22 | static const String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"; 23 | static const String CATEGORY_APP_BROWSABLE = 24 | "android.intent.category.APP_BROWSABLE"; 25 | static const String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; 26 | static const String CATEGORY_PREFERENCE = 27 | "android.intent.category.PREFERENCE"; 28 | static const String CATEGORY_INFO = "android.intent.category.INFO"; 29 | } 30 | -------------------------------------------------------------------------------- /lib/extra.dart: -------------------------------------------------------------------------------- 1 | class Extra { 2 | static const String EXTRA_ALLOW_MULTIPLE = 3 | "android.intent.extra.ALLOW_MULTIPLE"; 4 | static const String EXTRA_BCC = "android.intent.extra.BCC"; 5 | static const String EXTRA_CC = "android.intent.extra.CC"; 6 | static const String EXTRA_CONTENT_ANNOTATIONS = 7 | "android.intent.extra.CONTENT_ANNOTATIONS"; 8 | static const String EXTRA_DONT_KILL_APP = 9 | 'android.intent.extra.DONT_KILL_APP'; 10 | static const String EXTRA_EMAIL = "android.intent.extra.EMAIL"; 11 | static const String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"; 12 | static const String EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY"; 13 | static const String EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES"; 14 | static const String EXTRA_ORIGINATING_URI = 15 | "android.intent.extra.ORIGINATING_URI"; 16 | static const String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME"; 17 | static const String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; 18 | static const String EXTRA_PROCESS_TEXT = "android.intent.extra.PROCESS_TEXT"; 19 | static const String EXTRA_PROCESS_TEXT_READONLY = 20 | "android.intent.extra.PROCESS_TEXT_READONLY"; 21 | static const String EXTRA_STREAM = 'android.intent.extra.STREAM'; 22 | static const String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; 23 | static const String EXTRA_TEXT = "android.intent.extra.TEXT"; 24 | static const String EXTRA_TITLE = "android.intent.extra.TITLE"; 25 | static const String CAMERA_FACING = "android.intent.extras.CAMERA_FACING"; 26 | } 27 | -------------------------------------------------------------------------------- /lib/flag.dart: -------------------------------------------------------------------------------- 1 | class Flag { 2 | static const int FLAG_ACTIVITY_CLEAR_TASK = 0x00008000; 3 | static const int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; 4 | static const int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000; 5 | static const int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000; 6 | static const int FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000; 7 | static const int FLAG_ACTIVITY_MATCH_EXTERNAL = 0x00000800; 8 | static const int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000; 9 | static const int FLAG_ACTIVITY_NEW_DOCUMENT = 0x00080000; 10 | static const int FLAG_ACTIVITY_NEW_TASK = 0x10000000; 11 | static const int FLAG_ACTIVITY_NO_ANIMATION = 0x00010000; 12 | static const int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; 13 | static const int FLAG_ACTIVITY_REORDER_TO_FRONT = 0x00020000; 14 | static const int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; 15 | static const int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 0x00002000; 16 | static const int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000; 17 | static const int FLAG_ACTIVITY_TASK_ON_HOME = 0x00004000; 18 | static const int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010; 19 | static const int FLAG_FROM_BACKGROUND = 0x00000004; 20 | static const int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020; 21 | } 22 | -------------------------------------------------------------------------------- /lib/intent.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | class Intent { 4 | Intent() { 5 | this._category = []; 6 | this._flag = []; 7 | this._extra = {}; 8 | this._typeInfo = {}; 9 | } 10 | 11 | static const MethodChannel _channel = const MethodChannel('intent'); 12 | 13 | String _action; 14 | String _type; 15 | String _package; 16 | Uri _data; 17 | List _category; 18 | List _flag; 19 | Map _extra; 20 | Map _typeInfo; 21 | 22 | /// Adds category for this intent 23 | /// 24 | /// Supported values can be found in Category class 25 | addCategory(String category) => this._category.add(category); 26 | 27 | /// Sets flags for intent 28 | /// 29 | /// Get possible flag values from Flag class 30 | addFlag(int flag) => this._flag.add(flag); 31 | 32 | /// Aims to handle type information for extra data attached 33 | /// encodes type information as string, passed through PlatformChannel, 34 | /// and finally gets unpacked in platform specific code ( Kotlin ) 35 | /// 36 | /// TypedExtra class holds predefined constants ( type information ), 37 | /// consider using those 38 | putExtra(String extra, dynamic data, {String type}) { 39 | this._extra[extra] = data; 40 | if (type != null) this._typeInfo[extra] = type; 41 | } 42 | 43 | /// Sets what action this intent is supposed to do 44 | /// 45 | /// Possible values can be found in Action class 46 | setAction(String action) => this._action = action; 47 | 48 | /// Sets data type or mime-type 49 | setType(String type) => this._type = type; 50 | 51 | /// Explicitly sets package information using which 52 | /// Intent to be resolved, preventing chooser from showing up 53 | setPackage(String package) => this._package = package; 54 | 55 | /// Sets data, on which intent will perform selected action 56 | setData(Uri data) => this._data = data; 57 | 58 | /// You'll most likely use this method. 59 | /// 60 | /// Will invoke an activity using platform channel, while passing all parameters and setting them in intent 61 | /// 62 | /// *Now supports setting specific package name, which asks Android to 63 | /// resolve this Intent using that package, provided it's available* 64 | Future startActivity({bool createChooser: false}) { 65 | Map parameters = {}; 66 | 67 | if (_action != null) parameters['action'] = _action; 68 | if (_type != null) parameters['type'] = _type; 69 | if (_package != null) parameters['package'] = _package; 70 | if (_data != null) parameters['data'] = _data.toString(); 71 | if (_category.isNotEmpty) parameters['category'] = _category; 72 | if (_flag.isNotEmpty) parameters['flag'] = _flag; 73 | if (_extra.isNotEmpty) parameters['extra'] = _extra; 74 | if (_typeInfo.isNotEmpty) parameters['typeInfo'] = _typeInfo; 75 | 76 | parameters['chooser'] = createChooser; 77 | 78 | return _channel.invokeMethod('startActivity', parameters); 79 | } 80 | 81 | /// When you're interested in obtaining some result 82 | /// from intent, then this method needs to be called. Returns 83 | /// a future, which will be resolved if platform call gets 84 | /// successful, otherwise results into error. 85 | Future> startActivityForResult({bool createChooser: false}) { 86 | Map parameters = {}; 87 | 88 | if (_action != null) parameters['action'] = _action; 89 | if (_type != null) parameters['type'] = _type; 90 | if (_package != null) parameters['package'] = _package; 91 | if (_data != null) parameters['data'] = _data.toString(); 92 | if (_category.isNotEmpty) parameters['category'] = _category; 93 | if (_flag.isNotEmpty) parameters['flag'] = _flag; 94 | if (_extra.isNotEmpty) parameters['extra'] = _extra; 95 | if (_typeInfo.isNotEmpty) parameters['typeInfo'] = _typeInfo; 96 | 97 | parameters['chooser'] = createChooser; 98 | 99 | return _channel 100 | .invokeMethod('startActivityForResult', parameters) 101 | .then((data) => List.from(data)); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/typedExtra.dart: -------------------------------------------------------------------------------- 1 | /// This class holds some constant strings for user accessibility, 2 | /// so that end users don't need to hardcode type information 3 | /// in updated `Intent.putExtra(String extra, dynamic data, {String type})` 4 | /// method which aims to facilitate better type handling for Intent data. 5 | /// 6 | /// Prior to it, all extra passed to Intent, were getting type casted to 7 | /// `String`, which was bad implementation - trying to improve that 8 | /// 9 | /// *This won't break any existing codebase* 10 | class TypedExtra { 11 | /// singular type information 12 | 13 | static const String booleanExtra = "boolean"; 14 | 15 | static const String byteExtra = "byte"; 16 | 17 | static const String shortExtra = "short"; 18 | 19 | static const String intExtra = "int"; 20 | 21 | static const String longExtra = "long"; 22 | 23 | static const String floatExtra = "float"; 24 | 25 | static const String doubleExtra = "double"; 26 | 27 | static const String charExtra = "char"; 28 | 29 | static const String stringExtra = "String"; 30 | 31 | /// collection types from aforementioned types 32 | 33 | static const String booleanListExtra = "boolean[]"; 34 | 35 | static const String byteListExtra = "byte[]"; 36 | 37 | static const String shortListExtra = "short[]"; 38 | 39 | static const String intListExtra = "int[]"; 40 | 41 | static const String longListExtra = "long[]"; 42 | 43 | static const String floatListExtra = "float[]"; 44 | 45 | static const String doubleListExtra = "double[]"; 46 | 47 | static const String charListExtra = "char[]"; 48 | 49 | static const String stringListExtra = "String[]"; 50 | } 51 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: intent 2 | description: A simple to use Flutter plugin to deal with Android Intents - your one-stop-solution for Android Intents. 3 | version: 1.4.0 4 | homepage: https://github.com/itzmeanjan/intent 5 | 6 | environment: 7 | sdk: ">=2.1.0 <3.0.0" 8 | flutter: ">=1.12.0 <2.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | flutter: 19 | plugin: 20 | platforms: 21 | android: 22 | package: io.github.itzmeanjan.intent 23 | pluginClass: IntentPlugin 24 | -------------------------------------------------------------------------------- /test/intent_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | const MethodChannel channel = MethodChannel('intent'); 6 | 7 | setUp(() { 8 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 9 | return '42'; 10 | }); 11 | }); 12 | 13 | tearDown(() { 14 | channel.setMockMethodCallHandler(null); 15 | }); 16 | } 17 | --------------------------------------------------------------------------------