├── .gitignore
├── .idea
├── .gitignore
├── dbnavigator.xml
├── libraries
│ ├── Dart_SDK.xml
│ └── Flutter_Plugins.xml
├── misc.xml
└── modules.xml
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── kotlin
│ └── com
│ │ └── rex
│ │ └── flutter_subscreen_plugin
│ │ ├── FlutterSubScreenPresentation.kt
│ │ ├── FlutterSubScreenProvider.kt
│ │ ├── FlutterSubscreenPlugin.kt
│ │ ├── IFlutterSubCallback.kt
│ │ └── constant.kt
│ └── res
│ ├── layout
│ └── flutter_presentation_view.xml
│ └── values
│ ├── attrs.xml
│ └── refs.xml
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── rex
│ │ │ │ │ └── flutter_subscreen_plugin_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── main.m
├── lib
│ ├── main.dart
│ ├── main_widget.dart
│ └── sub_main_widget.dart
└── pubspec.yaml
├── flutter_subscreen_plugin.iml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── FlutterSubscreenPlugin.h
│ └── FlutterSubscreenPlugin.m
└── flutter_subscreen_plugin.podspec
├── lib
├── flutter_subscreen_plugin.dart
└── src
│ ├── constant.dart
│ └── sub_screen_plugin.dart
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 | .idea/vcs.xml
9 | android/.idea/.gitignore
10 | android/.idea/.name
11 | android/.idea/compiler.xml
12 | android/.idea/gradle.xml
13 | android/.idea/jarRepositories.xml
14 | android/.idea/misc.xml
15 | android/.idea/modules.xml
16 | android/.idea/vcs.xml
17 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/dbnavigator.xml:
--------------------------------------------------------------------------------
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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.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: 78910062997c3a836feee883712c241a5fd22983
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright © 2021, liyufeng
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | Neither the name of the copyright holder nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Flutter 双屏通信引擎
2 |
3 | 
4 |
5 | ### 引言
6 |
7 | 支持收银应用的**双屏交互场景**,如:主屏(操作屏)+ 副屏(客显屏)
8 |
9 | 支持双屏安卓设备,主副屏均使用 flutter 进行开发,提供方法实现双屏间的通信交互。
10 |
11 |
12 |
13 | ### 新老方案对比
14 |
15 | 新方案统一技术栈,主副屏都使用 flutter 进行开发,降低开发及后期维护成本,通过创新的双引擎通信机制,确保了主副屏之间的高效交互。
16 |
17 | 
18 |
19 | ### 接入依赖
20 |
21 | 在pubspec.yaml文件中进行引用:
22 |
23 |
24 |
25 | ```dart
26 | dependencies:
27 | flutter:
28 | sdk: flutter
29 | flutter_subscreen_plugin: ^1.0.8
30 | ```
31 | ### 使用方法:
32 |
33 | 使用flutter进行主副屏的绘制,以及使用封装能力进行主副屏交互通信:
34 |
35 | #### 1. 在main入口区分主副屏:
36 | ```
37 | void main() {
38 | var defaultRouteName = window.defaultRouteName;
39 | if ("subMain" == defaultRouteName) {
40 | viceScreenMain();
41 | } else {
42 | defaultMain();
43 | }
44 | }
45 |
46 | //主屏ui
47 | void defaultMain() {
48 | runApp(MainApp());
49 | }
50 |
51 | //副屏ui
52 | void viceScreenMain() {
53 | runApp(SubApp());
54 | }
55 |
56 | ```
57 | #### 2. 示例:主屏发送数据给副屏
58 | ```
59 | SubScreenPlugin.sendMsgToViceScreen("data", params: {"params": "123"});
60 | ```
61 | #### 3. 示例:副屏接收主屏数据
62 | ```
63 | SubScreenPlugin.viceStream.listen((event) {
64 | print(event.arguments.toString());
65 | });
66 | ```
67 |
68 | #### 4. 提供方法:获取当前设备环境是否支持双屏
69 | ```
70 | SubScreenPlugin.isMultipleScreen((result) {
71 | print("是否支持双屏:$result");
72 | });
73 | ```
74 |
75 | #### 5. 提供方法:判断当前应用是否具备 overlay 窗口权限
76 | ```
77 | SubScreenPlugin.checkOverlayPermission((result) {
78 | print("是否支持 overlay:$result");
79 | });
80 | ```
81 |
82 | #### 6. 提供方法:申请 overlay 窗口权限,可将副屏设置为持久窗口
83 | ```
84 | SubScreenPlugin.requestOverlayPermission();
85 | ```
86 |
87 | #### 7. 提供方法:开启,关闭副屏
88 | ```
89 | SubScreenPlugin.doubleScreenShow(); //开启
90 | SubScreenPlugin.doubleScreenCancel(); //关闭
91 | ```
92 |
93 | #### 7. 支付设置初始化完成后直接显示副屏
94 | ```
95 | android -> values -> attrs.xml 添加配置
96 |
97 |
98 | true
99 | ```
100 |
101 |
102 | #### 8. 支持对副屏engine进行三方插件扩展
103 | ```
104 | android -> mainActivity -> onCreate 方法添加
105 |
106 | // 例如:在副屏引入了 camera: ^lastedVersion , 则需要在 onCreate super 方法后加入如下语句进行注册
107 |
108 | FlutterSubscreenPlugin.registerThirdPlugins(
109 | arrayListOf(
110 | io.flutter.plugins.camera.CameraPlugin(), // 对应的三方库名
111 | ),
112 | this.flutterEngine!!.plugins
113 | )
114 |
115 | ```
116 |
117 | ### 整体调用关系架构如下:
118 | 
119 |
120 | ### 运行效果图
121 |
122 | 完成上述步骤,简单的demo就做好了,如下是demo在实体设备的运行效果图:
123 |
124 | 
125 | (主屏)
126 |
127 | 
128 | (副屏)
129 |
130 | 
131 | (点击按键,接收主屏数据的副屏)
132 |
133 |
134 |
135 | > 以上使用方式,完整样例可参照插件中的example
136 |
137 |
138 |
139 | > [点击查看原理文档](https://juejin.cn/post/7007678468020240414)
140 |
--------------------------------------------------------------------------------
/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 'com.rex.flutter_subscreen_plugin'
2 | version '1.0'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.7.21'
6 | repositories {
7 | maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }//阿里云通道下载库加速
8 | google()
9 | jcenter()
10 | }
11 |
12 | dependencies {
13 | classpath 'com.android.tools.build:gradle:7.2.2'
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | }
16 | }
17 |
18 | rootProject.allprojects {
19 | repositories {
20 | maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }//阿里云通道下载库加速
21 | google()
22 | jcenter()
23 | }
24 | }
25 |
26 | apply plugin: 'com.android.library'
27 | apply plugin: 'kotlin-android'
28 |
29 | android {
30 | namespace 'com.rex.flutter_subscreen_plugin'
31 | compileSdkVersion 31
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 | kotlinOptions {
37 | jvmTarget = "1.8"
38 | }
39 | java {
40 | toolchain {
41 | languageVersion = JavaLanguageVersion.of(8)
42 | }
43 | }
44 | sourceSets {
45 | main.java.srcDirs += 'src/main/kotlin'
46 | }
47 | defaultConfig {
48 | minSdkVersion 16
49 | }
50 | lintOptions {
51 | disable 'InvalidPackage'
52 | }
53 | }
54 |
55 | //获取local.properties配置文件
56 | def localProperties = new Properties()
57 | def localPropertiesFile = rootProject.file('local.properties')
58 | if (localPropertiesFile.exists()) {
59 | localPropertiesFile.withReader('UTF-8') { reader ->
60 | localProperties.load(reader)
61 | }
62 | }
63 | //获取flutter的sdk路径
64 | def flutterRoot = localProperties.getProperty('flutter.sdk')
65 | if (flutterRoot == null) {
66 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
67 | }
68 |
69 |
70 | dependencies {
71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72 | compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar")
73 | compileOnly 'androidx.annotation:annotation:1.1.0'
74 | }
75 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/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-7.6-bin.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_subscreen_plugin'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/rex/flutter_subscreen_plugin/FlutterSubScreenPresentation.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin
2 |
3 | import android.app.Presentation
4 | import android.content.Context
5 | import android.os.Build
6 | import android.os.Bundle
7 | import android.view.Display
8 | import androidx.annotation.RequiresApi
9 | import io.flutter.embedding.android.FlutterView
10 | import io.flutter.embedding.engine.FlutterEngine
11 |
12 | /**
13 | * @Description: 副屏dialog
14 | * @Author: liyufeng
15 | * @CreateDate: 2021/3/16 10:55 AM
16 | */
17 |
18 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
19 | class FlutterSubScreenPresentation(
20 | outerContext: Context?,
21 | display: Display?,
22 | engine: FlutterEngine
23 | ) :
24 | Presentation(outerContext, display) {
25 |
26 | var flutterEngine: FlutterEngine = engine
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 | setContentView(R.layout.flutter_presentation_view)
31 | val flutterView: FlutterView = findViewById(R.id.flutter_presentation_view)
32 | flutterView.attachToFlutterEngine(flutterEngine)
33 | }
34 |
35 | override fun show() {
36 | super.show()
37 | // 一定要调用 不然页面会卡死不更新
38 | flutterEngine.lifecycleChannel.appIsResumed()
39 | }
40 |
41 | override fun dismiss() {
42 | flutterEngine.lifecycleChannel.appIsDetached()
43 | super.dismiss()
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/rex/flutter_subscreen_plugin/FlutterSubScreenProvider.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin
2 |
3 | import android.app.Activity
4 | import android.content.Context
5 | import android.media.MediaRouter
6 | import android.media.MediaRouter.ROUTE_TYPE_LIVE_VIDEO
7 | import android.os.Build
8 | import android.view.Display
9 | import androidx.annotation.RequiresApi
10 | import io.flutter.embedding.engine.FlutterEngine
11 | import android.media.MediaRouter.SimpleCallback
12 | import android.provider.Settings
13 | import android.view.WindowManager
14 | import com.rex.flutter_subscreen_plugin.FlutterSubscreenPlugin.Companion.addThirdPlugins
15 | import io.flutter.FlutterInjector
16 | import io.flutter.embedding.engine.dart.DartExecutor
17 |
18 |
19 | /**
20 | * @Description: 双屏管理提供
21 | * @Author: liyufeng
22 | * @CreateDate: 2021/3/16 10:53 AM
23 | */
24 |
25 | class FlutterSubScreenProvider private constructor() {
26 |
27 | private var mediaRouter: MediaRouter? = null
28 | var currentActivity: Activity? = null
29 | var flutterEngine: FlutterEngine? = null
30 | var presentation: FlutterSubScreenPresentation? = null
31 |
32 | private var iCallback: IFlutterSubCallback? = null
33 |
34 | companion object {
35 | val instance: FlutterSubScreenProvider by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
36 | FlutterSubScreenProvider()
37 | }
38 | }
39 |
40 | fun setFlutterSubCallback(callback: IFlutterSubCallback) {
41 | iCallback = callback
42 | }
43 |
44 | private val mMediaRouterCallback: SimpleCallback = object : SimpleCallback() {
45 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
46 | override fun onRouteSelected(router: MediaRouter?, type: Int, info: MediaRouter.RouteInfo) {
47 | ///发现可用的扩展屏
48 | showSubDisplay()
49 | }
50 |
51 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
52 | override fun onRouteUnselected(
53 | router: MediaRouter?,
54 | type: Int,
55 | info: MediaRouter.RouteInfo
56 | ) {
57 | ///无可用扩展屏幕
58 | closeSubDisplay()
59 | }
60 |
61 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
62 | override fun onRoutePresentationDisplayChanged(
63 | router: MediaRouter?,
64 | info: MediaRouter.RouteInfo
65 | ) {
66 | ///可用扩展屏幕发生变更
67 | showSubDisplay()
68 | }
69 | }
70 |
71 | /**
72 | * 执行初始化,由外部调用
73 | */
74 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
75 | fun doInit(activity: Activity, showSubScreen: Boolean) {
76 | currentActivity = activity
77 | mediaRouter = activity.applicationContext.getSystemService(Context.MEDIA_ROUTER_SERVICE) as MediaRouter
78 |
79 | //媒体设备监听
80 | mediaRouter?.addCallback(ROUTE_TYPE_LIVE_VIDEO, mMediaRouterCallback)
81 | if (showSubScreen) {
82 | showSubDisplay()
83 | }
84 | }
85 |
86 | fun onDispose() {
87 | try {
88 | mediaRouter?.removeCallback(mMediaRouterCallback)
89 | } catch (e: Exception) {
90 |
91 | } finally {
92 | flutterEngine = null
93 | mediaRouter = null
94 | iCallback = null
95 | presentation = null
96 | currentActivity = null
97 | }
98 | }
99 |
100 | /**
101 | * 初始化副屏 flutterEngine
102 | */
103 | private fun doInitEngine() {
104 | currentActivity?.let { activity ->
105 | if (flutterEngine != null) {
106 | //保证只初始化一次副屏 engine
107 | return
108 | }
109 | //初始化副屏
110 | flutterEngine = FlutterEngine(activity)
111 | addThirdPlugins()
112 | //指定初始化路由
113 | flutterEngine?.navigationChannel?.setInitialRoute(FlutterSubscreenPlugin.subMainRouter)
114 | flutterEngine?.dartExecutor?.executeDartEntrypoint(
115 | DartExecutor.DartEntrypoint(
116 | FlutterInjector.instance().flutterLoader().findAppBundlePath(),
117 | FlutterSubscreenPlugin.mainRouter
118 | )
119 | )
120 | iCallback?.onSubFlutterEngineCreated()
121 | }
122 | }
123 |
124 |
125 | /**
126 | * 获取扩展显示屏
127 | */
128 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
129 | fun getPresentationDisplay(): Display? {
130 | val route = mediaRouter?.getSelectedRoute(ROUTE_TYPE_LIVE_VIDEO)
131 | if (route != null) {
132 | return route.presentationDisplay
133 | }
134 | return null
135 | }
136 |
137 | /**
138 | * 是否支持双屏
139 | */
140 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
141 | fun supportViceScreen(): Boolean {
142 | return getPresentationDisplay() != null
143 | }
144 |
145 | /**
146 | * show副屏
147 | */
148 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
149 | fun showSubDisplay() {
150 | //先把之前的隐藏
151 | closeSubDisplay()
152 | currentActivity?.let {
153 | if (!it.isFinishing) {
154 | configSecondDisplay(it)
155 | }
156 | }
157 | }
158 |
159 | /**
160 | * hide副屏
161 | */
162 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
163 | fun closeSubDisplay() {
164 | presentation?.let {
165 | if (it.isShowing) {
166 | it.dismiss()
167 | }
168 | }
169 | presentation = null
170 | }
171 |
172 | /**
173 | * 校验是否具备 overlay 权限
174 | */
175 | fun checkOverlayPermission(): Boolean {
176 | return if (Build.VERSION.SDK_INT >= 23 && currentActivity != null) {
177 | Settings.canDrawOverlays(currentActivity)
178 | } else {
179 | true
180 | }
181 | }
182 |
183 | /**
184 | * 显示扩展屏内容
185 | */
186 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
187 | fun configSecondDisplay(context: Context) {
188 | val display = getPresentationDisplay()
189 | if (display != null) {
190 | doInitEngine()
191 | flutterEngine?.let { engine ->
192 | try {
193 | presentation = FlutterSubScreenPresentation(context, display, engine)
194 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
195 | if (checkOverlayPermission()) {
196 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
197 | presentation?.window?.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY)
198 | } else {
199 | presentation?.window?.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT)
200 | }
201 | }
202 | }
203 | presentation?.show()
204 | } catch (e: Throwable) {
205 | println(e.message)
206 | e.printStackTrace()
207 | }
208 | }
209 | }
210 | }
211 | }
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/rex/flutter_subscreen_plugin/FlutterSubscreenPlugin.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.os.Build
6 | import android.provider.Settings
7 | import androidx.annotation.NonNull
8 | import androidx.annotation.RequiresApi
9 | import io.flutter.embedding.android.FlutterActivity
10 | import io.flutter.embedding.engine.dart.DartExecutor
11 | import io.flutter.embedding.engine.plugins.FlutterPlugin
12 | import io.flutter.embedding.engine.plugins.PluginRegistry
13 | import io.flutter.embedding.engine.plugins.activity.ActivityAware
14 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
15 | import io.flutter.plugin.common.MethodCall
16 | import io.flutter.plugin.common.MethodChannel
17 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler
18 | import io.flutter.plugin.common.MethodChannel.Result
19 |
20 | /** FlutterSubscreenPlugin */
21 | class FlutterSubscreenPlugin : FlutterPlugin, ActivityAware, MethodCallHandler {
22 |
23 | private lateinit var context: Context
24 | private lateinit var mainChannel: MethodChannel
25 | private var subChannel: MethodChannel? = null
26 |
27 | companion object {
28 | private const val mainChannelName = "screen_plugin_main_channel"
29 | private const val subChannelName = "screen_plugin_sub_channel"
30 | private var mainPluginRegistry: PluginRegistry? = null
31 | private var flutterPluginBindingCache: FlutterPlugin.FlutterPluginBinding? = null
32 | private var activityPluginBindingCache: ActivityPluginBinding? = null
33 |
34 | //用于设置副屏 flutterEngine 需要引入的三方插件库
35 | var tripPlugins: ArrayList? = null
36 |
37 | //主屏路由
38 | const val mainRouter = "main"
39 |
40 | //副屏路由
41 | const val subMainRouter = "subMain"
42 |
43 | fun registerThirdPlugins(
44 | plugins: ArrayList,
45 | mainPluginRegistry: PluginRegistry
46 | ) {
47 | this.tripPlugins = plugins
48 | this.mainPluginRegistry = mainPluginRegistry
49 | addThirdPlugins()
50 | }
51 |
52 | fun addThirdPlugins() {
53 | FlutterSubScreenProvider.instance.flutterEngine?.let { engine ->
54 | mainPluginRegistry?.let { mainPluginRegistry ->
55 | flutterPluginBindingCache?.let {
56 | replaceTripPlugins(mainPluginRegistry, it)
57 | //设置副屏engine需要引入的三方插件库
58 | this.tripPlugins?.let { pluginItems ->
59 | if (!pluginItems.isNullOrEmpty()) {
60 | pluginItems.forEach { plugin ->
61 | engine.plugins.add(plugin)
62 | }
63 | activityPluginBindingCache?.let { binding ->
64 | thirdOnAttachedToActivity(binding)
65 | }
66 | }
67 | }
68 | }
69 | }
70 | }
71 | }
72 |
73 | private fun thirdOnAttachedToActivity(binding: ActivityPluginBinding) {
74 | FlutterSubScreenProvider.instance.flutterEngine?.let {
75 | tripPlugins?.forEach {
76 | try {
77 | if (it is ActivityAware) {
78 | it.onAttachedToActivity(binding)
79 | }
80 | } catch (e: Exception) {
81 | //暂无处理
82 | }
83 | }
84 | }
85 | }
86 |
87 | private fun replaceTripPlugins(
88 | mainPluginRegistry: PluginRegistry,
89 | @NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding
90 | ) {
91 | try {
92 | tripPlugins?.let {
93 | if (it.isNotEmpty()) {
94 | val replacePlugins = arrayListOf()
95 | for (plugin in it) {
96 | val itemPlugin =
97 | mainPluginRegistry.get(plugin.javaClass)
98 | itemPlugin?.let { itemPlugin ->
99 | itemPlugin.onAttachedToEngine(flutterPluginBinding)
100 | replacePlugins.add(itemPlugin)
101 | }
102 | }
103 | tripPlugins = replacePlugins
104 | }
105 | }
106 | } catch (e: Exception) {
107 | //暂无处理
108 | }
109 | }
110 | }
111 |
112 | private fun onCreateViceChannel(dartExecutor: DartExecutor) {
113 | subChannel = MethodChannel(dartExecutor, subChannelName)
114 | //将副屏事件中转给主屏的engine
115 | subChannel?.setMethodCallHandler { call, _ ->
116 | mainChannel.invokeMethod(call.method, call.arguments)
117 | }
118 | }
119 |
120 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
121 | flutterPluginBindingCache = flutterPluginBinding
122 | context = flutterPluginBinding.applicationContext
123 | mainChannel = MethodChannel(flutterPluginBinding.binaryMessenger, mainChannelName)
124 | mainChannel.setMethodCallHandler(this)
125 | }
126 |
127 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
128 | flutterPluginBindingCache = null
129 | mainChannel.setMethodCallHandler(null)
130 | subChannel?.setMethodCallHandler(null)
131 | try {
132 | tripPlugins?.forEach {
133 | it.onDetachedFromEngine(binding)
134 | }
135 | } catch (e: Exception) {
136 | //暂无处理
137 | }
138 | }
139 |
140 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
141 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
142 | //提供方法查询是否支持双屏
143 | when (call.method) {
144 | Constant.METHOD_SUPPORT_DOUBLE_SCREEN -> {
145 | val isMultipleScreen = FlutterSubScreenProvider.instance.supportViceScreen()
146 | result.success(isMultipleScreen)
147 | }
148 |
149 | Constant.METHOD_CHECK_OVERLAY_PERMISSION -> {
150 | //校验是否具有 overlay 权限
151 | result.success(FlutterSubScreenProvider.instance.checkOverlayPermission())
152 | }
153 |
154 | Constant.METHOD_REQUEST_OVERLAY_PERMISSION -> {
155 | //申请 overlay 权限
156 | if (Build.VERSION.SDK_INT >= 23) {
157 | val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)
158 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
159 | context.startActivity(intent)
160 | }
161 | }
162 |
163 | Constant.METHOD_DOUBLE_SCREEN_SHOW -> {
164 | //显示副屏
165 | FlutterSubScreenProvider.instance.showSubDisplay()
166 | }
167 |
168 | Constant.METHOD_DOUBLE_SCREEN_CANCEL -> {
169 | //关闭副屏
170 | FlutterSubScreenProvider.instance.closeSubDisplay()
171 | }
172 |
173 | else -> {
174 | //主屏通过mainChannel将事件和参数传递给副屏subChannel
175 | subChannel?.invokeMethod(call.method, call.arguments)
176 | }
177 | }
178 | }
179 |
180 | @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
181 | override fun onAttachedToActivity(binding: ActivityPluginBinding) {
182 | activityPluginBindingCache = binding
183 | //your plugin is now attached to an Activity
184 | FlutterSubScreenProvider.instance.setFlutterSubCallback(object : IFlutterSubCallback {
185 | override fun onSubFlutterEngineCreated() {
186 | //副屏 engine 初始化后,将副屏事件进行分发
187 | FlutterSubScreenProvider.instance.flutterEngine?.let { engine ->
188 | onCreateViceChannel(engine.dartExecutor)
189 | }
190 | thirdOnAttachedToActivity(binding)
191 | }
192 | })
193 | val autoShowSubScreenWhenInit =
194 | context.resources.getBoolean(R.bool.autoShowSubScreenWhenInit)
195 | FlutterSubScreenProvider.instance.doInit(binding.activity, autoShowSubScreenWhenInit)
196 | }
197 |
198 | override fun onDetachedFromActivity() {
199 | //your plugin is no longer associated with an Activity.
200 | activityPluginBindingCache = null
201 | FlutterSubScreenProvider.instance.onDispose()
202 | tripPlugins?.forEach {
203 | try {
204 | if (it is ActivityAware) {
205 | it.onDetachedFromActivity()
206 | }
207 | } catch (e: Exception) {
208 | //暂无处理
209 | }
210 | }
211 | }
212 |
213 | override fun onDetachedFromActivityForConfigChanges() {
214 | //the Activity your plugin was attached to was
215 | // destroyed to change configuration.
216 | // This call will be followed by onReattachedToActivityForConfigChanges().
217 | //暂无处理
218 | }
219 |
220 | override fun onReattachedToActivityForConfigChanges(p0: ActivityPluginBinding) {
221 | //your plugin is now attached to a new Activity
222 | // after a configuration change.
223 | //暂无处理
224 | }
225 |
226 | }
227 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/rex/flutter_subscreen_plugin/IFlutterSubCallback.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin
2 |
3 | /**
4 | * @Author: liyufeng
5 | * @CreateDate: 2022/11/21 2:54 下午
6 | */
7 |
8 | interface IFlutterSubCallback {
9 |
10 | /**
11 | * 通知副屏 engine 初始化完成
12 | */
13 | fun onSubFlutterEngineCreated()
14 |
15 | }
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/rex/flutter_subscreen_plugin/constant.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin
2 |
3 | /**
4 | * @Description: 常量
5 | * @Author: liyufeng
6 | * @CreateDate: 2022/6/29 9:31 上午
7 | */
8 |
9 | abstract class Constant {
10 | companion object {
11 | const val METHOD_SUPPORT_DOUBLE_SCREEN = "supportDoubleScreen" //是否支持多屏
12 | const val METHOD_CHECK_OVERLAY_PERMISSION = "checkOverlayPermission" //校验overlay权限
13 | const val METHOD_REQUEST_OVERLAY_PERMISSION = "requestOverlayPermission" //请求overlay权限
14 | const val METHOD_DOUBLE_SCREEN_SHOW = "doubleScreenShow" //显示副屏
15 | const val METHOD_DOUBLE_SCREEN_CANCEL = "doubleScreenCancel" //关闭副屏
16 | }
17 | }
--------------------------------------------------------------------------------
/android/src/main/res/layout/flutter_presentation_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/android/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
--------------------------------------------------------------------------------
/android/src/main/res/values/refs.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
--------------------------------------------------------------------------------
/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: 78910062997c3a836feee883712c241a5fd22983
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_subscreen_plugin_example
2 |
3 | Demonstrates how to use the flutter_subscreen_plugin 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 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 31
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.rex.flutter_subscreen_plugin_example"
42 | minSdkVersion 21
43 | targetSdkVersion 29
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | }
47 |
48 | buildTypes {
49 | release {
50 | // TODO: Add your own signing config for the release build.
51 | // Signing with the debug keys for now, so `flutter run --release` works.
52 | signingConfig signingConfigs.debug
53 | }
54 | }
55 | }
56 |
57 | flutter {
58 | source '../..'
59 | }
60 |
61 | dependencies {
62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
63 | }
64 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
11 |
18 |
22 |
26 |
31 |
35 |
36 |
37 |
38 |
39 |
40 |
42 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/rex/flutter_subscreen_plugin_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.rex.flutter_subscreen_plugin_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.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 | ext.kotlin_version = '1.7.21'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 | android.enableR8=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-7.6-bin.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/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/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 flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32 | end
33 |
34 | post_install do |installer|
35 | installer.pods_project.targets.each do |target|
36 | flutter_additional_ios_build_settings(target)
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
13 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXCopyFilesBuildPhase section */
20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
21 | isa = PBXCopyFilesBuildPhase;
22 | buildActionMask = 2147483647;
23 | dstPath = "";
24 | dstSubfolderSpec = 10;
25 | files = (
26 | );
27 | name = "Embed Frameworks";
28 | runOnlyForDeploymentPostprocessing = 0;
29 | };
30 | /* End PBXCopyFilesBuildPhase section */
31 |
32 | /* Begin PBXFileReference section */
33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
36 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
37 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
38 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
39 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
40 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
41 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
47 | /* End PBXFileReference section */
48 |
49 | /* Begin PBXFrameworksBuildPhase section */
50 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
51 | isa = PBXFrameworksBuildPhase;
52 | buildActionMask = 2147483647;
53 | files = (
54 | );
55 | runOnlyForDeploymentPostprocessing = 0;
56 | };
57 | /* End PBXFrameworksBuildPhase section */
58 |
59 | /* Begin PBXGroup section */
60 | 9740EEB11CF90186004384FC /* Flutter */ = {
61 | isa = PBXGroup;
62 | children = (
63 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
64 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
65 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
66 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
67 | );
68 | name = Flutter;
69 | sourceTree = "";
70 | };
71 | 97C146E51CF9000F007C117D = {
72 | isa = PBXGroup;
73 | children = (
74 | 9740EEB11CF90186004384FC /* Flutter */,
75 | 97C146F01CF9000F007C117D /* Runner */,
76 | 97C146EF1CF9000F007C117D /* Products */,
77 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
78 | );
79 | sourceTree = "";
80 | };
81 | 97C146EF1CF9000F007C117D /* Products */ = {
82 | isa = PBXGroup;
83 | children = (
84 | 97C146EE1CF9000F007C117D /* Runner.app */,
85 | );
86 | name = Products;
87 | sourceTree = "";
88 | };
89 | 97C146F01CF9000F007C117D /* Runner */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
93 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
94 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
95 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
96 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97 | 97C147021CF9000F007C117D /* Info.plist */,
98 | 97C146F11CF9000F007C117D /* Supporting Files */,
99 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
100 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
101 | );
102 | path = Runner;
103 | sourceTree = "";
104 | };
105 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 97C146F21CF9000F007C117D /* main.m */,
109 | );
110 | name = "Supporting Files";
111 | sourceTree = "";
112 | };
113 | /* End PBXGroup section */
114 |
115 | /* Begin PBXNativeTarget section */
116 | 97C146ED1CF9000F007C117D /* Runner */ = {
117 | isa = PBXNativeTarget;
118 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
119 | buildPhases = (
120 | 9740EEB61CF901F6004384FC /* Run Script */,
121 | 97C146EA1CF9000F007C117D /* Sources */,
122 | 97C146EB1CF9000F007C117D /* Frameworks */,
123 | 97C146EC1CF9000F007C117D /* Resources */,
124 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
125 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
126 | );
127 | buildRules = (
128 | );
129 | dependencies = (
130 | );
131 | name = Runner;
132 | productName = Runner;
133 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
134 | productType = "com.apple.product-type.application";
135 | };
136 | /* End PBXNativeTarget section */
137 |
138 | /* Begin PBXProject section */
139 | 97C146E61CF9000F007C117D /* Project object */ = {
140 | isa = PBXProject;
141 | attributes = {
142 | LastUpgradeCheck = 1020;
143 | ORGANIZATIONNAME = "";
144 | TargetAttributes = {
145 | 97C146ED1CF9000F007C117D = {
146 | CreatedOnToolsVersion = 7.3.1;
147 | };
148 | };
149 | };
150 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
151 | compatibilityVersion = "Xcode 9.3";
152 | developmentRegion = en;
153 | hasScannedForEncodings = 0;
154 | knownRegions = (
155 | en,
156 | Base,
157 | );
158 | mainGroup = 97C146E51CF9000F007C117D;
159 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
160 | projectDirPath = "";
161 | projectRoot = "";
162 | targets = (
163 | 97C146ED1CF9000F007C117D /* Runner */,
164 | );
165 | };
166 | /* End PBXProject section */
167 |
168 | /* Begin PBXResourcesBuildPhase section */
169 | 97C146EC1CF9000F007C117D /* Resources */ = {
170 | isa = PBXResourcesBuildPhase;
171 | buildActionMask = 2147483647;
172 | files = (
173 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
174 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
175 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
176 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
177 | );
178 | runOnlyForDeploymentPostprocessing = 0;
179 | };
180 | /* End PBXResourcesBuildPhase section */
181 |
182 | /* Begin PBXShellScriptBuildPhase section */
183 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
184 | isa = PBXShellScriptBuildPhase;
185 | buildActionMask = 2147483647;
186 | files = (
187 | );
188 | inputPaths = (
189 | );
190 | name = "Thin Binary";
191 | outputPaths = (
192 | );
193 | runOnlyForDeploymentPostprocessing = 0;
194 | shellPath = /bin/sh;
195 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
196 | };
197 | 9740EEB61CF901F6004384FC /* Run Script */ = {
198 | isa = PBXShellScriptBuildPhase;
199 | buildActionMask = 2147483647;
200 | files = (
201 | );
202 | inputPaths = (
203 | );
204 | name = "Run Script";
205 | outputPaths = (
206 | );
207 | runOnlyForDeploymentPostprocessing = 0;
208 | shellPath = /bin/sh;
209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
210 | };
211 | /* End PBXShellScriptBuildPhase section */
212 |
213 | /* Begin PBXSourcesBuildPhase section */
214 | 97C146EA1CF9000F007C117D /* Sources */ = {
215 | isa = PBXSourcesBuildPhase;
216 | buildActionMask = 2147483647;
217 | files = (
218 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
219 | 97C146F31CF9000F007C117D /* main.m in Sources */,
220 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
221 | );
222 | runOnlyForDeploymentPostprocessing = 0;
223 | };
224 | /* End PBXSourcesBuildPhase section */
225 |
226 | /* Begin PBXVariantGroup section */
227 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
228 | isa = PBXVariantGroup;
229 | children = (
230 | 97C146FB1CF9000F007C117D /* Base */,
231 | );
232 | name = Main.storyboard;
233 | sourceTree = "";
234 | };
235 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
236 | isa = PBXVariantGroup;
237 | children = (
238 | 97C147001CF9000F007C117D /* Base */,
239 | );
240 | name = LaunchScreen.storyboard;
241 | sourceTree = "";
242 | };
243 | /* End PBXVariantGroup section */
244 |
245 | /* Begin XCBuildConfiguration section */
246 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
247 | isa = XCBuildConfiguration;
248 | buildSettings = {
249 | ALWAYS_SEARCH_USER_PATHS = NO;
250 | CLANG_ANALYZER_NONNULL = YES;
251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
252 | CLANG_CXX_LIBRARY = "libc++";
253 | CLANG_ENABLE_MODULES = YES;
254 | CLANG_ENABLE_OBJC_ARC = YES;
255 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
256 | CLANG_WARN_BOOL_CONVERSION = YES;
257 | CLANG_WARN_COMMA = YES;
258 | CLANG_WARN_CONSTANT_CONVERSION = YES;
259 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
261 | CLANG_WARN_EMPTY_BODY = YES;
262 | CLANG_WARN_ENUM_CONVERSION = YES;
263 | CLANG_WARN_INFINITE_RECURSION = YES;
264 | CLANG_WARN_INT_CONVERSION = YES;
265 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
266 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
267 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
269 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
270 | CLANG_WARN_STRICT_PROTOTYPES = YES;
271 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
272 | CLANG_WARN_UNREACHABLE_CODE = YES;
273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
275 | COPY_PHASE_STRIP = NO;
276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
277 | ENABLE_NS_ASSERTIONS = NO;
278 | ENABLE_STRICT_OBJC_MSGSEND = YES;
279 | GCC_C_LANGUAGE_STANDARD = gnu99;
280 | GCC_NO_COMMON_BLOCKS = YES;
281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
283 | GCC_WARN_UNDECLARED_SELECTOR = YES;
284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
285 | GCC_WARN_UNUSED_FUNCTION = YES;
286 | GCC_WARN_UNUSED_VARIABLE = YES;
287 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
288 | MTL_ENABLE_DEBUG_INFO = NO;
289 | SDKROOT = iphoneos;
290 | SUPPORTED_PLATFORMS = iphoneos;
291 | TARGETED_DEVICE_FAMILY = "1,2";
292 | VALIDATE_PRODUCT = YES;
293 | };
294 | name = Profile;
295 | };
296 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
297 | isa = XCBuildConfiguration;
298 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
299 | buildSettings = {
300 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
301 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
302 | ENABLE_BITCODE = NO;
303 | FRAMEWORK_SEARCH_PATHS = (
304 | "$(inherited)",
305 | "$(PROJECT_DIR)/Flutter",
306 | );
307 | INFOPLIST_FILE = Runner/Info.plist;
308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
309 | LIBRARY_SEARCH_PATHS = (
310 | "$(inherited)",
311 | "$(PROJECT_DIR)/Flutter",
312 | );
313 | PRODUCT_BUNDLE_IDENTIFIER = com.rex.flutterSubscreenPluginExample;
314 | PRODUCT_NAME = "$(TARGET_NAME)";
315 | VERSIONING_SYSTEM = "apple-generic";
316 | };
317 | name = Profile;
318 | };
319 | 97C147031CF9000F007C117D /* Debug */ = {
320 | isa = XCBuildConfiguration;
321 | buildSettings = {
322 | ALWAYS_SEARCH_USER_PATHS = NO;
323 | CLANG_ANALYZER_NONNULL = YES;
324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
325 | CLANG_CXX_LIBRARY = "libc++";
326 | CLANG_ENABLE_MODULES = YES;
327 | CLANG_ENABLE_OBJC_ARC = YES;
328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
329 | CLANG_WARN_BOOL_CONVERSION = YES;
330 | CLANG_WARN_COMMA = YES;
331 | CLANG_WARN_CONSTANT_CONVERSION = YES;
332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
334 | CLANG_WARN_EMPTY_BODY = YES;
335 | CLANG_WARN_ENUM_CONVERSION = YES;
336 | CLANG_WARN_INFINITE_RECURSION = YES;
337 | CLANG_WARN_INT_CONVERSION = YES;
338 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
339 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
343 | CLANG_WARN_STRICT_PROTOTYPES = YES;
344 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
348 | COPY_PHASE_STRIP = NO;
349 | DEBUG_INFORMATION_FORMAT = dwarf;
350 | ENABLE_STRICT_OBJC_MSGSEND = YES;
351 | ENABLE_TESTABILITY = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu99;
353 | GCC_DYNAMIC_NO_PIC = NO;
354 | GCC_NO_COMMON_BLOCKS = YES;
355 | GCC_OPTIMIZATION_LEVEL = 0;
356 | GCC_PREPROCESSOR_DEFINITIONS = (
357 | "DEBUG=1",
358 | "$(inherited)",
359 | );
360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
362 | GCC_WARN_UNDECLARED_SELECTOR = YES;
363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
364 | GCC_WARN_UNUSED_FUNCTION = YES;
365 | GCC_WARN_UNUSED_VARIABLE = YES;
366 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
367 | MTL_ENABLE_DEBUG_INFO = YES;
368 | ONLY_ACTIVE_ARCH = YES;
369 | SDKROOT = iphoneos;
370 | TARGETED_DEVICE_FAMILY = "1,2";
371 | };
372 | name = Debug;
373 | };
374 | 97C147041CF9000F007C117D /* Release */ = {
375 | isa = XCBuildConfiguration;
376 | buildSettings = {
377 | ALWAYS_SEARCH_USER_PATHS = NO;
378 | CLANG_ANALYZER_NONNULL = YES;
379 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
380 | CLANG_CXX_LIBRARY = "libc++";
381 | CLANG_ENABLE_MODULES = YES;
382 | CLANG_ENABLE_OBJC_ARC = YES;
383 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
384 | CLANG_WARN_BOOL_CONVERSION = YES;
385 | CLANG_WARN_COMMA = YES;
386 | CLANG_WARN_CONSTANT_CONVERSION = YES;
387 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
388 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
389 | CLANG_WARN_EMPTY_BODY = YES;
390 | CLANG_WARN_ENUM_CONVERSION = YES;
391 | CLANG_WARN_INFINITE_RECURSION = YES;
392 | CLANG_WARN_INT_CONVERSION = YES;
393 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
394 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
395 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
397 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
398 | CLANG_WARN_STRICT_PROTOTYPES = YES;
399 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
400 | CLANG_WARN_UNREACHABLE_CODE = YES;
401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
402 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
403 | COPY_PHASE_STRIP = NO;
404 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
405 | ENABLE_NS_ASSERTIONS = NO;
406 | ENABLE_STRICT_OBJC_MSGSEND = YES;
407 | GCC_C_LANGUAGE_STANDARD = gnu99;
408 | GCC_NO_COMMON_BLOCKS = YES;
409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
411 | GCC_WARN_UNDECLARED_SELECTOR = YES;
412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
413 | GCC_WARN_UNUSED_FUNCTION = YES;
414 | GCC_WARN_UNUSED_VARIABLE = YES;
415 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
416 | MTL_ENABLE_DEBUG_INFO = NO;
417 | SDKROOT = iphoneos;
418 | SUPPORTED_PLATFORMS = iphoneos;
419 | TARGETED_DEVICE_FAMILY = "1,2";
420 | VALIDATE_PRODUCT = YES;
421 | };
422 | name = Release;
423 | };
424 | 97C147061CF9000F007C117D /* Debug */ = {
425 | isa = XCBuildConfiguration;
426 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
427 | buildSettings = {
428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
429 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
430 | ENABLE_BITCODE = NO;
431 | FRAMEWORK_SEARCH_PATHS = (
432 | "$(inherited)",
433 | "$(PROJECT_DIR)/Flutter",
434 | );
435 | INFOPLIST_FILE = Runner/Info.plist;
436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
437 | LIBRARY_SEARCH_PATHS = (
438 | "$(inherited)",
439 | "$(PROJECT_DIR)/Flutter",
440 | );
441 | PRODUCT_BUNDLE_IDENTIFIER = com.rex.flutterSubscreenPluginExample;
442 | PRODUCT_NAME = "$(TARGET_NAME)";
443 | VERSIONING_SYSTEM = "apple-generic";
444 | };
445 | name = Debug;
446 | };
447 | 97C147071CF9000F007C117D /* Release */ = {
448 | isa = XCBuildConfiguration;
449 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
450 | buildSettings = {
451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
452 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
453 | ENABLE_BITCODE = NO;
454 | FRAMEWORK_SEARCH_PATHS = (
455 | "$(inherited)",
456 | "$(PROJECT_DIR)/Flutter",
457 | );
458 | INFOPLIST_FILE = Runner/Info.plist;
459 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
460 | LIBRARY_SEARCH_PATHS = (
461 | "$(inherited)",
462 | "$(PROJECT_DIR)/Flutter",
463 | );
464 | PRODUCT_BUNDLE_IDENTIFIER = com.rex.flutterSubscreenPluginExample;
465 | PRODUCT_NAME = "$(TARGET_NAME)";
466 | VERSIONING_SYSTEM = "apple-generic";
467 | };
468 | name = Release;
469 | };
470 | /* End XCBuildConfiguration section */
471 |
472 | /* Begin XCConfigurationList section */
473 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
474 | isa = XCConfigurationList;
475 | buildConfigurations = (
476 | 97C147031CF9000F007C117D /* Debug */,
477 | 97C147041CF9000F007C117D /* Release */,
478 | 249021D3217E4FDB00AE95B9 /* Profile */,
479 | );
480 | defaultConfigurationIsVisible = 0;
481 | defaultConfigurationName = Release;
482 | };
483 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
484 | isa = XCConfigurationList;
485 | buildConfigurations = (
486 | 97C147061CF9000F007C117D /* Debug */,
487 | 97C147071CF9000F007C117D /* Release */,
488 | 249021D4217E4FDB00AE95B9 /* Profile */,
489 | );
490 | defaultConfigurationIsVisible = 0;
491 | defaultConfigurationName = Release;
492 | };
493 | /* End XCConfigurationList section */
494 | };
495 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
496 | }
497 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/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 | flutter_subscreen_plugin_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 | import 'package:flutter/material.dart';
3 | import 'main_widget.dart';
4 | import 'sub_main_widget.dart';
5 |
6 | void main() {
7 | var defaultRouteName = window.defaultRouteName;
8 | if ("subMain" == defaultRouteName) {
9 | viceScreenMain();
10 | } else {
11 | defaultMain();
12 | }
13 | }
14 |
15 | //主屏ui
16 | void defaultMain() {
17 | runApp(MaterialApp(home: MainApp(),));
18 | }
19 |
20 | //副屏ui
21 | void viceScreenMain() {
22 | runApp(SubApp());
23 | }
24 |
--------------------------------------------------------------------------------
/example/lib/main_widget.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: missing_return
2 |
3 | import 'dart:developer';
4 | import 'dart:math';
5 | import 'dart:developer' as dev;
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_subscreen_plugin/flutter_subscreen_plugin.dart';
8 |
9 | ///主屏widget
10 | class MainApp extends StatefulWidget {
11 | const MainApp({Key key}) : super(key: key);
12 |
13 | @override
14 | _MainAppState createState() => _MainAppState();
15 | }
16 |
17 | class _MainAppState extends State {
18 | final _messangerKey = GlobalKey();
19 | String receiveData = 'null';
20 |
21 | @override
22 | void initState() {
23 | super.initState();
24 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
25 | checkOverlayPermission();
26 | });
27 | SubScreenPlugin.mainStream.listen((event) {
28 | setState(() {
29 | receiveData = event.arguments.toString();
30 | });
31 | });
32 | }
33 |
34 | ///判读是否需要 overlay 窗口权限
35 | void checkOverlayPermission() async {
36 | final isMultipleScreen = await SubScreenPlugin.isMultipleScreen;
37 | dev.log("是否支持副屏 : $isMultipleScreen");
38 |
39 | if (isMultipleScreen) {
40 | final hasOverlayPermission = await SubScreenPlugin.checkOverlayPermission;
41 | dev.log("overlay 权限为 : $hasOverlayPermission");
42 | if (!hasOverlayPermission) {
43 | _showCheckOverlayPermission();
44 | }
45 | }
46 | }
47 |
48 | ///弹窗询问是否进行 overlay 权限申请
49 | void _showCheckOverlayPermission() {
50 | showDialog(
51 | context: context,
52 | builder: (context) {
53 | return AlertDialog(
54 | content: Text('已检测到副屏,将副屏设置为持久窗口需开启权限,是否设置'),
55 | actions: [
56 | TextButton(
57 | onPressed: () {
58 | Navigator.of(context).pop();
59 | },
60 | child: Text('否'),
61 | ),
62 | TextButton(
63 | onPressed: () async {
64 | final hasPermission =
65 | await SubScreenPlugin.checkOverlayPermission;
66 | if (!hasPermission) {
67 | SubScreenPlugin.requestOverlayPermission();
68 | } else {
69 | SubScreenPlugin.doubleScreenShow();
70 | Navigator.of(context).pop();
71 | }
72 | },
73 | child: Text('是'),
74 | ),
75 | ],
76 | );
77 | },
78 | );
79 | }
80 |
81 | void sendMsgToSubScreen() {
82 | SubScreenPlugin.isMultipleScreen.then((isMultipleScreen) {
83 | if (isMultipleScreen) {
84 | final randomData = Random().nextInt(100).toString();
85 | SubScreenPlugin.sendMsgToViceScreen(
86 | "text",
87 | params: {"num": randomData},
88 | );
89 | } else {
90 | _messangerKey.currentState.showSnackBar(
91 | const SnackBar(
92 | content: Text('未查询到可用副屏'),
93 | ),
94 | );
95 | }
96 | });
97 | }
98 |
99 | @override
100 | Widget build(BuildContext context) {
101 | return MaterialApp(
102 | scaffoldMessengerKey: _messangerKey,
103 | home: Scaffold(
104 | appBar: AppBar(
105 | title: const Text('主屏'),
106 | ),
107 | body: Center(
108 | child: Column(
109 | crossAxisAlignment: CrossAxisAlignment.center,
110 | mainAxisAlignment: MainAxisAlignment.center,
111 | children: [
112 | Text('接收到的副屏数据为:$receiveData'),
113 | SizedBox(height: 30),
114 | TextButton(
115 | onPressed: sendMsgToSubScreen,
116 | child: Text('发送数据给副屏'),
117 | ),
118 | SizedBox(height: 30),
119 | TextButton(
120 | onPressed: (){
121 | SubScreenPlugin.doubleScreenShow();
122 | },
123 | child: Text('开启副屏'),
124 | ),
125 | SizedBox(height: 30),
126 | TextButton(
127 | onPressed: (){
128 | SubScreenPlugin.doubleScreenCancel();
129 | },
130 | child: Text('关闭副屏'),
131 | ),
132 | ],
133 | ),
134 | )),
135 | );
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/example/lib/sub_main_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_subscreen_plugin/flutter_subscreen_plugin.dart';
4 |
5 | ///副屏widget
6 | class SubApp extends StatefulWidget {
7 | const SubApp({Key key}) : super(key: key);
8 |
9 | @override
10 | _SubAppState createState() => _SubAppState();
11 | }
12 |
13 | class _SubAppState extends State {
14 | String receiveData = 'null';
15 |
16 | @override
17 | void initState() {
18 | super.initState();
19 | SubScreenPlugin.viceStream.listen((event) {
20 | setState(() {
21 | receiveData = event.arguments.toString();
22 | });
23 | });
24 |
25 | Future.delayed(const Duration(seconds: 5), sendMsgToMainScreen);
26 | }
27 |
28 | void sendMsgToMainScreen() {
29 | final randomData = Random().nextInt(100).toString();
30 | SubScreenPlugin.sendMsgToMainScreen("text", params: {"num": randomData});
31 | }
32 |
33 | @override
34 | Widget build(BuildContext context) {
35 | return MaterialApp(
36 | home: Scaffold(
37 | appBar: AppBar(
38 | title: const Text('副屏'),
39 | ),
40 | body: Center(
41 | child: Column(
42 | crossAxisAlignment: CrossAxisAlignment.center,
43 | mainAxisAlignment: MainAxisAlignment.center,
44 | children: [
45 | Text('接收到的主屏数据为:$receiveData'),
46 | SizedBox(height: 50),
47 | TextButton(onPressed: sendMsgToMainScreen, child: Text('发送数据给主屏')),
48 | ],
49 | ),
50 | )
51 | ),
52 | );
53 | }
54 | }
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_subscreen_plugin_example
2 | description: Demonstrates how to use the flutter_subscreen_plugin plugin.
3 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
4 |
5 | environment:
6 | sdk: ">=2.7.0 <3.0.0"
7 |
8 | dependencies:
9 | flutter:
10 | sdk: flutter
11 |
12 | flutter_subscreen_plugin:
13 | path: ../
14 | # webview_flutter: 3.0.0
15 | cupertino_icons: ^1.0.0
16 |
17 | dev_dependencies:
18 | flutter_test:
19 | sdk: flutter
20 |
21 | flutter:
22 | uses-material-design: true
--------------------------------------------------------------------------------
/flutter_subscreen_plugin.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/liyufengrex/flutter_subscreen_plugin/5d2a2b71600c6349d4cbe7464f9df8ac68142d16/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/FlutterSubscreenPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterSubscreenPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterSubscreenPlugin.m:
--------------------------------------------------------------------------------
1 | #import "FlutterSubscreenPlugin.h"
2 |
3 | @implementation FlutterSubscreenPlugin
4 | + (void)registerWithRegistrar:(NSObject*)registrar {
5 | FlutterMethodChannel* channel = [FlutterMethodChannel
6 | methodChannelWithName:@"flutter_subscreen_plugin"
7 | binaryMessenger:[registrar messenger]];
8 | FlutterSubscreenPlugin* instance = [[FlutterSubscreenPlugin alloc] init];
9 | [registrar addMethodCallDelegate:instance channel:channel];
10 | }
11 |
12 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
13 | if ([@"getPlatformVersion" isEqualToString:call.method]) {
14 | result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
15 | } else {
16 | result(FlutterMethodNotImplemented);
17 | }
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/ios/flutter_subscreen_plugin.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint flutter_subscreen_plugin.podspec' to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'flutter_subscreen_plugin'
7 | s.version = '0.0.1'
8 | s.summary = 'A new Flutter plugin.'
9 | s.description = <<-DESC
10 | A new Flutter plugin.
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.dependency 'Flutter'
19 | s.platform = :ios, '8.0'
20 |
21 | # Flutter.framework does not contain a i386 slice.
22 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
23 | end
24 |
--------------------------------------------------------------------------------
/lib/flutter_subscreen_plugin.dart:
--------------------------------------------------------------------------------
1 | library flutter_subscrenn_plugin;
2 |
3 | export 'src/sub_screen_plugin.dart';
4 |
--------------------------------------------------------------------------------
/lib/src/constant.dart:
--------------------------------------------------------------------------------
1 | /// 常量
2 | abstract class Constants {
3 |
4 | static const supportDoubleScreen = "supportDoubleScreen"; //是否支持多屏
5 | static const checkOverlayPermission = "checkOverlayPermission"; //校验overlay权限
6 | static const requestOverlayPermission = "requestOverlayPermission"; //请求overlay权限
7 | static const doubleScreenShow = "doubleScreenShow"; //显示副屏
8 | static const doubleScreenCancel = "doubleScreenCancel"; //关闭副屏
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/lib/src/sub_screen_plugin.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/services.dart';
4 |
5 | import 'constant.dart';
6 |
7 | ///封装方法用于主副屏交互
8 | abstract class SubScreenPlugin {
9 | static const _mainChannelName = 'screen_plugin_main_channel';
10 | static const _subChannelName = 'screen_plugin_sub_channel';
11 |
12 | // ignore: close_sinks
13 | static StreamController? _subStreamController;
14 |
15 | // ignore: close_sinks
16 | static StreamController? _mainStreamController;
17 |
18 | static MethodChannel _mainChannel = MethodChannel(_mainChannelName)
19 | ..setMethodCallHandler(_onMainChannelMethodHandler);
20 | static MethodChannel? _subChannel;
21 |
22 | static Stream get viceStream {
23 | if (_subChannel == null) {
24 | _subChannel = MethodChannel(_subChannelName)
25 | ..setMethodCallHandler(_onSubChannelMethodHandler);
26 | }
27 | if (_subStreamController == null) {
28 | _subStreamController = StreamController.broadcast();
29 | }
30 | return _subStreamController!.stream;
31 | }
32 |
33 | static Stream get mainStream {
34 | if (_mainStreamController == null) {
35 | _mainStreamController = StreamController.broadcast();
36 | }
37 | return _mainStreamController!.stream;
38 | }
39 |
40 | static Future _onSubChannelMethodHandler(MethodCall call) async {
41 | //副屏channel 每接收到一个事件都放进去流里, 由外部监听
42 | _subStreamController?.sink.add(call);
43 | }
44 |
45 | static Future _onMainChannelMethodHandler(MethodCall call) async {
46 | //主屏channel 每接收到一个事件都放进去流里, 由外部监听
47 | _mainStreamController?.sink.add(call);
48 | }
49 |
50 | ///返回支付支持双屏
51 | static Future get isMultipleScreen async {
52 | return await _mainChannel.invokeMethod(Constants.supportDoubleScreen);
53 | }
54 |
55 | ///校验overlay窗口权限
56 | static Future get checkOverlayPermission async {
57 | return await _mainChannel.invokeMethod(Constants.checkOverlayPermission);
58 | }
59 |
60 | ///请求overlay窗口权限
61 | static void requestOverlayPermission() {
62 | _mainChannel.invokeMethod(Constants.requestOverlayPermission);
63 | }
64 |
65 | ///打开副屏
66 | static void doubleScreenShow() {
67 | _mainChannel.invokeMethod(Constants.doubleScreenShow);
68 | }
69 |
70 | ///关闭副屏
71 | static void doubleScreenCancel() {
72 | _mainChannel.invokeMethod(Constants.doubleScreenCancel);
73 | }
74 |
75 | ///给主屏幕调用,发送事件体给副屏
76 | static Future sendMsgToViceScreen(
77 | String method, {
78 | Map? params,
79 | }) async {
80 | await _mainChannel.invokeMethod(method, params ?? {});
81 | }
82 |
83 | ///给副屏幕调用,发送事件体给主屏
84 | static Future sendMsgToMainScreen(
85 | String method, {
86 | Map? params,
87 | }) async {
88 | await _subChannel?.invokeMethod(method, params ?? {});
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_subscreen_plugin
2 | description: 支持双屏安卓设备,主副屏均使用 flutter 进行开发,提供双屏通信能力
3 | version: 1.3.2+5
4 | author: lixiaohong
5 | homepage: https://github.com/liyufengrex/flutter_subscreen_plugin
6 |
7 | environment:
8 | sdk: ">=2.12.0 <3.0.0"
9 | flutter: ">=2.5.3"
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
19 | flutter:
20 | plugin:
21 | platforms:
22 | android:
23 | package: com.rex.flutter_subscreen_plugin
24 | pluginClass: FlutterSubscreenPlugin
25 |
--------------------------------------------------------------------------------