├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── libs │ └── opensharesdk-release.aar ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── cc │ └── openshare │ └── plugin │ └── flutter_openshare │ └── FlutterOpensharePlugin.java ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── cc │ │ │ │ │ └── openshare │ │ │ │ │ └── plugin │ │ │ │ │ └── flutter_openshare_example │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lanuch.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lanuch.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lanuch.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lanuch.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── lanuch.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── flutter_export_environment.sh │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── 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 │ ├── app_config.dart │ ├── auto_invitecode.dart │ ├── bloc │ │ ├── application_bloc.dart │ │ ├── base_provider_bloc.dart │ │ └── home_page_bloc.dart │ ├── main.dart │ ├── models │ │ └── user_model.dart │ ├── services │ │ ├── http_process.dart │ │ ├── http_response.dart │ │ └── http_service.dart │ └── widgets │ │ ├── common_dialogs.dart │ │ ├── countdown.dart │ │ ├── coupon_box.dart │ │ ├── function.dart │ │ └── reward_widget.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── flutter_openshare.iml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterOpensharePlugin.h │ ├── FlutterOpensharePlugin.m │ └── libOpenShareSDK │ │ ├── OpenShareSDK.h │ │ └── libOpenShareSDK.a └── flutter_openshare.podspec ├── lib └── flutter_openshare.dart ├── pubspec.lock ├── pubspec.yaml ├── snapshots └── 20200820112817.jpg └── test └── flutter_openshare_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | .idea/ 7 | build/ 8 | -------------------------------------------------------------------------------- /.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: fabeb2a16f1d008ab8230f450c49141d35669798 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter", 9 | "program": "example/lib/main.dart", 10 | "request": "launch", 11 | "type": "dart" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter_OpenShare Plugin 2 | Flutter_OpenShare是一款集成OpenShareSDK自动获取邀请码或参数的flutter 插件,可以帮助开发者快速集成 3 | 4 | ### 产品服务 5 | #### 1. 智能传参 6 | ``` 7 | 智能传递参数,绑定用户关系,高效提升用户转换率 8 | ``` 9 | #### 2. 快速安装和一键唤醒 10 | ``` 11 | 在各社交平台app中快速下载安装和直接一键唤醒,兼容各移动端浏览器 12 | ``` 13 | #### 3. 渠道统计 14 | ``` 15 | 追踪用户来源,统计推广效果 16 | ``` 17 | #### 4. 场景还原 18 | ``` 19 | 场景还原,促活唤醒APP 20 | ``` 21 | ### 应用场景 22 | 23 | 1. 免填邀请码,智能绑定用户关系 24 | 25 | 2. 一键拉起,智能唤醒 26 | 27 | 3. 快速下载,在社交平台中快速下载 28 | 29 | 4. 免渠道打包,不用再为推广而渠道打包,快速区分与统计渠道来源 30 | 31 | ### 推广渠道 32 | 1.邀请码 33 | 2.软文推广 34 | 3.广告营销 35 | 4.商品分销 36 | 注:可以自定义推广渠道,上面几个只是简单举例 37 | 38 | ### 测试Demo 39 | 40 | ### 41 | ``` 42 | 扫描二维码下载测试apk (测试demo暂时只有apk,iOS未上架) 43 | ``` 44 | 45 | 46 | ## APP集成 47 | 48 | 注:由于google帐号忘记了,所以不能提交到pub上面 49 | 50 | ### 如何集成到我的flutter项目中? 51 | 52 | 在项目根目录下建一个plugin目录 下载此库到该目录中去 53 | 54 | 在包管理文件pubspec.yaml中添加如下: 55 | 56 | ``` 57 | dev_dependencies: 58 | umengshare: 59 | path: ./plugin/flutter_openshare 60 | ``` 61 | 62 | ``` 63 | 提供7天免费接入测试 64 | 65 | 提供原生SDK接入服务 66 | 67 | 提供SDK集成技术服务 68 | ``` 69 | 申请appid和appkey需要联系Q:189316826 70 | 71 | 自建平台联系Q:189316826 72 | 73 | ### ios 74 | 75 | #### 1.appid配置 76 | 修改配置文件info.plist 77 | ``` 78 | cc.openshare.APPID 79 | appid 80 | ``` 81 | #### 2.secheme配置 82 | 修改配置文件info.plist 83 | ``` 84 | CFBundleURLTypes 85 | 86 | 87 | CFBundleTypeRole 88 | Editor 89 | CFBundleURLName 90 | 平台分配的域名 91 | CFBundleURLSchemes 92 | 93 | 平台分配的secheme 94 | 95 | 96 | 97 | ``` 98 | #### 3.通用链(Universal Link) 99 | 100 | ### anroid 101 | #### 1.appid配置 102 | 修改文件AndroidManifest.xml 103 | 104 | ``` 105 | 108 | ``` 109 | #### 2.secheme配置 110 | ``` ... 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | ``` 119 | #### 3.App Links 120 | 注:这个在浏览器中不需要询问就能打开app和ios通用链差不多,表现方式不一样 121 | 122 | ### 功能函数及事件监听 123 | 监听 124 | 125 | ``` 126 | addEventHandler( 127 | onInstallMessage:(OSInstall res)=>{},//接收安装参数 128 | onWakeUpMessage: (OSWakeUp res)=>{}//接收唤醒参数 129 | ); 130 | ``` 131 | 132 | 初始化 133 | ``` 134 | setup() 135 | ``` 136 | 获取安装参数 137 | ``` 138 | getInstallParams(OSInstall res) 139 | ``` 140 | 获取唤醒参数 141 | ``` 142 | getWakeupParams(OSWakeup res) 143 | ``` 144 | ### 示例 145 | ``` 146 | _openshare = new FlutterOpenshare(); 147 | _openshare.addEventHandler( 148 | onInstallMessage: (OSInstall res) { 149 | if(res.ret==0){ 150 | //TODO 151 | } 152 | }, onWakeUpMessage: (OSWakeUp res) { 153 | if(res.ret==0){ 154 | //TODO 155 | } 156 | }); 157 | _openshare.setup(); 158 | ``` 159 | -------------------------------------------------------------------------------- /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 'cc.openshare.plugin.flutter_openshare' 2 | version '1.0' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.0' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 28 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | } 35 | dependencies { 36 | implementation fileTree(include: ['*.*'], dir: 'libs') 37 | } 38 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 6 | -------------------------------------------------------------------------------- /android/libs/opensharesdk-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/android/libs/opensharesdk-release.aar -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_openshare' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/cc/openshare/plugin/flutter_openshare/FlutterOpensharePlugin.java: -------------------------------------------------------------------------------- 1 | package cc.openshare.plugin.flutter_openshare; 2 | 3 | import android.app.Activity; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | 8 | import androidx.annotation.NonNull; 9 | //import androidx.localbroadcastmanager.content.LocalBroadcastManager; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | import cc.openshare.sdk.opensharesdk.OpenShare; 15 | import cc.openshare.sdk.opensharesdk.listener.InstallListener; 16 | import cc.openshare.sdk.opensharesdk.listener.WakeUpListener; 17 | import cc.openshare.sdk.opensharesdk.model.OSInstall; 18 | import cc.openshare.sdk.opensharesdk.model.OSWakeUp; 19 | import cc.openshare.sdk.opensharesdk.model.OSResponse; 20 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 21 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 22 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 23 | import io.flutter.plugin.common.BinaryMessenger; 24 | import io.flutter.plugin.common.MethodCall; 25 | import io.flutter.plugin.common.MethodChannel; 26 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler; 27 | import io.flutter.plugin.common.MethodChannel.Result; 28 | import io.flutter.plugin.common.PluginRegistry; 29 | 30 | /** 31 | * FlutterOpensharePlugin 32 | */ 33 | public class FlutterOpensharePlugin implements FlutterPlugin, MethodCallHandler, PluginRegistry.NewIntentListener, ActivityAware { 34 | private Context applicationContext; 35 | private MethodChannel methodChannel; 36 | private Activity mainActivity; 37 | 38 | final private WakeUpListener wakeUpListener = new WakeUpListener() { 39 | @Override 40 | public void onWakeUpFinish(OSResponse res) { 41 | methodChannel.invokeMethod("wakeup", osWakeUpToMap(res)); 42 | } 43 | }; 44 | 45 | 46 | private void onAttachedToEngine(Context context, BinaryMessenger binaryMessenger) { 47 | this.methodChannel = new MethodChannel(binaryMessenger, "openshare.cc/Flutter_OpenShare"); 48 | this.applicationContext = context; 49 | methodChannel.setMethodCallHandler(this); 50 | OpenShare.getInstance().setInstallListener(new InstallListener() { 51 | @Override 52 | public void onInstallFinish(OSResponse res) { 53 | methodChannel.invokeMethod("install", osInstallToMap(res)); 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { 60 | onAttachedToEngine(binding.getApplicationContext(), binding.getBinaryMessenger()); 61 | } 62 | 63 | @Override 64 | public void onDetachedFromEngine(FlutterPluginBinding binding) { 65 | methodChannel.setMethodCallHandler(null); 66 | } 67 | 68 | @Override 69 | public void onAttachedToActivity(ActivityPluginBinding binding) { 70 | binding.addOnNewIntentListener(this); 71 | setActivity(binding.getActivity()); 72 | OpenShare.getInstance().setWakeUpListener(mainActivity.getIntent(), wakeUpListener); 73 | } 74 | 75 | @Override 76 | public void onDetachedFromActivityForConfigChanges() { 77 | setActivity(null); 78 | } 79 | 80 | @Override 81 | public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) { 82 | binding.addOnNewIntentListener(this); 83 | setActivity(binding.getActivity()); 84 | 85 | } 86 | 87 | @Override 88 | public void onDetachedFromActivity() { 89 | this.mainActivity = null; 90 | } 91 | 92 | private void setActivity(Activity flutterActivity) { 93 | this.mainActivity = flutterActivity; 94 | } 95 | 96 | 97 | @Override 98 | public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { 99 | if (call.method.equals("setup")) { 100 | OpenShare.getInstance().init(this.applicationContext); 101 | result.success(null); 102 | } else if (call.method.equals("getInstallParams")) { 103 | OSResponse osInstall = OpenShare.getInstance().getInstallParams(); 104 | result.success(osInstallToMap(osInstall)); 105 | } else if (call.method.equals("getWakeUpParams")) { 106 | OSResponse osWakeUp = OpenShare.getInstance().getWakeUpParams(); 107 | result.success(osWakeUpToMap(osWakeUp)); 108 | } else if (call.method.equals("getUUID")) { 109 | String uuid = OpenShare.getInstance().getUUID(); 110 | result.success(uuid); 111 | } else { 112 | result.notImplemented(); 113 | } 114 | } 115 | 116 | private Map osInstallToMap(OSResponse osInstall) { 117 | Map map = new HashMap<>(); 118 | map.put("ret", osInstall.ret); 119 | map.put("msg", osInstall.msg); 120 | if (osInstall.ret == 0 && osInstall.data != null) { 121 | Map data = new HashMap<>(); 122 | data.put("value", osInstall.data.params); 123 | data.put("channelCode", osInstall.data.channelCode); 124 | map.put("data", data); 125 | } 126 | return map; 127 | } 128 | 129 | private Map osWakeUpToMap(OSResponse osWakeUp) { 130 | Map map = new HashMap<>(); 131 | map.put("ret", osWakeUp.ret); 132 | map.put("msg", osWakeUp.msg); 133 | if (osWakeUp.ret == 0 && osWakeUp.data != null) { 134 | Map data = new HashMap<>(); 135 | data.put("val", osWakeUp.data.val); 136 | data.put("path", osWakeUp.data.path); 137 | map.put("data", data); 138 | } 139 | return map; 140 | } 141 | 142 | @Override 143 | public boolean onNewIntent(Intent intent) { 144 | OpenShare.getInstance().setWakeUpListener(intent, wakeUpListener); 145 | return false; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /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 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /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: fabeb2a16f1d008ab8230f450c49141d35669798 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_openshare_example 2 | 3 | Demonstrates how to use the flutter_openshare plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "cc.openshare.plugin.flutter_openshare_example" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 42 | ndk{ abiFilters "armeabi-v7a"} 43 | } 44 | 45 | buildTypes { 46 | release { 47 | // TODO: Add your own signing config for the release build. 48 | // Signing with the debug keys for now, so `flutter run --release` works. 49 | signingConfig signingConfigs.debug 50 | } 51 | } 52 | } 53 | 54 | flutter { 55 | source '../..' 56 | } 57 | 58 | dependencies { 59 | testImplementation 'junit:junit:4.12' 60 | androidTestImplementation 'androidx.test:runner:1.1.1' 61 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 62 | } 63 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 26 | 30 | 34 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 62 | 63 | 64 | 66 | 69 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/cc/openshare/plugin/flutter_openshare_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package cc.openshare.plugin.flutter_openshare_example; 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity; 5 | import io.flutter.embedding.engine.FlutterEngine; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { 11 | GeneratedPluginRegistrant.registerWith(flutterEngine); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/lanuch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-hdpi/lanuch.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/lanuch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-mdpi/lanuch.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/lanuch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xhdpi/lanuch.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/lanuch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xxhdpi/lanuch.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/lanuch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/android/app/src/main/res/mipmap-xxxhdpi/lanuch.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 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.2-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/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=D:\Program Files\flutter" 4 | export "FLUTTER_APPLICATION_PATH=D:\workplace\flutter\flutter_openshare\example" 5 | export "FLUTTER_TARGET=lib\main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build\ios" 8 | export "OTHER_LDFLAGS=$(inherited) -framework Flutter" 9 | export "FLUTTER_FRAMEWORK_DIR=D:\Program Files\flutter\bin\cache\artifacts\engine\ios" 10 | export "FLUTTER_BUILD_NAME=1.0.4" 11 | export "FLUTTER_BUILD_NUMBER=1.0.4" 12 | export "DART_OBFUSCATION=false" 13 | export "TRACK_WIDGET_CREATION=false" 14 | export "TREE_SHAKE_ICONS=false" 15 | export "PACKAGE_CONFIG=.packages" 16 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | generated_key_values = {} 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) do |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | generated_key_values[podname] = podpath 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | end 32 | generated_key_values 33 | end 34 | 35 | target 'Runner' do 36 | # Flutter Pod 37 | 38 | copied_flutter_dir = File.join(__dir__, 'Flutter') 39 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') 40 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') 41 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) 42 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. 43 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. 44 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. 45 | 46 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') 47 | unless File.exist?(generated_xcode_build_settings_path) 48 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" 49 | end 50 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) 51 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; 52 | 53 | unless File.exist?(copied_framework_path) 54 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) 55 | end 56 | unless File.exist?(copied_podspec_path) 57 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) 58 | end 59 | end 60 | 61 | # Keep pod path relative so it can be checked into Podfile.lock. 62 | pod 'Flutter', :path => 'Flutter' 63 | 64 | # Plugin Pods 65 | 66 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 67 | # referring to absolute paths on developers' machines. 68 | system('rm -rf .symlinks') 69 | system('mkdir -p .symlinks/plugins') 70 | plugin_pods = parse_KV_file('../.flutter-plugins') 71 | plugin_pods.each do |name, path| 72 | symlink = File.join('.symlinks', 'plugins', name) 73 | File.symlink(path, symlink) 74 | pod name, :path => File.join(symlink, 'ios') 75 | end 76 | end 77 | 78 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 79 | install! 'cocoapods', :disable_input_output_paths => true 80 | 81 | post_install do |installer| 82 | installer.pods_project.targets.each do |target| 83 | target.build_configurations.each do |config| 84 | config.build_settings['ENABLE_BITCODE'] = 'NO' 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /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 | 17D518A159CDCC7A43CE580A /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A43A435A5670B31D65021AB /* libPods-Runner.a */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 14 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 15 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 16 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 17 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXCopyFilesBuildPhase section */ 21 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 22 | isa = PBXCopyFilesBuildPhase; 23 | buildActionMask = 2147483647; 24 | dstPath = ""; 25 | dstSubfolderSpec = 10; 26 | files = ( 27 | ); 28 | name = "Embed Frameworks"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 008DECB1D31E6E6C6F82E187 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 35 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 36 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 37 | 26E8CD0CF83A74D006C2F5CF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 38 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 39 | 5A43A435A5670B31D65021AB /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 41 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 44 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 45 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | AEEF3300479950C75BF0503C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 17D518A159CDCC7A43CE580A /* libPods-Runner.a in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 1396C66CCBF14C8FA13D3374 /* Pods */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | AEEF3300479950C75BF0503C /* Pods-Runner.debug.xcconfig */, 70 | 26E8CD0CF83A74D006C2F5CF /* Pods-Runner.release.xcconfig */, 71 | 008DECB1D31E6E6C6F82E187 /* Pods-Runner.profile.xcconfig */, 72 | ); 73 | path = Pods; 74 | sourceTree = ""; 75 | }; 76 | 9740EEB11CF90186004384FC /* Flutter */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | 1396C66CCBF14C8FA13D3374 /* Pods */, 94 | DEB0A81AA2A2CC2549C8480A /* Frameworks */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 97C146EF1CF9000F007C117D /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146EE1CF9000F007C117D /* Runner.app */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 97C146F01CF9000F007C117D /* Runner */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 111 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 114 | 97C147021CF9000F007C117D /* Info.plist */, 115 | 97C146F11CF9000F007C117D /* Supporting Files */, 116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 118 | ); 119 | path = Runner; 120 | sourceTree = ""; 121 | }; 122 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 97C146F21CF9000F007C117D /* main.m */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | DEB0A81AA2A2CC2549C8480A /* Frameworks */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 5A43A435A5670B31D65021AB /* libPods-Runner.a */, 134 | ); 135 | name = Frameworks; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 97C146ED1CF9000F007C117D /* Runner */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 144 | buildPhases = ( 145 | 7D6AEEB76E938C9D5CFE6704 /* [CP] Check Pods Manifest.lock */, 146 | 9740EEB61CF901F6004384FC /* Run Script */, 147 | 97C146EA1CF9000F007C117D /* Sources */, 148 | 97C146EB1CF9000F007C117D /* Frameworks */, 149 | 97C146EC1CF9000F007C117D /* Resources */, 150 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 151 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 152 | EF46E1DC3CE8B1ACE946A527 /* [CP] Embed Pods Frameworks */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = Runner; 159 | productName = Runner; 160 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 97C146E61CF9000F007C117D /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | LastUpgradeCheck = 1020; 170 | ORGANIZATIONNAME = ""; 171 | TargetAttributes = { 172 | 97C146ED1CF9000F007C117D = { 173 | CreatedOnToolsVersion = 7.3.1; 174 | DevelopmentTeam = JDTG466MW2; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = en; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = 97C146E51CF9000F007C117D; 187 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | 97C146ED1CF9000F007C117D /* Runner */, 192 | ); 193 | }; 194 | /* End PBXProject section */ 195 | 196 | /* Begin PBXResourcesBuildPhase section */ 197 | 97C146EC1CF9000F007C117D /* Resources */ = { 198 | isa = PBXResourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 202 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 203 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 204 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | /* End PBXResourcesBuildPhase section */ 209 | 210 | /* Begin PBXShellScriptBuildPhase section */ 211 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Thin Binary"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 224 | }; 225 | 7D6AEEB76E938C9D5CFE6704 /* [CP] Check Pods Manifest.lock */ = { 226 | isa = PBXShellScriptBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | ); 230 | inputFileListPaths = ( 231 | ); 232 | inputPaths = ( 233 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 234 | "${PODS_ROOT}/Manifest.lock", 235 | ); 236 | name = "[CP] Check Pods Manifest.lock"; 237 | outputFileListPaths = ( 238 | ); 239 | outputPaths = ( 240 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | shellPath = /bin/sh; 244 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 245 | showEnvVarsInLog = 0; 246 | }; 247 | 9740EEB61CF901F6004384FC /* Run Script */ = { 248 | isa = PBXShellScriptBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | inputPaths = ( 253 | ); 254 | name = "Run Script"; 255 | outputPaths = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | shellPath = /bin/sh; 259 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 260 | }; 261 | EF46E1DC3CE8B1ACE946A527 /* [CP] Embed Pods Frameworks */ = { 262 | isa = PBXShellScriptBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | inputPaths = ( 267 | ); 268 | name = "[CP] Embed Pods Frameworks"; 269 | outputPaths = ( 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 274 | showEnvVarsInLog = 0; 275 | }; 276 | /* End PBXShellScriptBuildPhase section */ 277 | 278 | /* Begin PBXSourcesBuildPhase section */ 279 | 97C146EA1CF9000F007C117D /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 284 | 97C146F31CF9000F007C117D /* main.m in Sources */, 285 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXSourcesBuildPhase section */ 290 | 291 | /* Begin PBXVariantGroup section */ 292 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 97C146FB1CF9000F007C117D /* Base */, 296 | ); 297 | name = Main.storyboard; 298 | sourceTree = ""; 299 | }; 300 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 97C147001CF9000F007C117D /* Base */, 304 | ); 305 | name = LaunchScreen.storyboard; 306 | sourceTree = ""; 307 | }; 308 | /* End PBXVariantGroup section */ 309 | 310 | /* Begin XCBuildConfiguration section */ 311 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 312 | isa = XCBuildConfiguration; 313 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_ANALYZER_NONNULL = YES; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_COMMA = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_EMPTY_BODY = YES; 328 | CLANG_WARN_ENUM_CONVERSION = YES; 329 | CLANG_WARN_INFINITE_RECURSION = YES; 330 | CLANG_WARN_INT_CONVERSION = YES; 331 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 333 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 335 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 336 | CLANG_WARN_STRICT_PROTOTYPES = YES; 337 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | SUPPORTED_PLATFORMS = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Profile; 361 | }; 362 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 363 | isa = XCBuildConfiguration; 364 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 368 | DEVELOPMENT_TEAM = JDTG466MW2; 369 | ENABLE_BITCODE = NO; 370 | FRAMEWORK_SEARCH_PATHS = ( 371 | "$(inherited)", 372 | "$(PROJECT_DIR)/Flutter", 373 | ); 374 | INFOPLIST_FILE = Runner/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 376 | LIBRARY_SEARCH_PATHS = ( 377 | "$(inherited)", 378 | "$(PROJECT_DIR)/Flutter", 379 | ); 380 | PRODUCT_BUNDLE_IDENTIFIER = cc.openshare.plugin.flutterOpenshareExample; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | VALID_ARCHS = "arm64 arm64e"; 383 | VERSIONING_SYSTEM = "apple-generic"; 384 | }; 385 | name = Profile; 386 | }; 387 | 97C147031CF9000F007C117D /* Debug */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_STRICT_PROTOTYPES = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | DEBUG_INFORMATION_FORMAT = dwarf; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | ENABLE_TESTABILITY = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_DYNAMIC_NO_PIC = NO; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_OPTIMIZATION_LEVEL = 0; 425 | GCC_PREPROCESSOR_DEFINITIONS = ( 426 | "DEBUG=1", 427 | "$(inherited)", 428 | ); 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 431 | GCC_WARN_UNDECLARED_SELECTOR = YES; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 436 | MTL_ENABLE_DEBUG_INFO = YES; 437 | ONLY_ACTIVE_ARCH = YES; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | }; 441 | name = Debug; 442 | }; 443 | 97C147041CF9000F007C117D /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 446 | buildSettings = { 447 | ALWAYS_SEARCH_USER_PATHS = NO; 448 | CLANG_ANALYZER_NONNULL = YES; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 454 | CLANG_WARN_BOOL_CONVERSION = YES; 455 | CLANG_WARN_COMMA = YES; 456 | CLANG_WARN_CONSTANT_CONVERSION = YES; 457 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 459 | CLANG_WARN_EMPTY_BODY = YES; 460 | CLANG_WARN_ENUM_CONVERSION = YES; 461 | CLANG_WARN_INFINITE_RECURSION = YES; 462 | CLANG_WARN_INT_CONVERSION = YES; 463 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 464 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 465 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 466 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 467 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 468 | CLANG_WARN_STRICT_PROTOTYPES = YES; 469 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 470 | CLANG_WARN_UNREACHABLE_CODE = YES; 471 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 472 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 473 | COPY_PHASE_STRIP = NO; 474 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 475 | ENABLE_NS_ASSERTIONS = NO; 476 | ENABLE_STRICT_OBJC_MSGSEND = YES; 477 | GCC_C_LANGUAGE_STANDARD = gnu99; 478 | GCC_NO_COMMON_BLOCKS = YES; 479 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 480 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 481 | GCC_WARN_UNDECLARED_SELECTOR = YES; 482 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 483 | GCC_WARN_UNUSED_FUNCTION = YES; 484 | GCC_WARN_UNUSED_VARIABLE = YES; 485 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 486 | MTL_ENABLE_DEBUG_INFO = NO; 487 | SDKROOT = iphoneos; 488 | SUPPORTED_PLATFORMS = iphoneos; 489 | TARGETED_DEVICE_FAMILY = "1,2"; 490 | VALIDATE_PRODUCT = YES; 491 | }; 492 | name = Release; 493 | }; 494 | 97C147061CF9000F007C117D /* Debug */ = { 495 | isa = XCBuildConfiguration; 496 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 497 | buildSettings = { 498 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 499 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 500 | DEVELOPMENT_TEAM = JDTG466MW2; 501 | ENABLE_BITCODE = NO; 502 | FRAMEWORK_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "$(PROJECT_DIR)/Flutter", 505 | ); 506 | INFOPLIST_FILE = Runner/Info.plist; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 508 | LIBRARY_SEARCH_PATHS = ( 509 | "$(inherited)", 510 | "$(PROJECT_DIR)/Flutter", 511 | ); 512 | PRODUCT_BUNDLE_IDENTIFIER = cc.openshare.plugin.flutterOpenshareExample; 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | VALID_ARCHS = "arm64 arm64e"; 515 | VERSIONING_SYSTEM = "apple-generic"; 516 | }; 517 | name = Debug; 518 | }; 519 | 97C147071CF9000F007C117D /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 522 | buildSettings = { 523 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 524 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 525 | DEVELOPMENT_TEAM = JDTG466MW2; 526 | ENABLE_BITCODE = NO; 527 | FRAMEWORK_SEARCH_PATHS = ( 528 | "$(inherited)", 529 | "$(PROJECT_DIR)/Flutter", 530 | ); 531 | INFOPLIST_FILE = Runner/Info.plist; 532 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 533 | LIBRARY_SEARCH_PATHS = ( 534 | "$(inherited)", 535 | "$(PROJECT_DIR)/Flutter", 536 | ); 537 | PRODUCT_BUNDLE_IDENTIFIER = cc.openshare.plugin.flutterOpenshareExample; 538 | PRODUCT_NAME = "$(TARGET_NAME)"; 539 | VALID_ARCHS = "arm64 arm64e"; 540 | VERSIONING_SYSTEM = "apple-generic"; 541 | }; 542 | name = Release; 543 | }; 544 | /* End XCBuildConfiguration section */ 545 | 546 | /* Begin XCConfigurationList section */ 547 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 548 | isa = XCConfigurationList; 549 | buildConfigurations = ( 550 | 97C147031CF9000F007C117D /* Debug */, 551 | 97C147041CF9000F007C117D /* Release */, 552 | 249021D3217E4FDB00AE95B9 /* Profile */, 553 | ); 554 | defaultConfigurationIsVisible = 0; 555 | defaultConfigurationName = Release; 556 | }; 557 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 558 | isa = XCConfigurationList; 559 | buildConfigurations = ( 560 | 97C147061CF9000F007C117D /* Debug */, 561 | 97C147071CF9000F007C117D /* Release */, 562 | 249021D4217E4FDB00AE95B9 /* Profile */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | /* End XCConfigurationList section */ 568 | }; 569 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 570 | } 571 | -------------------------------------------------------------------------------- /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 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | openshare 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | cc.openshare.APPID 26 | 5cb7dc4caf583048089a46ea 27 | CFBundleURLTypes 28 | 29 | 30 | CFBundleTypeRole 31 | Editor 32 | CFBundleURLName 33 | cc.openshare.link 34 | CFBundleURLSchemes 35 | 36 | uoshare 37 | 38 | 39 | 40 | NSAppTransportSecurity 41 | 42 | NSAllowsArbitraryLoads 43 | 44 | 45 | UIBackgroundModes 46 | 47 | fetch 48 | remote-notification 49 | 50 | UILaunchStoryboardName 51 | LaunchScreen 52 | UIMainStoryboardFile 53 | Main 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | UISupportedInterfaceOrientations~ipad 61 | 62 | UIInterfaceOrientationPortrait 63 | UIInterfaceOrientationPortraitUpsideDown 64 | UIInterfaceOrientationLandscapeLeft 65 | UIInterfaceOrientationLandscapeRight 66 | 67 | UIViewControllerBasedStatusBarAppearance 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /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/app_config.dart: -------------------------------------------------------------------------------- 1 | class AppConfig { 2 | static const String appId = "6798ba831ab1c50279fa44436271a09d"; 3 | static const String apiBaseUrl = "https://service.openshare.cc"; 4 | static const String noPic = "assets/images/nopic.webp"; 5 | static const List httpServiceError = [ 6 | {"ret": -10000, "msg": "不能连接到服务器"}, 7 | {"ret": -10001, "msg": "网络请求超时"}, 8 | {"ret": -10002, "msg": "应用出错,已上报"}, 9 | {"ret": -10003, "msg": "服务器故障,网管正在抢修"}, 10 | {"ret": -10004, "msg": "网络请求已取消"}, 11 | {"ret": -10005, "msg": "不能连接到服务器"}, 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /example/lib/auto_invitecode.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/rendering.dart'; 6 | import 'package:flutter_openshare_example/models/user_model.dart'; 7 | import 'package:flutter_openshare_example/widgets/function.dart'; 8 | import 'package:flutter_openshare_example/widgets/common_dialogs.dart'; 9 | import 'package:flutter_openshare_example/widgets/coupon_box.dart'; 10 | import 'package:qr_flutter/qr_flutter.dart'; 11 | import 'package:image_picker_saver/image_picker_saver.dart'; 12 | 13 | class InviteFriendPage extends StatefulWidget { 14 | final User user; 15 | InviteFriendPage({this.user}); 16 | @override 17 | _InviteFriendPageState createState() => _InviteFriendPageState(); 18 | } 19 | 20 | class _InviteFriendPageState extends State { 21 | final GlobalKey _key = GlobalKey<_InviteFriendPageState>(); 22 | final List _bottomMenus = [ 23 | "保存二维码", 24 | "分享给微信好友", 25 | "分享到朋友圈", 26 | "分享到QQ空间", 27 | "分享到微博" 28 | ]; 29 | @override 30 | void initState() { 31 | super.initState(); 32 | } 33 | 34 | void _showMenus() async { 35 | showModelBottomMenu( 36 | context: context, 37 | menus: _bottomMenus, 38 | onTap: (index) { 39 | if (index == 0) { 40 | _captureImage(); 41 | } else if (index == 1) {} 42 | }); 43 | } 44 | 45 | void _captureImage() async { 46 | RenderRepaintBoundary boundary = _key.currentContext.findRenderObject(); 47 | var image = await boundary.toImage(pixelRatio: 3.0); 48 | ByteData byteData = await image.toByteData(format: ImageByteFormat.png); 49 | // Uint8List pngBytes = byteData.buffer.asUint8List(); 50 | final result = await ImagePickerSaver.saveFile( 51 | fileData: byteData.buffer.asUint8List()); 52 | showSuccess(_key.currentContext, "保存成功", Icons.done); 53 | setTimeOut(() { 54 | Navigator.pop(_key.currentContext); 55 | }, time: 2); 56 | print(result); 57 | } 58 | 59 | Widget _buildAppBar(BuildContext context) => AppBar( 60 | //leading: null, 61 | automaticallyImplyLeading: false, 62 | titleSpacing: 0.0, 63 | leading: IconButton( 64 | onPressed: () { 65 | Navigator.of(context).pop(); 66 | }, 67 | icon: Icon(Icons.arrow_back), 68 | // color: Theme.of(context).primaryColor, 69 | ), 70 | title: Text( 71 | "邀请好友", 72 | // textAlign: TextAlign.left, 73 | ), 74 | centerTitle: true, 75 | actions: [ 76 | IconButton( 77 | onPressed: () { 78 | _showMenus(); 79 | }, 80 | icon: Icon(Icons.more_horiz), 81 | ) 82 | ], 83 | //leading: null, 84 | //centerTitle: true, 85 | //elevation: 0.0, 86 | ); 87 | 88 | @override 89 | Widget build(BuildContext context) { 90 | final Size size = MediaQuery.of(context).size; 91 | return Scaffold( 92 | appBar: _buildAppBar(context), 93 | body: Center( 94 | child: RepaintBoundary( 95 | key: _key, 96 | child: CouponBox( 97 | width: size.width - 30, 98 | height: size.height - 60 - kToolbarHeight, 99 | rate: 5 / 7, 100 | direction: Axis.vertical, 101 | dashedBorderColor: Colors.white, 102 | // backgroundColor: Colors.b, 103 | firstChild: Center( 104 | child: Column( 105 | children: [ 106 | Padding( 107 | padding: EdgeInsets.only(bottom: 20, top: 30), 108 | child: Text( 109 | "${widget.user.name}邀请您一起加入我们", 110 | style: TextStyle(color: Colors.white, fontSize: 16), 111 | ), 112 | ), 113 | Container( 114 | color: Color(0xFFFFFFFF), 115 | padding: EdgeInsets.all(5), 116 | child: QrImage( 117 | version: 10, 118 | data: 119 | "http://web.888899909.com/index.html?sp=${widget.user.hashURL}", 120 | // gapless: false, 121 | size: size.width - 120, 122 | foregroundColor: Colors.black, 123 | ), 124 | ), 125 | ], 126 | ), 127 | ), 128 | secondChild: Center( 129 | child: Padding( 130 | padding: EdgeInsets.only(top: 30), 131 | child: Column( 132 | children: [ 133 | Text( 134 | "自动获取邀请码测试", 135 | style: TextStyle(color: Colors.white, fontSize: 16), 136 | ), 137 | SizedBox( 138 | height: 20, 139 | ), 140 | Text( 141 | "成功注册领取50元优惠券", 142 | style: TextStyle(fontSize: 25, color: Colors.white), 143 | ) 144 | ], 145 | ), 146 | ), 147 | ), 148 | ), 149 | ), 150 | ), 151 | ); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /example/lib/bloc/application_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_openshare_example/bloc/base_provider_bloc.dart'; 6 | // import 'package:rxdart/subjects.dart'; 7 | 8 | class AppBloc extends BlocBase { 9 | final _localeController = new StreamController(); 10 | final _themeController = new StreamController(); 11 | Locale locale; 12 | 13 | //多语言 14 | StreamSink get localeSink => _localeController.sink; 15 | Stream get localeStream => _localeController.stream; 16 | //多主题 17 | StreamSink get themeSink => _themeController.sink; 18 | Stream get themeStream => _themeController.stream; 19 | 20 | final ThemeData normalTheme = new ThemeData( 21 | // platform: TargetPlatform.android, 22 | primaryColorBrightness: Brightness.light, 23 | brightness: Brightness.light, 24 | primaryColor: Color(0xFFFF5A5F),//原色 25 | // indicatorColor: Color(0xFFFF5A5F), 26 | primaryColorDark: Color(0xFFF2F2F2), 27 | primaryColorLight: Color(0xFFF8F8F8), 28 | backgroundColor: Color(0xFFFFFFFF),//背景颜色 29 | scaffoldBackgroundColor:Color(0xFFF2F3F5),//脚手架背景颜色 30 | dividerColor: Color(0XFFF0F0F0), 31 | buttonColor: Color(0xFFFF5A5F), 32 | cardColor: Color(0xFFF2F3F5), 33 | indicatorColor: Color(0xFFFF5A5F), 34 | textTheme: TextTheme( 35 | title: TextStyle(color: Color(0XFF000000),fontSize: 18.0), 36 | body1: TextStyle(color: Color(0XFF666666),fontSize: 14.0), 37 | body2: TextStyle(color: Color(0XFF666666),fontSize: 12.0), 38 | display1: TextStyle(color: Color(0xFFFF5A5F),fontSize: 20.0), 39 | display2: TextStyle(color: Color(0XFF5fe8de),fontSize: 12.0), 40 | display3: TextStyle(color: Color(0XFF5fe8de),fontSize: 14.0), 41 | display4: TextStyle(color: Color(0xFFCCCCCC),fontSize: 16.0), 42 | ), 43 | dialogBackgroundColor: Colors.transparent, 44 | accentColor: Color(0xFFFF5A5F), 45 | fontFamily: "PingFang SC" 46 | ); 47 | final ThemeData darkTheme = new ThemeData( 48 | primaryColorBrightness: Brightness.dark, 49 | brightness: Brightness.dark, 50 | primaryColor: Color(0XFFFFFFFF), 51 | primaryColorDark: Color(0XFF22283E), 52 | primaryColorLight: Color(0XFF282E46), 53 | backgroundColor: Color(0xFF141A32),//背景颜色 54 | scaffoldBackgroundColor:Color(0xFF141A32),//脚手架背景颜色 55 | buttonColor: Color(0xFFFF5A5F), 56 | cardColor: Color(0xFF151521), 57 | indicatorColor: Color(0XFFfcfdfe),//tabbar 58 | dividerColor: Color(0xFF696969),//分割线、边框线 59 | 60 | textTheme: TextTheme( 61 | title: TextStyle(color: Color(0XFFCCCCCC),fontSize: 18.0), 62 | body1: TextStyle(color: Color(0XFFBEBFC1),fontSize: 14.0), 63 | body2: TextStyle(color: Color(0XFFF2F3F5),fontSize: 12.0), 64 | display1: TextStyle(color: Color(0xFFFF5A5F),fontSize: 20.0), 65 | display2: TextStyle(color: Color(0XFFCCCCCC),fontSize: 14.0), 66 | display3: TextStyle(color: Color(0XFF5fe8de),fontSize: 14.0), 67 | display4: TextStyle(color: Color(0XFF5fe8de),fontSize: 16.0), 68 | ), 69 | 70 | // buttonColor: Color(0XFFfcfdfe), 71 | dialogBackgroundColor: Colors.transparent, 72 | accentColor: Color(0XFFCCCCCC), 73 | fontFamily: "PingFang SC" 74 | ); 75 | 76 | AppBloc() { 77 | // _localeController.stream.listen(_listen); 78 | } 79 | 80 | @override 81 | void dispose() { 82 | // TODO: implement dispose 83 | _localeController.close(); 84 | _themeController.close(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /example/lib/bloc/base_provider_bloc.dart: -------------------------------------------------------------------------------- 1 | // 所有 BLoCs 的通用接口 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_openshare_example/services/http_service.dart'; 4 | 5 | abstract class BlocBase { 6 | final HttpService http = HttpService(); 7 | void dispose(); 8 | } 9 | 10 | // 通用 BLoC provider 11 | class BlocProvider extends StatefulWidget { 12 | BlocProvider({ 13 | Key key, 14 | @required this.child, 15 | @required this.bloc, 16 | }) : super(key: key); 17 | 18 | final T bloc; 19 | final Widget child; 20 | 21 | @override 22 | _BlocProviderState createState() => _BlocProviderState(); 23 | 24 | static T of(BuildContext context) { 25 | final type = _typeOf>(); 26 | BlocProvider provider = context.ancestorWidgetOfExactType(type); 27 | return provider.bloc; 28 | } 29 | 30 | static Type _typeOf() => T; 31 | } 32 | 33 | class _BlocProviderState extends State> { 34 | @override 35 | void dispose() { 36 | widget.bloc.dispose(); 37 | super.dispose(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return widget.child; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /example/lib/bloc/home_page_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter_openshare_example/auto_invitecode.dart'; 6 | import 'package:flutter_openshare_example/bloc/base_provider_bloc.dart'; 7 | import 'package:flutter_openshare_example/models/user_model.dart'; 8 | import 'package:flutter_openshare_example/services/http_response.dart'; 9 | import 'package:flutter_openshare/flutter_openshare.dart'; 10 | import 'package:http/io_client.dart'; 11 | import 'package:flutter_mmkv/flutter_mmkv.dart'; 12 | import 'package:rxdart/rxdart.dart'; 13 | import 'dart:convert'; 14 | import 'package:http/http.dart' as httpRequest; 15 | 16 | class HomePageBloc extends BlocBase { 17 | final resultResponse = new BehaviorSubject(); 18 | 19 | // BehaviorSubject get responseStream => resultResponse.stream; 20 | // final userSubject = new BehaviorSubject(); 21 | final combSubject = new BehaviorSubject(); 22 | 23 | // final bindFlagSubject = new BehaviorSubject(); 24 | final inviteUserSubject = new BehaviorSubject(); 25 | final wakeupSubject = new BehaviorSubject(); 26 | final FlutterOpenshare _openshare = new FlutterOpenshare(); 27 | 28 | // final _dio=new Dio(); 29 | final FocusNode nameFocusNode = new FocusNode(); 30 | TextEditingController controller = new TextEditingController(); 31 | FlutterMMKV _mmkv; 32 | String _name; 33 | bool _nameFlag; 34 | String _uuid; 35 | String _inviteUser = ""; 36 | User user; 37 | CombObj _combObj; 38 | 39 | // bool bing 40 | 41 | HomePageBloc() { 42 | nameFocusNode.addListener(() { 43 | if (!nameFocusNode.hasFocus) { 44 | if (_name == null || _name.isEmpty) { 45 | combSubject.add(CombObj(errTxt: "密码不能为空")); 46 | // nameSubject.add("密码不能为空"); 47 | } else { 48 | combSubject.add(CombObj(errTxt: _nameFlag ? null : "密码格式有误")); 49 | } 50 | } else { 51 | combSubject.add(CombObj(errTxt: null)); 52 | } 53 | }); 54 | } 55 | 56 | void init() async { 57 | _mmkv = await FlutterMMKV.getInstance(); 58 | _openshare.addEventHandler( onInstallMessage: _onInstall, onWakeUpMessage: _onWakeUp); 59 | // _openshare.setup(); 60 | 61 | var userStr = await _mmkv.getString("OS_USER"); 62 | if (userStr != null && userStr != "") { 63 | user = User.formString(userStr); 64 | controller.text = user.name; 65 | _combObj = CombObj(user: user); 66 | combSubject.add(_combObj); 67 | } else { 68 | load(); 69 | } 70 | } 71 | 72 | void _onInstall(OSInstall res) async { 73 | // print(res); 74 | _inviteUser = await _mmkv.getString("OS_INVITE_USER"); 75 | if (_inviteUser != null && _inviteUser != "") { 76 | inviteUserSubject.add(_inviteUser); 77 | } else { 78 | if (res.ret == 0) { 79 | Map osRes = json.decode(res.data.value); 80 | // print(osRes['name']); 81 | _inviteUser = osRes['name'] != null ? osRes['name'] : ''; 82 | _mmkv.setString("OS_INVITE_USER", _inviteUser); 83 | inviteUserSubject.add(_inviteUser); 84 | } 85 | } 86 | } 87 | 88 | void _onWakeUp(OSWakeUp res) { 89 | wakeupSubject.add(res.ret == 0 ? res.data.val : res.msg); 90 | } 91 | 92 | bool _certificateCheck(X509Certificate cert, String host, int port) => 93 | host == 'service.openshare.cc'; 94 | 95 | httpRequest.Client _httpClient() { 96 | var ioClient = new HttpClient()..badCertificateCallback = _certificateCheck; 97 | 98 | return new IOClient(ioClient); 99 | } 100 | 101 | Future load() async { 102 | _uuid = await _openshare.getUUID(); 103 | // var res = await _httpClient().get("https://service.openshare.cc/api/test/load?uuid=" + _uuid); 104 | var res = await http.get("/api/test/load?uuid=" + _uuid); 105 | // print(res.body); 106 | HttpServiceResponse result = res.data; 107 | if (result.ret == 0) { 108 | user = User.fromJson(result.data); 109 | _mmkv.setString("OS_USER", user.toListString()); 110 | controller.text = user.name; 111 | _combObj = CombObj(user: user); 112 | combSubject.add(_combObj); 113 | // userSubject.add(user); 114 | } 115 | } 116 | 117 | Future bindName() async { 118 | if (_combObj != null && _combObj.user != null) return; 119 | if (!_nameFlag) return; 120 | _uuid = await _openshare.getUUID(); 121 | var res = await http.get("/api/test/name/bind?name=" + 122 | _name + 123 | "&uuid=" + 124 | _uuid + 125 | "&key=6180b45ab2b7ab1975bb839bf9b97ec4&code=28652140235841" + 126 | (_inviteUser != "" ? ("&invite=" + _inviteUser) : "")); 127 | HttpServiceResponse result = res.data; 128 | if (result.ret == 0) { 129 | user = User(name: _name, hashURL: result.data); 130 | _mmkv.setString("OS_USER", user.toListString()); 131 | _combObj = CombObj(user: user); 132 | combSubject.add(_combObj); 133 | } 134 | resultResponse.add(result); 135 | } 136 | 137 | void nameTextChange(txt) { 138 | _name = txt; 139 | _nameFlag = new RegExp(r"^[a-zA-Z][a-zA-Z0-9_]{4,12}$").hasMatch(_name); 140 | } 141 | 142 | Future ewmTap(BuildContext context) async { 143 | if (_combObj == null || _combObj.user == null) return; 144 | Navigator.of(context).push(CupertinoPageRoute( 145 | builder: (_) => InviteFriendPage( 146 | user: _combObj.user, 147 | ), 148 | maintainState: false)); 149 | } 150 | 151 | @override 152 | void dispose() { 153 | combSubject.close(); 154 | resultResponse.close(); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:after_layout/after_layout.dart'; 2 | import 'package:flutter/material.dart'; 3 | // import 'dart:async'; 4 | import 'package:flutter/cupertino.dart'; 5 | // import 'package:flutter/services.dart'; 6 | // import 'package:flutter_openshare/flutter_openshare.dart'; 7 | import 'package:flutter_openshare_example/auto_invitecode.dart'; 8 | import 'package:flutter_openshare_example/bloc/home_page_bloc.dart'; 9 | import 'package:flutter_openshare_example/models/user_model.dart'; 10 | import 'package:flutter_openshare_example/services/http_response.dart'; 11 | import 'package:flutter_openshare_example/widgets/common_dialogs.dart'; 12 | 13 | void main() => runApp(App()); 14 | 15 | class App extends StatefulWidget { 16 | @override 17 | _AppState createState() => _AppState(); 18 | } 19 | 20 | class _AppState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return MaterialApp( 24 | home: HomePage(), 25 | ); 26 | } 27 | } 28 | 29 | class HomePage extends StatefulWidget { 30 | @override 31 | _HomePageState createState() => _HomePageState(); 32 | } 33 | 34 | class _HomePageState extends State with AfterLayoutMixin { 35 | final _homePageKey=GlobalKey(); 36 | HomePageBloc _bloc; 37 | @override 38 | void initState() { 39 | super.initState(); 40 | _bloc = new HomePageBloc(); 41 | _bloc.resultResponse.stream.listen(responseCallback); 42 | } 43 | 44 | @override 45 | void afterFirstLayout(BuildContext context) { 46 | _bloc.init(); 47 | } 48 | void responseCallback(HttpServiceResponse res) { 49 | showSnackBarMessage(_homePageKey.currentState,res.msg); 50 | } 51 | @override 52 | Widget build(BuildContext context) { 53 | return Scaffold( 54 | key: _homePageKey, 55 | appBar: AppBar( 56 | title: Text("OpenShare App推广助手"), 57 | centerTitle: true, 58 | ), 59 | body: Container( 60 | child: GestureDetector( 61 | behavior: HitTestBehavior.translucent, 62 | onTap: (){ 63 | FocusScope.of(context).requestFocus(FocusNode()); 64 | }, 65 | child: Padding( 66 | padding: EdgeInsets.all(30.0), 67 | child: ListView( 68 | children: [ 69 | StreamBuilder( 70 | initialData: null, 71 | stream: _bloc.combSubject.stream, 72 | builder: (_, snapshot) => TextField( 73 | enabled: snapshot.data==null||snapshot.data.user==null, 74 | controller: _bloc.controller, 75 | focusNode: _bloc.nameFocusNode, 76 | onChanged: _bloc.nameTextChange, 77 | maxLength: 12, 78 | decoration: InputDecoration( 79 | fillColor: Colors.blue.shade100, 80 | filled: true, 81 | hintText: '用户名', 82 | errorText:snapshot.data!=null? snapshot.data.errTxt:null), 83 | ), 84 | ), 85 | SizedBox( 86 | height: 15, 87 | ), 88 | StreamBuilder( 89 | initialData: "", 90 | stream: _bloc.inviteUserSubject.stream, 91 | builder: (_,snapshot)=>Text("邀请人:${snapshot.data}"), 92 | ), 93 | 94 | SizedBox( 95 | height: 15, 96 | ), 97 | RaisedButton( 98 | 99 | color: Color(0xFFFF6600), 100 | textColor: Color(0xFFFFFFFF), 101 | onPressed: () { 102 | _bloc.bindName(); 103 | }, 104 | child: Text("绑定"), 105 | ), 106 | SizedBox( 107 | height: 15, 108 | ), 109 | RaisedButton( 110 | color: Color(0xFFFF6600), 111 | textColor: Color(0xFFFFFFFF), 112 | onPressed: () { 113 | _bloc.ewmTap(context); 114 | }, 115 | child: Text("推广二维码"), 116 | ), 117 | SizedBox( 118 | height: 15, 119 | ), 120 | StreamBuilder( 121 | initialData: "", 122 | stream: _bloc.wakeupSubject.stream, 123 | builder: (_,snapshot)=>Text("唤醒参数:${snapshot.data}"), 124 | ), 125 | ], 126 | )), 127 | ), 128 | ), 129 | ); 130 | } 131 | } 132 | 133 | class MyApp extends StatefulWidget { 134 | @override 135 | _MyAppState createState() => _MyAppState(); 136 | } 137 | 138 | class _MyAppState extends State { 139 | // String _installVal = 'Unknown'; 140 | // String _wakeupVal = 'Unknown'; 141 | // String _installVal2 = 'Unknown'; 142 | // String _wakeupVal2 = 'Unknown'; 143 | // FlutterOpenshare _openshare; 144 | @override 145 | void initState() { 146 | super.initState(); 147 | // _openshare = new FlutterOpenshare(); 148 | // _openshare.addEventHandler(onInstallMessage: (OSInstall res) { 149 | // setState(() { 150 | // _installVal = res.ret == 0 ? res.data.value : res.msg; 151 | // }); 152 | // }, onWakeUpMessage: (OSWakeUp res) { 153 | // setState(() { 154 | // _wakeupVal = res.ret == 0 ? res.data.val : res.msg; 155 | // }); 156 | // }); 157 | // _openshare.setup(); 158 | 159 | // initPlatformState(); 160 | } 161 | 162 | @override 163 | Widget build(BuildContext context) { 164 | return MaterialApp( 165 | home: Scaffold( 166 | appBar: AppBar( 167 | title: const Text('OpenShareSDK Flutter Plugin'), 168 | ), 169 | body: Center( 170 | child: Column( 171 | children: [ 172 | SizedBox( 173 | height: 50, 174 | ), 175 | // Text('自动获取邀请码'), 176 | // Text('安装参数: $_installVal'), 177 | // Text('唤醒参数: $_wakeupVal'), 178 | // SizedBox( 179 | // height: 30, 180 | // ), 181 | // Text('主动获取安装参数: $_installVal2'), 182 | // Text('主动获取唤醒参数: $_wakeupVal2'), 183 | // RaisedButton( 184 | // onPressed: () { 185 | // _openshare.getInstallParams().then((res) { 186 | // setState(() { 187 | // _installVal2 = res.ret == 0 ? res.data.value : res.msg; 188 | // }); 189 | // }); 190 | // }, 191 | // child: Text("getInstallParams"), 192 | // ), 193 | // RaisedButton( 194 | // onPressed: () { 195 | // _openshare.getWakeUpParams().then((res) { 196 | // setState(() { 197 | // _wakeupVal2 = res.ret == 0 ? res.data.val : res.msg; 198 | // }); 199 | // }); 200 | // }, 201 | // child: Text("getWakeUpParams"), 202 | // ), 203 | RaisedButton( 204 | onPressed: () {}, 205 | child: Text("邀请码"), 206 | ), 207 | RaisedButton( 208 | onPressed: () { 209 | Navigator.of(context).push(CupertinoPageRoute( 210 | builder: (_) => InviteFriendPage(), maintainState: false)); 211 | }, 212 | child: Text("软文推广"), 213 | ), 214 | RaisedButton( 215 | onPressed: () {}, 216 | child: Text("广告投放"), 217 | ), 218 | RaisedButton( 219 | onPressed: () {}, 220 | child: Text("商品分销"), 221 | ), 222 | ], 223 | ), 224 | ), 225 | ), 226 | ); 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /example/lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | class User { 2 | String name; 3 | String hashURL; 4 | User({this.name, this.hashURL}); 5 | User.fromJson(Map json) 6 | : this.name = json['name'], 7 | this.hashURL = json['hashURL']; 8 | String toListString() { 9 | return this.name + "@" + this.hashURL; 10 | } 11 | 12 | User.formString(String str) { 13 | if (str=="") return; 14 | List strArr = str.split("@"); 15 | this.name = strArr[0]; 16 | this.hashURL = strArr[1]; 17 | } 18 | } 19 | 20 | class CombObj{ 21 | User user; 22 | String errTxt; 23 | CombObj({this.user,this.errTxt}); 24 | } -------------------------------------------------------------------------------- /example/lib/services/http_process.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_openshare_example/services/http_response.dart'; 2 | 3 | class HttpProcess { 4 | bool loading; 5 | HttpServiceResponse response; 6 | 7 | HttpProcess({this.loading, this.response}); 8 | } -------------------------------------------------------------------------------- /example/lib/services/http_response.dart: -------------------------------------------------------------------------------- 1 | class HttpServiceResponse { 2 | T data; 3 | int ret; 4 | String msg; 5 | HttpServiceResponse({this.data, this.ret, this.msg}); 6 | HttpServiceResponse.fromJson(Map json) 7 | : data = json['data'], 8 | msg = json['msg'], 9 | ret = json['ret']; 10 | } -------------------------------------------------------------------------------- /example/lib/services/http_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | import 'package:dio/adapter.dart'; 4 | import 'package:dio/dio.dart'; 5 | import 'package:flutter_openshare_example/app_config.dart'; 6 | 7 | // import 'package:device_info/device_info.dart'; 8 | import 'package:flutter_openshare_example/services/http_response.dart'; 9 | 10 | // import 'package:mmkv_flutter/mmkv_flutter.dart'; 11 | // import 'package:meiying/utils/app_config.dart'; 12 | 13 | class HttpService { 14 | //SharedPreferences prefs; 15 | // MmkvFlutter mmkv; 16 | List _systemInfo; 17 | 18 | //Map _headers; 19 | Dio _dio; 20 | BaseOptions options; 21 | 22 | //bool _headerFlag=false; 23 | //bool _tokenFlag=false; 24 | //Options _baseOptions; 25 | HttpService() { 26 | this.options = new BaseOptions( 27 | baseUrl: AppConfig.apiBaseUrl, 28 | // connectTimeout: 5000, 29 | // receiveTimeout: 3000, 30 | // contentType: ContentType.parse("application/x-www-form-urlencoded"), 31 | //data: HttpServiceResponse 32 | ); 33 | _dio = new Dio(this.options); 34 | (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = 35 | (client) { 36 | client.badCertificateCallback = 37 | (X509Certificate cert, String host, int port) => true; 38 | }; 39 | _dio.interceptors.add(InterceptorsWrapper(onError: (DioError err) async { 40 | //_dio.interceptor.response.lock(); 41 | // print(err); 42 | var res = AppConfig.httpServiceError[err.type.index]; 43 | //_dio.interceptor.response.unlock(); 44 | return new HttpServiceResponse( 45 | msg: res["msg"], data: null, ret: res["ret"]); 46 | }, onResponse: (Response ret) async { 47 | try { 48 | var result = HttpServiceResponse.fromJson(ret.data); 49 | if (result.data != false) { 50 | return result; 51 | } else { 52 | var res = AppConfig.httpServiceError[2]; 53 | return new HttpServiceResponse( 54 | msg: res["msg"], data: null, ret: res["ret"]); 55 | } 56 | } catch (err) { 57 | var res = AppConfig.httpServiceError[2]; 58 | return new HttpServiceResponse( 59 | msg: res["msg"], data: null, ret: res["ret"]); 60 | } 61 | })); 62 | } 63 | 64 | Future> get( 65 | String path, { 66 | Map data, 67 | CancelToken cancelToken, 68 | Options options, 69 | }) async { 70 | var ops = await _getOptions(); 71 | _dio.options.headers = ops.headers; 72 | return _dio.get(path, 73 | queryParameters: data, cancelToken: cancelToken, options: options); 74 | } 75 | 76 | Future> post( 77 | String path, { 78 | data, 79 | CancelToken cancelToken, 80 | Options options, 81 | }) async { 82 | var ops = await _getOptions(); 83 | _dio.options.headers = ops.headers; 84 | return _dio.post(path, 85 | data: data, cancelToken: cancelToken, options: options); 86 | } 87 | 88 | Future> request( 89 | String path, { 90 | data, 91 | CancelToken cancelToken, 92 | Options options, 93 | }) async { 94 | var ops = await _getOptions(); 95 | _dio.options.headers = ops.headers; 96 | return _dio.request(path, 97 | data: data, cancelToken: cancelToken, options: options); 98 | } 99 | 100 | Future _getOptions() async { 101 | var _baseOptions = new Options(); 102 | _baseOptions.headers["appId"] = AppConfig.appId; 103 | 104 | bool isAndroid = Platform.isAndroid; 105 | // if (mmkv == null) { 106 | // mmkv = await MmkvFlutter.getInstance(); 107 | // } 108 | // var token = await mmkv.getString("MY_APP_TOKEN"); 109 | // if (token != "") { 110 | // _baseOptions.headers['api-token'] = token; 111 | // } 112 | // var info = await mmkv.getString("MY_APP_SYSTEMINFO"); 113 | // if (info != "") { 114 | // _systemInfo = info.split("@"); 115 | // } 116 | 117 | // if (_systemInfo == null) { 118 | // _systemInfo = new List(); 119 | // DeviceInfoPlugin deviceInfo = new DeviceInfoPlugin(); 120 | // var deviceResult; 121 | // if (isAndroid) { 122 | // deviceResult = await deviceInfo.androidInfo; 123 | // _systemInfo.add(deviceResult.model); 124 | // _systemInfo.add(deviceResult.brand); 125 | // _systemInfo.add(deviceResult.version.release); 126 | // _systemInfo.add(deviceResult.id); 127 | // } else { 128 | // deviceResult = await deviceInfo.iosInfo; 129 | // _systemInfo.add(deviceResult.utsname.machine); 130 | // _systemInfo.add(deviceResult.model); 131 | // _systemInfo.add(deviceResult.systemVersion); 132 | // _systemInfo.add(deviceResult.identifierForVendor); 133 | // } 134 | // await mmkv.setString("MY_APP_SYSTEMINFO", _systemInfo.join("@")); 135 | // deviceResult = null; 136 | // deviceInfo = null; 137 | // } 138 | _baseOptions.headers['App-isandroid'] = isAndroid ? 1 : 0; 139 | // _baseOptions.headers['App-system-model'] = _systemInfo[0]; 140 | // _baseOptions.headers['App-system-brand'] = _systemInfo[1]; 141 | // _baseOptions.headers['App-system-version'] = _systemInfo[2]; 142 | // _baseOptions.headers['App-system-deviceid'] = _systemInfo[3]; 143 | return _baseOptions; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /example/lib/widgets/common_dialogs.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_openshare_example/widgets/function.dart'; 5 | import 'package:flutter_openshare_example/services/http_process.dart'; 6 | import 'package:flutter_openshare_example/widgets/reward_widget.dart'; 7 | 8 | showSuccess(BuildContext context, String message, IconData icon) { 9 | showDialog( 10 | context: context, 11 | barrierDismissible: false, 12 | builder: (context) => Center( 13 | child: Material( 14 | borderRadius: BorderRadius.circular(8.0), 15 | color: Colors.black, 16 | elevation: 5.0, 17 | child: Padding( 18 | padding: const EdgeInsets.all(32.0), 19 | child: Column( 20 | mainAxisAlignment: MainAxisAlignment.center, 21 | mainAxisSize: MainAxisSize.min, 22 | children: [ 23 | Icon( 24 | icon, 25 | color: Colors.green, 26 | size: 28.0, 27 | ), 28 | SizedBox( 29 | height: 10.0, 30 | ), 31 | Text( 32 | message, 33 | style: TextStyle(color: Colors.white), 34 | ) 35 | ], 36 | ), 37 | ), 38 | ), 39 | )); 40 | } 41 | 42 | showProgress(BuildContext context) { 43 | showDialog( 44 | context: context, 45 | barrierDismissible: false, 46 | builder: (context) => Center( 47 | child: Material( 48 | borderRadius: BorderRadius.circular(8.0), 49 | color: Colors.black, 50 | elevation: 5.0, 51 | child: Padding( 52 | padding: const EdgeInsets.all(30.0), 53 | child: Column( 54 | mainAxisAlignment: MainAxisAlignment.center, 55 | mainAxisSize: MainAxisSize.min, 56 | children: [ 57 | CircularProgressIndicator( 58 | strokeWidth: 2.0, 59 | valueColor: 60 | AlwaysStoppedAnimation(Color(0xFFFF6600)), 61 | ), 62 | SizedBox( 63 | height: 10.0, 64 | ), 65 | Text( 66 | "请稍等……", 67 | style: TextStyle(color: Colors.white), 68 | ) 69 | ], 70 | ), 71 | ), 72 | ), 73 | )); 74 | } 75 | 76 | // showProgress(BuildContext context) { 77 | // showDialog( 78 | // context: context, 79 | // barrierDismissible: false, 80 | // builder: (context) => Center( 81 | // child: Container( 82 | // width: 60.0, 83 | // height: 60.0, 84 | // padding: EdgeInsets.all(15.0), 85 | // decoration: BoxDecoration( 86 | // borderRadius: BorderRadius.circular(3.0), 87 | // color: Color(0xFFF2F3F5)), 88 | // child: CircularProgressIndicator( 89 | // strokeWidth: 2.0, 90 | // valueColor: AlwaysStoppedAnimation(Color(0xFFFF6600)), 91 | // ), 92 | // ), 93 | // )); 94 | // } 95 | 96 | hideProgress(BuildContext context) { 97 | Navigator.pop(context); 98 | } 99 | 100 | closeDialog(BuildContext context) { 101 | Navigator.pop(context); 102 | } 103 | 104 | processObservable(Stream process, BuildContext context, 105 | {int time, Function callback}) { 106 | process.listen((HttpProcess p) { 107 | if (p.loading) { 108 | showProgress(context); 109 | } else { 110 | setTimeOut(() { 111 | hideProgress(context); 112 | if (callback != null) { 113 | callback(p.response); 114 | } 115 | }, time: time ?? 1); 116 | } 117 | }); 118 | } 119 | 120 | void showModelBottomMenu( 121 | {@required BuildContext context, 122 | double itemHeight, 123 | @required List menus, 124 | @required Function onTap}) { 125 | final double itemH = itemHeight ?? 45.0; 126 | final int len = menus.length; 127 | int index = 1; 128 | final double totalLen = (itemH + 0.5) * len + 50.5; 129 | final listWidget = menus.map((name) { 130 | return Container( 131 | height: itemH, 132 | decoration: index++ == len 133 | ? null 134 | : BoxDecoration( 135 | border: Border( 136 | bottom: BorderSide(color: Color(0xFFE5E5E5), width: 0.5))), 137 | child: Material( 138 | color: Color(0xFFFFFFFF), 139 | child: InkWell( 140 | onTap: () { 141 | closeDialog(context); 142 | onTap(menus.indexOf(name)); 143 | }, 144 | child: Center( 145 | child: Text(name,style: TextStyle( color: Color(0xFF000000), fontSize: 16.0),), 146 | ), 147 | ), 148 | ), 149 | ); 150 | }).toList(); 151 | showModalBottomSheet( 152 | context: context, 153 | builder: (context) => Container( 154 | height: totalLen, 155 | color: Color(0xFFFFFFFF), 156 | child: Column( 157 | children: [ 158 | Column( 159 | children: listWidget, 160 | ), 161 | Container( 162 | height: itemH, 163 | decoration: BoxDecoration( 164 | border: Border( 165 | top: BorderSide(color: Color(0xFFF2F3F5), width: 6.0))), 166 | child: Material( 167 | color: Color(0xFFFFFFFF), 168 | child: InkWell( 169 | onTap: () { 170 | closeDialog(context); 171 | onTap(-1); 172 | }, 173 | child: Center( 174 | child: Text( 175 | "取消", 176 | style: TextStyle(color: Colors.red, fontSize: 16.0), 177 | 178 | ), 179 | ), 180 | ), 181 | ), 182 | ), 183 | ], 184 | )), 185 | ); 186 | } 187 | /// 188 | ///显示消息 189 | /// 190 | void showSnackBarMessage(ScaffoldState state, String msg) { 191 | state.showSnackBar(SnackBar( 192 | content: Text( 193 | msg, 194 | textAlign: TextAlign.center, 195 | ), 196 | duration: Duration(seconds: 2), 197 | )); 198 | } 199 | 200 | Widget _rewardWidget(String name,Function callback) { 201 | final _priceItem = [ 202 | GoldMoney(isSelected: true, price: 10), 203 | GoldMoney(isSelected: false, price: 100), 204 | GoldMoney(isSelected: false, price: 250), 205 | GoldMoney(isSelected: false, price: 520), 206 | GoldMoney(isSelected: false, price: 999), 207 | GoldMoney(isSelected: false, price: 1314) 208 | ]; 209 | return Container( 210 | width: double.infinity, 211 | padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 20.0), 212 | child: Material( 213 | elevation: 2.0, 214 | borderRadius: BorderRadius.circular(4.0), 215 | child: Padding( 216 | padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), 217 | child: Column( 218 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 219 | children: [ 220 | Text.rich( 221 | TextSpan(style: TextStyle(fontSize: 18.0), children: [ 222 | TextSpan(text: "打赏给", style: TextStyle(color: Color(0xFF000000))), 223 | TextSpan(text: name, style: TextStyle(color: Color(0xFFFF5A5F))), 224 | ])), 225 | Reward( 226 | items: _priceItem, 227 | onTap: (int price) { 228 | if(callback!=null){ 229 | callback(price); 230 | } 231 | }, 232 | ), 233 | ], 234 | ), 235 | ), 236 | ), 237 | ); 238 | } 239 | void rewardDialog(BuildContext context,String name, Function callback){ 240 | var curPrice=10; 241 | showDialog( 242 | context: context, 243 | barrierDismissible: true, 244 | builder: (context) => Center( 245 | child: Column( 246 | mainAxisAlignment: MainAxisAlignment.center, 247 | children: [ 248 | _rewardWidget(name,(price)=>curPrice=price), 249 | FloatingActionButton( 250 | backgroundColor: Color(0xFFFF5A5F), 251 | child: Icon( 252 | Icons.refresh, 253 | color: Colors.white, 254 | ), 255 | onPressed: () { 256 | Navigator.pop(context); 257 | if(callback!=null){ 258 | callback(curPrice); 259 | } 260 | 261 | }, 262 | ) 263 | ], 264 | ), 265 | )); 266 | } 267 | payDialog(BuildContext context,int price,{Function callback}) { 268 | // setState(() { 269 | // isDataAvailable = true; 270 | // }); 271 | showDialog( 272 | context: context, 273 | barrierDismissible: true, 274 | builder: (context) => Center( 275 | child: Column( 276 | mainAxisAlignment: MainAxisAlignment.center, 277 | children: [ 278 | _payWidget(price), 279 | FloatingActionButton( 280 | backgroundColor: Color(0xFFFF5A5F), 281 | child: Icon( 282 | Icons.refresh, 283 | color: Colors.white, 284 | ), 285 | onPressed: () { 286 | Navigator.pop(context); 287 | if(callback!=null){ 288 | callback(); 289 | } 290 | }, 291 | ) 292 | ], 293 | ), 294 | )); 295 | } 296 | 297 | _payWidget(int price) => Container( 298 | width: double.infinity, 299 | padding: EdgeInsets.only(left: 40.0, right: 40.0, bottom: 20.0), 300 | child: Material( 301 | elevation: 2.0, 302 | borderRadius: BorderRadius.circular(4.0), 303 | child: Padding( 304 | padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), 305 | child: Column( 306 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 307 | children: [ 308 | Text( 309 | "提示", 310 | style: TextStyle(color: Color(0xFFAAAAAA), fontSize: 18.0), 311 | ), 312 | SizedBox( 313 | height: 15.0, 314 | ), 315 | Text("该动态为付费内容", style: TextStyle(color: Color(0xFF000000))), 316 | Text.rich(TextSpan(children: [ 317 | TextSpan( 318 | text: "打赏", style: TextStyle(color: Color(0xFF000000))), 319 | TextSpan( 320 | text: "${price}YB", style: TextStyle(color: Color(0xFFFF5A5F))), 321 | TextSpan( 322 | text: "解锁该动态", style: TextStyle(color: Color(0xFF000000))) 323 | ])), 324 | ], 325 | ), 326 | ), 327 | ), 328 | ); 329 | -------------------------------------------------------------------------------- /example/lib/widgets/countdown.dart: -------------------------------------------------------------------------------- 1 | import "dart:async"; 2 | 3 | class CountDown { 4 | 5 | /// reference point for start and resume 6 | DateTime _begin; 7 | Timer _timer; 8 | Duration _duration; 9 | Duration remainingTime; 10 | bool isPaused = false; 11 | StreamController _controller; 12 | Duration _refresh; 13 | /// provide a way to send less data to the client but keep the data of the timer up to date 14 | int _everyTick, counter = 0; 15 | 16 | 17 | /// once you instantiate the CountDown you need to register to receive information 18 | CountDown(Duration duration, {Duration refresh: const Duration(milliseconds: 10), int everyTick: 1}) { 19 | _refresh = refresh; 20 | _everyTick = everyTick; 21 | 22 | this._duration = duration; 23 | _controller = new StreamController(onListen: _onListen, onPause: _onPause, onResume: _onResume, onCancel: _onCancel); 24 | } 25 | 26 | Stream get stream => _controller.stream; 27 | 28 | /// _onListen 29 | /// invoke when the first subscriber has subscribe and not before to avoid leak of memory 30 | _onListen() { 31 | // reference point 32 | _begin = new DateTime.now(); 33 | _timer = new Timer.periodic(_refresh, _tick); 34 | } 35 | 36 | /// the remaining time is set at '_refresh' ms accurate 37 | _onPause() { 38 | isPaused = true; 39 | _timer.cancel(); 40 | _timer = null; 41 | } 42 | 43 | /// ...restart the timer with the new duration 44 | _onResume() { 45 | _begin = new DateTime.now(); 46 | 47 | _duration = this.remainingTime; 48 | isPaused = false; 49 | 50 | // lance le timer 51 | _timer = new Timer.periodic(_refresh, _tick); 52 | } 53 | 54 | _onCancel() { 55 | // on pause we already cancel the _timer 56 | if (!isPaused) { 57 | _timer.cancel(); 58 | _timer = null; 59 | } 60 | // _controller.close(); // close automatically the "pipe" when the sub close it by sub.cancel() 61 | } 62 | 63 | void _tick(Timer timer) { 64 | counter++; 65 | Duration alreadyConsumed = new DateTime.now().difference(_begin); 66 | this.remainingTime = this._duration - alreadyConsumed; 67 | if (this.remainingTime.isNegative) { 68 | timer.cancel(); 69 | timer = null; 70 | // tell the onDone's subscriber that it's finish 71 | _controller.close(); 72 | } else { 73 | // here we can control the frequency of sending data 74 | if (counter % _everyTick == 0) { 75 | _controller.add(this.remainingTime); 76 | counter = 0; 77 | } 78 | } 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /example/lib/widgets/coupon_box.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:path_drawing/path_drawing.dart'; 3 | 4 | class CustomCouponShape extends ShapeBorder { 5 | final double rate; 6 | final double radius; 7 | final Axis direction; 8 | final Color dashedBorderColor; 9 | final double dashedBorderWidth; 10 | CustomCouponShape( 11 | {@required this.rate, 12 | this.radius = 10, 13 | this.direction = Axis.horizontal, 14 | this.dashedBorderColor = Colors.black, 15 | this.dashedBorderWidth = 1.0}); 16 | @override 17 | EdgeInsetsGeometry get dimensions => null; 18 | 19 | @override 20 | Path getInnerPath(Rect rect, {TextDirection textDirection}) { 21 | return null; 22 | } 23 | 24 | @override 25 | Path getOuterPath(Rect rect, {TextDirection textDirection}) { 26 | Rect oval, oval2; 27 | if (direction == Axis.horizontal) { 28 | oval = new Rect.fromCircle( 29 | center: Offset(rate * rect.size.width, 0), radius: radius); 30 | oval2 = new Rect.fromCircle( 31 | center: Offset(rate * rect.size.width, rect.size.height), 32 | radius: radius); 33 | } else { 34 | oval = new Rect.fromCircle( 35 | center: Offset(0, rate * rect.size.height), radius: radius); 36 | oval2 = new Rect.fromCircle( 37 | center: Offset(rect.size.width, rate * rect.size.height), 38 | radius: radius); 39 | } 40 | Path path = new Path() 41 | ..addRect(rect) 42 | ..close(); 43 | Path path2 = new Path(); 44 | path2.addArc(oval, 0, 180); 45 | path = Path.combine(PathOperation.reverseDifference, path2, path); 46 | path2.addArc(oval2, 0, 180); 47 | return Path.combine(PathOperation.reverseDifference, path2, path); 48 | } 49 | 50 | @override 51 | void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) { 52 | Paint paint = Paint() 53 | ..color = dashedBorderColor 54 | ..strokeWidth = dashedBorderWidth 55 | ..style = PaintingStyle.stroke; 56 | Path p = Path(); 57 | double dx, dy; 58 | if (direction == Axis.horizontal) { 59 | dx = rate * rect.size.width; 60 | dy = radius + 5; 61 | p 62 | ..moveTo(dx, dy) 63 | ..lineTo(dx, rect.size.height - dy); 64 | } else { 65 | dx = radius + 5; 66 | dy = rate * rect.size.height; 67 | p 68 | ..moveTo(dx, dy) 69 | ..lineTo(rect.size.width - dx, dy); 70 | } 71 | canvas.drawPath( 72 | dashPath( 73 | p, 74 | dashArray: CircularIntervalList( 75 | [5.0, 2.5], 76 | ), 77 | ), 78 | paint); 79 | } 80 | 81 | @override 82 | ShapeBorder scale(double t) { 83 | return null; 84 | } 85 | } 86 | 87 | class CouponBox extends StatelessWidget { 88 | final double width; 89 | final double height; 90 | final double rate; 91 | final double radius; 92 | final Axis direction; 93 | final Color dashedBorderColor; 94 | final double dashedBorderWidth; 95 | final Widget firstChild; 96 | final Widget secondChild; 97 | final Color backgroundColor; 98 | CouponBox( 99 | {@required this.rate, 100 | @required this.width, 101 | @required this.height, 102 | this.radius = 10, 103 | this.backgroundColor = Colors.redAccent, 104 | this.direction = Axis.horizontal, 105 | this.dashedBorderColor = Colors.black, 106 | this.dashedBorderWidth = 1.0, 107 | this.firstChild, 108 | this.secondChild}); 109 | @override 110 | Widget build(BuildContext context) { 111 | return SizedBox( 112 | width: width, 113 | height: height, 114 | child: Material( 115 | color: backgroundColor, 116 | shape: CustomCouponShape( 117 | rate: rate, 118 | radius: radius, 119 | direction: direction, 120 | dashedBorderColor: dashedBorderColor, 121 | dashedBorderWidth: dashedBorderWidth), 122 | child: direction == Axis.vertical 123 | ? Column( 124 | children: [ 125 | SizedBox( 126 | height: height * rate, 127 | child: firstChild, 128 | ), 129 | SizedBox( 130 | height: radius, 131 | ), 132 | Expanded( 133 | child: secondChild, 134 | ) 135 | ], 136 | ) 137 | : Row( 138 | children: [ 139 | SizedBox( 140 | width: width * rate, 141 | child: firstChild, 142 | ), 143 | SizedBox( 144 | width: radius, 145 | ), 146 | Expanded( 147 | child: secondChild, 148 | ) 149 | ], 150 | ), 151 | ), 152 | ); 153 | } 154 | } -------------------------------------------------------------------------------- /example/lib/widgets/function.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_openshare_example/widgets/countdown.dart'; 2 | // import 'package:meiying/utils/countdown.dart'; 3 | 4 | void setTimeOut(Function callback,{time:1}){ 5 | if(callback!=null){ 6 | var timeout=new CountDown(Duration(seconds: time)); 7 | var timeStream=timeout.stream.listen(null); 8 | timeStream.onDone(callback); 9 | } 10 | } 11 | 12 | String formatMsgTime (String timespan) { 13 | var dateTime= DateTime.parse(timespan); 14 | 15 | var year = dateTime.year; 16 | var month = dateTime.month; 17 | var day = dateTime.day; 18 | var hour = dateTime.hour; 19 | var minute = dateTime.minute; 20 | //var second = dateTime.second; 21 | var now = new DateTime.now(); 22 | //var now_new = Date.parse(now.toDateString()); //typescript转换写法 23 | 24 | var milliseconds = 0; 25 | String timeSpanStr; 26 | 27 | milliseconds = now.difference(dateTime).inMilliseconds; 28 | 29 | if (milliseconds <= 1000 * 60 * 1) { 30 | timeSpanStr = '刚刚'; 31 | } 32 | else if (1000 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60) { 33 | timeSpanStr ='${(milliseconds / (1000 * 60)).floor()}分钟前'; 34 | } 35 | else if (1000 * 60 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24) { 36 | timeSpanStr = '${(milliseconds / (1000 * 60 * 60)).floor()}小时前'; 37 | } 38 | else if (1000 * 60 * 60 * 24 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24 * 15) { 39 | timeSpanStr = '${(milliseconds / (1000 * 60 * 60 * 24)).floor()}天前'; 40 | } 41 | else if (milliseconds > 1000 * 60 * 60 * 24 * 15 && year == now.year) { 42 | timeSpanStr ="${month}-${day} ${hour}:$minute"; 43 | } else { 44 | timeSpanStr ="${year}-${month}-${day}"; 45 | } 46 | return timeSpanStr; 47 | } -------------------------------------------------------------------------------- /example/lib/widgets/reward_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:rxdart/subjects.dart'; 3 | 4 | class GoldMoney { 5 | bool isSelected; 6 | int price; 7 | GoldMoney({this.isSelected, this.price}); 8 | } 9 | 10 | class Reward extends StatefulWidget { 11 | final List items; 12 | final EdgeInsetsGeometry padding; 13 | final Color borderColor = Color(0xFFCCCCCC); 14 | final Color borderSelectedColor = Color(0xFF000000); 15 | final Function onTap; 16 | 17 | Reward({Key key, this.items, this.padding, this.onTap}) 18 | : assert(items.length > 0), 19 | super(key: key); 20 | @override 21 | _RewardState createState() => _RewardState(); 22 | } 23 | 24 | class _RewardState extends State { 25 | //final flagSubject = new BehaviorSubject(); 26 | final listSubject = new BehaviorSubject>(); 27 | var curIndex = 0; 28 | @override 29 | void initState() { 30 | super.initState(); 31 | listSubject.add(widget.items); 32 | } 33 | @override 34 | void dispose(){ 35 | listSubject?.close(); 36 | super.dispose(); 37 | } 38 | void changeIndex(int index) { 39 | if (index != curIndex) { 40 | widget.items[curIndex].isSelected = false; 41 | widget.items[index].isSelected = true; 42 | curIndex=index; 43 | listSubject.add(widget.items); 44 | if(widget.onTap!=null){ 45 | widget.onTap(widget.items[index].price); 46 | } 47 | 48 | } 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return StreamBuilder( 54 | stream: listSubject.stream, 55 | builder: (_,AsyncSnapshot> snapshot) { 56 | if(snapshot.hasData){ 57 | return GridView.builder( 58 | padding: widget.padding != null 59 | ? widget.padding 60 | : EdgeInsets.only(top: 15.0), 61 | primary: false, 62 | reverse: false, 63 | shrinkWrap: true, 64 | addAutomaticKeepAlives: true, 65 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 66 | childAspectRatio: 2.4, 67 | crossAxisCount: 3, 68 | crossAxisSpacing: 8.0, 69 | mainAxisSpacing: 8.0), 70 | itemCount: snapshot.data.length, 71 | itemBuilder: (_, index)=>Container( 72 | decoration: BoxDecoration( 73 | 74 | borderRadius: BorderRadius.circular(4.0), 75 | border: Border.all(color:snapshot.data[index].isSelected? widget.borderSelectedColor:widget.borderColor, width: 0.5)), 76 | child: Material( 77 | color:snapshot.data[index].isSelected? Color(0xFFFF5A5F):Color(0xFFFFFFFF), 78 | borderRadius: BorderRadius.circular(4.0), 79 | child: InkWell( 80 | onTap: () => changeIndex(index), 81 | child: Center( 82 | child: Text("${snapshot.data[index].price}YB", style: TextStyle(color:snapshot.data[index].isSelected? Color(0xFFFFFFFF):Color(0xFF666666)),), 83 | ))), 84 | ), 85 | ); 86 | }else{ 87 | return Container(); 88 | } 89 | }, 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | after_layout: 5 | dependency: "direct main" 6 | description: 7 | name: after_layout 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "1.0.7+2" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.5.0-nullsafety" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.1.0-nullsafety" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.1.0-nullsafety.2" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.2.0-nullsafety" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.1.0-nullsafety" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.15.0-nullsafety.2" 53 | cupertino_icons: 54 | dependency: "direct main" 55 | description: 56 | name: cupertino_icons 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "0.1.3" 60 | dio: 61 | dependency: "direct main" 62 | description: 63 | name: dio 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "3.0.9" 67 | fake_async: 68 | dependency: transitive 69 | description: 70 | name: fake_async 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "1.1.0-nullsafety" 74 | flutter: 75 | dependency: "direct main" 76 | description: flutter 77 | source: sdk 78 | version: "0.0.0" 79 | flutter_mmkv: 80 | dependency: "direct dev" 81 | description: 82 | path: "." 83 | ref: HEAD 84 | resolved-ref: e5e117da0e879890c7135790f301a7ccc303ce2d 85 | url: "https://gitee.com/ugle/flutter_mmkv.git" 86 | source: git 87 | version: "0.0.1" 88 | flutter_openshare: 89 | dependency: "direct dev" 90 | description: 91 | path: ".." 92 | relative: true 93 | source: path 94 | version: "1.0.6" 95 | flutter_test: 96 | dependency: "direct dev" 97 | description: flutter 98 | source: sdk 99 | version: "0.0.0" 100 | http: 101 | dependency: "direct main" 102 | description: 103 | name: http 104 | url: "https://pub.flutter-io.cn" 105 | source: hosted 106 | version: "0.12.0+4" 107 | http_parser: 108 | dependency: transitive 109 | description: 110 | name: http_parser 111 | url: "https://pub.flutter-io.cn" 112 | source: hosted 113 | version: "3.1.3" 114 | image_picker_saver: 115 | dependency: "direct main" 116 | description: 117 | name: image_picker_saver 118 | url: "https://pub.flutter-io.cn" 119 | source: hosted 120 | version: "0.3.0" 121 | matcher: 122 | dependency: transitive 123 | description: 124 | name: matcher 125 | url: "https://pub.flutter-io.cn" 126 | source: hosted 127 | version: "0.12.10-nullsafety" 128 | meta: 129 | dependency: transitive 130 | description: 131 | name: meta 132 | url: "https://pub.flutter-io.cn" 133 | source: hosted 134 | version: "1.3.0-nullsafety.2" 135 | path: 136 | dependency: transitive 137 | description: 138 | name: path 139 | url: "https://pub.flutter-io.cn" 140 | source: hosted 141 | version: "1.8.0-nullsafety" 142 | path_drawing: 143 | dependency: "direct main" 144 | description: 145 | name: path_drawing 146 | url: "https://pub.flutter-io.cn" 147 | source: hosted 148 | version: "0.4.1" 149 | path_parsing: 150 | dependency: transitive 151 | description: 152 | name: path_parsing 153 | url: "https://pub.flutter-io.cn" 154 | source: hosted 155 | version: "0.1.4" 156 | pedantic: 157 | dependency: transitive 158 | description: 159 | name: pedantic 160 | url: "https://pub.flutter-io.cn" 161 | source: hosted 162 | version: "1.8.0+1" 163 | qr: 164 | dependency: transitive 165 | description: 166 | name: qr 167 | url: "https://pub.flutter-io.cn" 168 | source: hosted 169 | version: "1.2.0" 170 | qr_flutter: 171 | dependency: "direct main" 172 | description: 173 | name: qr_flutter 174 | url: "https://pub.flutter-io.cn" 175 | source: hosted 176 | version: "3.2.0" 177 | rxdart: 178 | dependency: "direct main" 179 | description: 180 | name: rxdart 181 | url: "https://pub.flutter-io.cn" 182 | source: hosted 183 | version: "0.23.1" 184 | sky_engine: 185 | dependency: transitive 186 | description: flutter 187 | source: sdk 188 | version: "0.0.99" 189 | source_span: 190 | dependency: transitive 191 | description: 192 | name: source_span 193 | url: "https://pub.flutter-io.cn" 194 | source: hosted 195 | version: "1.8.0-nullsafety" 196 | stack_trace: 197 | dependency: transitive 198 | description: 199 | name: stack_trace 200 | url: "https://pub.flutter-io.cn" 201 | source: hosted 202 | version: "1.10.0-nullsafety" 203 | stream_channel: 204 | dependency: transitive 205 | description: 206 | name: stream_channel 207 | url: "https://pub.flutter-io.cn" 208 | source: hosted 209 | version: "2.1.0-nullsafety" 210 | string_scanner: 211 | dependency: transitive 212 | description: 213 | name: string_scanner 214 | url: "https://pub.flutter-io.cn" 215 | source: hosted 216 | version: "1.1.0-nullsafety" 217 | term_glyph: 218 | dependency: transitive 219 | description: 220 | name: term_glyph 221 | url: "https://pub.flutter-io.cn" 222 | source: hosted 223 | version: "1.2.0-nullsafety" 224 | test_api: 225 | dependency: transitive 226 | description: 227 | name: test_api 228 | url: "https://pub.flutter-io.cn" 229 | source: hosted 230 | version: "0.2.19-nullsafety" 231 | typed_data: 232 | dependency: transitive 233 | description: 234 | name: typed_data 235 | url: "https://pub.flutter-io.cn" 236 | source: hosted 237 | version: "1.3.0-nullsafety.2" 238 | vector_math: 239 | dependency: transitive 240 | description: 241 | name: vector_math 242 | url: "https://pub.flutter-io.cn" 243 | source: hosted 244 | version: "2.1.0-nullsafety.2" 245 | sdks: 246 | dart: ">=2.10.0-0.0.dev <2.10.0" 247 | flutter: ">=1.7.0 <2.0.0" 248 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_openshare_example 2 | description: Demonstrates how to use the flutter_openshare plugin. 3 | publish_to: 'none' 4 | version: 1.0.4 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^0.1.2 15 | qr_flutter: 16 | dio: 17 | http: 18 | after_layout: 19 | path_drawing: 20 | rxdart: 21 | # mmkv_flutter: 22 | image_picker_saver: 23 | 24 | dev_dependencies: 25 | flutter_test: 26 | sdk: flutter 27 | 28 | flutter_openshare: 29 | path: ../ 30 | flutter_mmkv: 31 | git: https://gitee.com/ugle/flutter_mmkv.git 32 | # For information on the generic Dart part of this file, see the 33 | # following page: https://dart.dev/tools/pub/pubspec 34 | 35 | # The following section is specific to Flutter. 36 | flutter: 37 | 38 | # The following line ensures that the Material Icons font is 39 | # included with your application, so that you can use the icons in 40 | # the material Icons class. 41 | uses-material-design: true 42 | 43 | # To add assets to your application, add an assets section, like this: 44 | # assets: 45 | # - images/a_dot_burr.jpeg 46 | # - images/a_dot_ham.jpeg 47 | 48 | # An image asset can refer to one or more resolution-specific "variants", see 49 | # https://flutter.dev/assets-and-images/#resolution-aware. 50 | 51 | # For details regarding adding assets from package dependencies, see 52 | # https://flutter.dev/assets-and-images/#from-packages 53 | 54 | # To add custom fonts to your application, add a fonts section here, 55 | # in this "flutter" section. Each entry in this list should have a 56 | # "family" key with the font family name, and a "fonts" key with a 57 | # list giving the asset and other descriptors for the font. For 58 | # example: 59 | # fonts: 60 | # - family: Schyler 61 | # fonts: 62 | # - asset: fonts/Schyler-Regular.ttf 63 | # - asset: fonts/Schyler-Italic.ttf 64 | # style: italic 65 | # - family: Trajan Pro 66 | # fonts: 67 | # - asset: fonts/TrajanPro.ttf 68 | # - asset: fonts/TrajanPro_Bold.ttf 69 | # weight: 700 70 | # 71 | # For details regarding fonts from package dependencies, 72 | # see https://flutter.dev/custom-fonts/#from-packages 73 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_openshare_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => widget is Text && 22 | widget.data.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /flutter_openshare.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 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/FlutterOpensharePlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "OpenShareSDK.h" 3 | //#import 4 | @interface FlutterOpensharePlugin : NSObject 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Classes/FlutterOpensharePlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterOpensharePlugin.h" 2 | 3 | @interface FlutterOpensharePlugin() 4 | @end 5 | @implementation FlutterOpensharePlugin{ 6 | FlutterMethodChannel* _methodChannel; 7 | NSDictionary* _launchOptions; 8 | } 9 | + (void)registerWithRegistrar:(NSObject*)registrar { 10 | FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"openshare.cc/Flutter_OpenShare" binaryMessenger:[registrar messenger]]; 11 | FlutterOpensharePlugin* instance = [[FlutterOpensharePlugin alloc] initWithChannel:channel]; 12 | [registrar addMethodCallDelegate:instance channel:channel]; 13 | [registrar addApplicationDelegate:instance]; 14 | } 15 | 16 | - (instancetype)initWithChannel:(FlutterMethodChannel*)channel{ 17 | self = [super init]; 18 | if(self){ 19 | // NSAssert(self, @"super init cannot be nil"); 20 | // _messenger=messenger; 21 | _methodChannel=channel; 22 | } 23 | return self; 24 | } 25 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 26 | if ([@"setup" isEqualToString:call.method]) { 27 | __weak typeof(self) weakSelf = self; 28 | [OpenShareSDK initWithDelegate:weakSelf withOptions:_launchOptions]; 29 | result(nil); 30 | } else if([@"getInstallParams" isEqualToString:call.method]){ 31 | [[OpenShareSDK getInitializeInstance] getInstallParams:^(id _Nullable params) { 32 | result(params); 33 | }]; 34 | } else if([@"getWakeUpParams" isEqualToString:call.method]){ 35 | [[OpenShareSDK getInitializeInstance] getWakeUpParams:^(id _Nullable params) { 36 | result(params); 37 | }]; 38 | }else if([@"getUUID" isEqualToString:call.method]){ 39 | result([OpenShareSDK getUUID]); 40 | }else{ 41 | result(FlutterMethodNotImplemented); 42 | } 43 | } 44 | - (void)getWakeUpParamsFromSmartInstall:(nonnull id)params withError:(nonnull NSError *)error { 45 | // NSLog(@"---%@",params); 46 | [_methodChannel invokeMethod:@"wakeup" arguments:params]; 47 | // [self sendReceiverEvent:params]; 48 | } 49 | 50 | - (void)getInstallParamsFromSmartInstall:(nonnull id)params withError:(nonnull NSError *)error { 51 | // NSLog(@"---%@",params); 52 | // [self sendReceiverEvent:params]; 53 | [_methodChannel invokeMethod:@"install" arguments:params]; 54 | } 55 | 56 | #pragma mark - AppDelegate 57 | - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{ 58 | _launchOptions=launchOptions; 59 | 60 | // _launchOptions.allKeys 61 | return YES; 62 | } 63 | //Universal Links 通用链接 64 | - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler 65 | { 66 | //判断是否通过ShareInstall Universal Links 唤起App 67 | if ([OpenShareSDK continueUserActivity:userActivity]) { 68 | return YES ; 69 | } 70 | return YES; 71 | } 72 | //iOS9以下 URI Scheme 73 | -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ 74 | //判断是否通过ShareInstall URL Scheme 唤起App 75 | if ([OpenShareSDK handLinkURL:url]) { 76 | return YES; 77 | } 78 | 79 | return YES; 80 | } 81 | 82 | //iOS9以上 URL Scheme 83 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(nonnull NSDictionary *)options 84 | { 85 | //判断是否通过ShareInstall URL Scheme 唤起App 86 | if ([OpenShareSDK handLinkURL:url]) { 87 | return YES; 88 | } 89 | 90 | return YES; 91 | } 92 | @end 93 | -------------------------------------------------------------------------------- /ios/Classes/libOpenShareSDK/OpenShareSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // OpenShare.h 3 | // OpenShareTest 4 | // 5 | // Created by uking on 4/5/19. 6 | // Copyright © 2019 uking. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | typedef void (^getInstallCallback)( id _Nullable params); 13 | @protocol OpenShareDelegate 14 | /** 15 | * 安装时获取自定义h5页面参数(使用控制中心提供的渠道统计时,渠道编号也会返回给开发者) 16 | * @ param params 动态参数 17 | * @ return void 18 | */ 19 | - (void)getInstallParamsFromSmartInstall:(id) params withError: (NSError *) error; 20 | /** 21 | * 唤醒时获取h5页面参数(如果是渠道链接,渠道编号会一起返回) 22 | * @ param type 链接类型(区分渠道链接和自定义分享h5链接) 23 | * @ param params 动态参数 24 | * @ return void 25 | */ 26 | - (void)getWakeUpParamsFromSmartInstall: (id) params withError: (NSError *) error; 27 | 28 | @end 29 | @interface OpenShareSDK : NSObject 30 | @property(nonatomic,copy)getInstallCallback installBlock; 31 | 32 | +(instancetype)getInitializeInstance; 33 | /** 34 | 该方法可重复获取参数,如只需在首次获取参数,请自行判断,可设置一个标示位,不再重复调用 35 | getInstallCallBackBlock方法。 36 | **/ 37 | -(void)getInstallParams:(getInstallCallback)callback; 38 | -(void)getWakeUpParams:(getInstallCallback)callback; 39 | 40 | /** 41 | * 初始化ShareInstall SDK 42 | * @ param delegate 委托方法(getInstallParamsFromSmartInstall和 getWakeUpParamsFromSmartInstall)所在的类的对象 43 | * @ param launchOptions 该参数存储程序启动的原因 44 | * @ return void 45 | */ 46 | +(void)initWithDelegate:(id)delegate withOptions:(NSDictionary *)launchOptions; 47 | 48 | /** 49 | * 处理 URL schemes 50 | * @ param URL 系统回调传回的URL 51 | * @ return bool URL是否被ShareInstall识别 52 | */ 53 | +(BOOL)handLinkURL:(NSURL *)URL; 54 | 55 | /** 56 | * 通过 Universal Link 启动应用时会调用 application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable 57 | restorableObjects))restorationHandler ,在此方法中调用 [ShareInstallSDK continueUserActivity:userActivity] 58 | * @ param userActivity 存储了页面信息,包括url 59 | * @ return bool URL是否被ShareInstall识别 60 | */ 61 | +(BOOL)continueUserActivity:(NSUserActivity*)userActivity; 62 | 63 | /** 64 | * 使用Shareinstall 控制中心提供的渠道统计时,在App用户注册完成后调用,可以统计渠道注册量。 65 | * @ param 66 | * @ return void 67 | */ 68 | +(void)reportRegister; 69 | /** 70 | * 普通的获取UUID的方法 71 | */ 72 | + (NSString *)getUUID; 73 | @end 74 | 75 | NS_ASSUME_NONNULL_END 76 | -------------------------------------------------------------------------------- /ios/Classes/libOpenShareSDK/libOpenShareSDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/ios/Classes/libOpenShareSDK/libOpenShareSDK.a -------------------------------------------------------------------------------- /ios/flutter_openshare.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint flutter_openshare.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'flutter_openshare' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.public_header_files = 'Classes/**/*.h' 18 | s.vendored_libraries = 'Classes/libOpenShareSDK/libOpenShareSDK.a' 19 | s.dependency 'Flutter' 20 | s.platform = :ios, '8.0' 21 | 22 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 23 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 24 | end 25 | -------------------------------------------------------------------------------- /lib/flutter_openshare.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | // import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | // import 'package:flutter/widgets.dart'; 6 | 7 | typedef void InstallMessageHandler(OSInstall params); 8 | typedef void WakeUpMessageHandler(OSWakeUp params); 9 | 10 | class FlutterOpenshare { 11 | static FlutterOpenshare _instance; 12 | factory FlutterOpenshare() { 13 | if (_instance == null) { 14 | _instance = new FlutterOpenshare.private( 15 | const MethodChannel('openshare.cc/Flutter_OpenShare')); 16 | } 17 | return _instance; 18 | } 19 | FlutterOpenshare.private(MethodChannel channel) : _channel = channel; 20 | 21 | InstallMessageHandler _onInstallMessage; 22 | WakeUpMessageHandler _onWakeUpMessage; 23 | final MethodChannel _channel; 24 | void addEventHandler({ 25 | InstallMessageHandler onInstallMessage, 26 | WakeUpMessageHandler onWakeUpMessage, 27 | }) { 28 | _onInstallMessage = onInstallMessage; 29 | _onWakeUpMessage = onWakeUpMessage; 30 | _channel.setMethodCallHandler(_handleMethod); 31 | _setup(); 32 | } 33 | 34 | Future _handleMethod(MethodCall call) async { 35 | switch (call.method) { 36 | case "install": 37 | _onInstallMessage(OSInstall.fromJson(call.arguments)); 38 | break; 39 | case "wakeup": 40 | // print(call.arguments); 41 | _onWakeUpMessage(OSWakeUp.fromJson(call.arguments)); 42 | break; 43 | } 44 | } 45 | 46 | Future _setup() async { 47 | await _channel.invokeMethod('setup'); 48 | } 49 | 50 | Future getInstallParams() async { 51 | final dynamic result = await _channel.invokeMethod('getInstallParams'); 52 | return OSInstall.fromJson(result); 53 | } 54 | 55 | Future getWakeUpParams() async { 56 | final dynamic result = await _channel.invokeMethod('getWakeUpParams'); 57 | return OSWakeUp.fromJson(result); 58 | } 59 | Future getUUID() async { 60 | final String result = await _channel.invokeMethod('getUUID'); 61 | return result; 62 | } 63 | } 64 | 65 | class OSInstallData { 66 | String channelCode; 67 | String value; 68 | OSInstallData({this.channelCode,this.value}); 69 | OSInstallData.fromJson(Map json) 70 | : value = json['value'], 71 | channelCode=json['channelCode']; 72 | } 73 | 74 | class OSInstall { 75 | int ret; 76 | String msg; 77 | OSInstallData data; 78 | OSInstall({this.ret, this.msg, this.data}); 79 | OSInstall.fromJson(Map json) 80 | : ret = int.tryParse(json['ret'].toString()), 81 | msg = json['msg'], 82 | data = json['data']!=null ? OSInstallData.fromJson(json['data']) : null; 83 | } 84 | 85 | class OSWakeUpData { 86 | String val; 87 | String path; 88 | OSWakeUpData({this.val,this.path}); 89 | OSWakeUpData.fromJson(Map json) 90 | : val = json['val'], 91 | path = json['path']; 92 | } 93 | 94 | class OSWakeUp { 95 | int ret; 96 | String msg; 97 | // bool type; 98 | OSWakeUpData data; 99 | OSWakeUp({this.ret, this.msg, this.data}); 100 | OSWakeUp.fromJson(Map json) 101 | : ret = int.tryParse(json['ret'].toString()), 102 | msg = json['msg'], 103 | data = json['data']!=null? OSWakeUpData.fromJson(json['data']) : null; 104 | } 105 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.5.0-nullsafety" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.1.0-nullsafety" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.0-nullsafety.2" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.2.0-nullsafety" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0-nullsafety" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.15.0-nullsafety.2" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.1.0-nullsafety" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "0.12.10-nullsafety" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "1.3.0-nullsafety.2" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "1.8.0-nullsafety" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.8.0-nullsafety" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.10.0-nullsafety" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "2.1.0-nullsafety" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.1.0-nullsafety" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.2.0-nullsafety" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "0.2.19-nullsafety" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.3.0-nullsafety.2" 138 | vector_math: 139 | dependency: transitive 140 | description: 141 | name: vector_math 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "2.1.0-nullsafety.2" 145 | sdks: 146 | dart: ">=2.10.0-0.0.dev <2.10.0" 147 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_openshare 2 | description: A new flutter plugin project. 3 | version: 1.0.6 4 | author: 5 | homepage: 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://dart.dev/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | # This section identifies this Flutter project as a plugin project. 24 | # The androidPackage and pluginClass identifiers should not ordinarily 25 | # be modified. They are used by the tooling to maintain consistency when 26 | # adding or updating assets for this project. 27 | plugin: 28 | androidPackage: cc.openshare.plugin.flutter_openshare 29 | pluginClass: FlutterOpensharePlugin 30 | 31 | # To add assets to your plugin package, add an assets section, like this: 32 | # assets: 33 | # - images/a_dot_burr.jpeg 34 | # - images/a_dot_ham.jpeg 35 | # 36 | # For details regarding assets in packages, see 37 | # https://flutter.dev/assets-and-images/#from-packages 38 | # 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.dev/assets-and-images/#resolution-aware. 41 | 42 | # To add custom fonts to your plugin package, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts in packages, see 60 | # https://flutter.dev/custom-fonts/#from-packages 61 | -------------------------------------------------------------------------------- /snapshots/20200820112817.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/An-uking/Flutter_OpenShare/fbad5ca5f8a070b31bd93a679a8a403f0c367db5/snapshots/20200820112817.jpg -------------------------------------------------------------------------------- /test/flutter_openshare_test.dart: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------