flutter-thrio / flutter_thrio Goto Github PK
View Code? Open in Web Editor NEWflutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.
License: MIT License
flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.
License: MIT License
flutter_thrio 默认会将所有的 Flutter 页面的 UINavigationBar
隐藏掉,这样的话,FlutterViewController
的 UIScreenEdgePanGestureRecognizer
会失效,而 flutter_thrio 会内嵌 Flutter 页面,所以正好利用了这一点,让 Flutter 页面自身的侧滑返回手势生效。然后当 FlutterViewController
中只剩下一个 Flutter 页面时,需要将 FlutterViewController
的侧滑返回手势加回来,实现方式是单独加了一个 UIScreenEdgePanGestureRecognizer
,并将其 action 绑定到 handleNavigationTransition
。所以如果原有工程已经使用了类似 FDFullscreenPopGesture 的第三方库的话,这里的行为是未知的。从我个人的角度,我建议将这类全屏滑动返回的交互去掉,原因如下:
基于这些原因,引入 flutter_thrio 的时候遇到手势的问题,我能提供的方案是去掉原来的这类改造方案,flutter_thrio 本身只会对 FlutterViewController
进行改造,不影响原生页面。
报错信息:
Could not determine the dependencies of task ':thrio:compileDebugKotlin'.
Could not resolve all files for configuration ':thrio:debugRuntimeClasspath'.
Could not find io.flutter:flutter_embedding_debug:1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed/flutter_embedding_debug-1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed.pom
- https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed/flutter_embedding_debug-1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed.pom
- https://mirrors.cloud.tencent.com/flutter/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed/flutter_embedding_debug-1.0.0-2f0af3715217a0c2ada72c717d4ed9178d68f6ed.pom
Required by:
project :thrio
Possible solution:
1、能否提供一个方法来表示ThrioModule init完成
能不能实现在 iOS 页面给 flutter 发送 Notify 之后,flutter tab 页面立即收到 Notify ?
大概流程:先在 flutter 的 tab page 添加 NavigatorPageNotify,触发点击事件之后跳转到 iOS 页面,然后一顿操作并发送 Notify 让 tab page 执行某个函数
😺 看过文档,没有说到这种情况
demo 如下:
dart:
class _PageState extends State<TabbarPage> {
@override
Widget build(BuildContext context) {
return NavigatorPageNotify(
name: 'tab_page_notify',
onPageNotify: (params) {
print('-->> tab_page_notify');
},
child: ....
iOS:
[ThrioNavigator notifyWithName:@"tab_page_notify" params:@"test data" result:^(BOOL result) {
NSLog(@"-->> notify result:%d", result);
}];
Describe the bug
example 下载下来在xcode运行 一直显示转圈
To Reproduce
在xcode真机14.3运行 无法正常显示页面
Expected behavior
控制台没有报错
Flutter Doctor
no issure
OS & Device
Error logs
无 error log
我初始化是ThrioModule.init(FlutterModule.INSTANCE,application,false);
每次重新启动app,首次点击调用ThrioNavigator.push("/thrio_demo/flutter1"),没有反应;第二次点击调用ThrioNavigator.push("/thrio_demo/flutter1")就可以正常跳转了。
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Flutter Doctor
Run the flutter doctor -v command and post the log.
OS & Device
Error logs
Add logs about the problem here.
如果限制 Android 后台进程,并保留 Activity,这种情况下可能会出现 Flutter 页面无法恢复的问题。
暂时没有比较优雅的解决方案,因为 Flutter 混合栈的情况下,无法将所有页面都完整恢复,暂时考虑如何在这种情况出现时能让 Flutter 页面重启到第一个页面,嵌在 Flutter 页面中的原生页面也不能恢复。
Describe the bug
pop 手势与系统冲突, H5页面无法选择相册照片
To Reproduce
Steps to reproduce the behavior:
点击"选择照片" -> 多选(Choose Files) -> Photo Library -> 选择照片 -> 添加
Install
依次在终端执行如下命令安装依赖
Expected behavior
去掉 UINavigationController+PopGesture.m 文件里的手势就正常了
Flutter Doctor
[✓] Flutter (Channel master, 2.0.3, on macOS 11.5.1 20G80 darwin-x64, locale en-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.38.1)
[✓] Connected device (2 available)
OS & Device
。。。
我在 example 目录下使用 flutter create -i swift .
重新创建 ios 项目之后,AppDelegate 中的代码是否可以转为 swift 版?
[ThrioModule init:[MainModule new]];
UINavigationController *nvc = [[NavigatorNavigationController alloc] initWithUrl:@"/biz1/flutter1" params:nil];
self.window.rootViewController = nvc;
[self.window makeKeyAndVisible];
如果可以转 swift,那应该怎样转呢?谢谢!!
想改个跟项目功能模块对应的名称,结果改了名称之后(已修改项目中所有的 biz1 和 flutter1),运行项目时卡在 hot restart 启动界面,点击 hot restart 无响应。
mac os 10.15.7
vs code 1.54.3
Xcode 12
iOS 14.4 模拟器
😺
我在 iOS 原生中设置了 launch image,但是 App 启动的时候 launch image 一闪而过,然后会显示几秒钟的空白界面。
请问怎样才能将这几秒钟的空白界面替换为 launch image 呢?
我照着一些网上的教程试了,无效, demo 链接:https://github.com/hw20101101/thrio_demo
谢谢!!
2.1.x版本之后,不再维护 not nullsafety 分支,如可能还是尽快升级到 nullsafety 吧
本项目 API 已经稳定,不太可能出现 break change,当前稳定版本 2.0. x,当 x 是偶数时表示支持 Flutter 2.0 不带 nullsafety,当 x 是奇数时表示支持 Flutter 2.0 带 nullsafety。
thrio 是个人项目,目前是我一人在维护,原仓库不再更新。
最近遇到被问到与其它开源库对比的比较尖锐的一些问题,有时候我是不太想回答的,说多了有拆台嫌疑。
可以理解,很多人还是想得到更多信息来判断是否应不应该使用 thrio,我的几条建议如下:
最后还是说一句:thrio 是目前唯一支持 Flutter 混合栈跨栈路由的开源库,这句话从 thrio 开源至今一直都是有效的,等将来出现具备Flutter 混合栈跨栈路由的开源库,我再来改掉。
跨栈路由:无需关注页面类型是 iOS、Android 还是 Flutter,都一样具备完整的路由能力,调用者打开一个页面,接收该页面的回调,接收该页面的页面通知,即使将来其页面类型变更也无所谓。
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Flutter Doctor
Run the flutter doctor -v command and post the log.
OS & Device
Error logs
Add logs about the problem here.
FlutterEngine not ready
demo复杂看不懂
demo复杂看不懂
在最后Flutter页面侧滑后,返回上一个原生页面,再侧滑返回Flutter页面,查看在栈顶的Flutter页面侧滑时,并未执行Dispose函数。(如果栈内还有其他Flutter页面时,不会执行Dispose)
从FlutterA页面跳转进入原生B页面,再跳转进入FlutterC页面,会导致FlutterC页面渲染不出来,看数据是做了接口请求,并返回数据了,但是FlutterC页面却没有渲染出来,此时切换到后台,再切到前台,数据能正常显示出来了
Describe the bug
platform_view.cc(81):Failed to create platform view rendering surface
swift 项目,native侧 跳转flutter,跳转过去后,界面渲染不出来(白屏),点击界面,上面的按钮可以正常显示,flutter监视器 上可以正常看到按钮大小位置(swift项目,你们demo项目正常,对比了代码木有找到原因,flutter侧代码完全用demo里面的,猜测是native侧的问题)
Expected behavior
Flutter Doctor
OS & Device
Error logs
platform_view.cc(81):Failed to create platform view rendering surface
欢迎留言写下使用 thrio 的情况,这也是对 thrio 的支持。
粗略的看了下代码,貌似thrio目前默认的路由模式是单引擎单Navigator的模式,我目前有这样一个需求,Android和iOS的主页面都是有TabBar的,并且TabBar的4个TabView中,两个是FlutterView,另外两个目前只能保持Native实现,如何满足这类的需求?
Flutter 稳定版出后添加
Getx 无法集成到项目里面
请问一下是什么原因,点击flutter 页面点击导航栏返回没问题,侧滑就会卡住,
ThrioNavigator pushUrl 跳转没响应。
setFlutterPageBuilder 回调也不走。
请问是使用方式有问题吗?
路由插件?
- (void)set:(id _Nullable)value forKey:(NSString *)key {
if ([_params.allKeys containsObject:key] &&
![NSStringFromClass([_params[key] class]) isEqualToString:NSStringFromClass([value class])]) {
return;
}
id v = _params[key];
if (v != value) {
_params[key] = value;
id v = [ThrioModule serializeParams:value];
if ([v canTransToFlutter]) {
// 将数据同步给所有的 FlutterEngine
[NavigatorFlutterEngineFactory.shared setModuleContextValue:value
forKey:key];
}
}
}
这里通过 NSStringFromClass 获取字符串的类型会存在不同,导致问题,字符串太短的时候 NSStringFromClass([value class]) 得到的 NSTaggedPointerString
我在文档中也没有找到相关的说明。
另外,我把 demo 中的 ThrioNavigator.notify 搬到项目中但是却走不通。
谢谢!!
升级到Flutter2.5.2后,程序无法进行编译,报错找不到AndroidKeyProcessor类
虽然是混合栈框架,但引入后建议能用 Flutter 实现的都用 Flutter 实现,兼容原生路由栈只是为了复用既有功能和将来可能依赖的外部原生代码,所以本框架的重心之后会放在 Flutter 端的开发体验。
通过 yaml 文件来配置 Flutter 所有页面的路径,类似如下:
app:
order:
home:
list:
detail:
handle:
home:
result:
waybill:
home:
list:
detail:
handle:
home:
result:
根据该配置,生成模块化的 Flutter 代码框架。实际使用时,url 末尾的 home 可以省略掉。
Describe the bug
想要看看多引擎如何实现
打开 MainApp 中 您注释掉的句子 ThrioModule.init( MainModule, this, true)。
但是报错,找不到engindId
To Reproduce
ThrioModule.init( MainModule, this, true)
Flutter Doctor
Flutter 1.22.4
OS & Device
Android 10
Error logs
E/AndroidRuntime(11476): FATAL EXCEPTION: main
E/AndroidRuntime(11476): Process: com.hellobike.thrio_example, PID: 11476
E/AndroidRuntime(11476): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hellobike.thrio_example/io.flutter.embedding.android.ThrioActivity}: java.lang.IllegalStateException: The requested cached FlutterEngine did not exist in the FlutterEngineCache: 'biz1'
官方提供的引擎实例 fork 的能力,为实现 FlutterView 的支持提供了可能,对于嵌入 tab 的场景依赖于 FlutterView ,需提供支持
如图,android example报错
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (9, 8): Unresolved reference: kotlinx
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (14, 9): Unresolved reference: tv_native
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (14, 19): Variable expected
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (16, 9): Unresolved reference: btn_10
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (34, 9): Unresolved reference: btn_11
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (40, 9): Unresolved reference: btn_12
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (52, 9): Unresolved reference: btn_13
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (58, 9): Unresolved reference: btn_20
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (71, 9): Unresolved reference: btn_21
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (75, 9): Unresolved reference: btn_22
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (88, 9): Unresolved reference: btn_23
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (92, 9): Unresolved reference: btn_3
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (113, 17): Unresolved reference: tv_native
e: /Users/zhebian/Desktop/testCode/flutter_thrio/example/android/app/src/main/kotlin/com/hellobike/thrio_example/Native1Activity.kt: (113, 27): Variable expected
debug模式下可以正常运行,但是当使用build/Flutter APK时则无法正确打包,报如下问题:
FAILURE: Build failed with an exception.
Where:
Script '/Users/guoshun/Downloads/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command '/Users/guoshun/Downloads/flutter/bin/flutter'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s
Running Gradle task 'assembleRelease'... 12.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
Describe the bug
在 vs code 上面新建 flutter 项目之后,添加 thrio 2.0.11 依赖,然后在 荣耀v10 上面运行报错。
To Reproduce
Steps to reproduce the behavior:
Expected behavior
在手机上正常运行 flutter 项目
Flutter Doctor
[✓] Flutter (Channel stable, 2.2.1, on Mac OS X 10.15.7 19H15 darwin-x64, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.56.2)
OS & Device
Error logs
Launching lib/main.dart on BKL AL20 in debug mode...
lib/main.dart:1
e: /Users/xxx/Documents/xxx/flutter/.pub-cache/hosted/pub.flutter-io.cn/thrio-
2.0.11/android/src/main/kotlin/com/hellobike/flutter/thrio/navigator/PageRoutes.kt: (225, 34):
Unresolved reference: removeLast
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':thrio:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.