Git Product home page Git Product logo

flutter_thrio's People

Contributors

androidyue avatar angdo avatar cornerant avatar docee avatar foxsofter avatar hxiaoming avatar kmfish avatar liujinlong123 avatar prczhb avatar vadaski avatar xwnine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_thrio's Issues

关于 iOS 侧滑返回手势的交互解决方案

flutter_thrio 默认会将所有的 Flutter 页面的 UINavigationBar 隐藏掉,这样的话,FlutterViewControllerUIScreenEdgePanGestureRecognizer 会失效,而 flutter_thrio 会内嵌 Flutter 页面,所以正好利用了这一点,让 Flutter 页面自身的侧滑返回手势生效。然后当 FlutterViewController 中只剩下一个 Flutter 页面时,需要将 FlutterViewController 的侧滑返回手势加回来,实现方式是单独加了一个 UIScreenEdgePanGestureRecognizer ,并将其 action 绑定到 handleNavigationTransition。所以如果原有工程已经使用了类似 FDFullscreenPopGesture 的第三方库的话,这里的行为是未知的。从我个人的角度,我建议将这类全屏滑动返回的交互去掉,原因如下:

  1. 苹果的交互方式已经培养了用户习惯;
  2. 很多 App 引入这类全屏滑动返回手势后,将交互方式整的不伦不类的,除非能统一将所有页面都整成全屏滑动返回,包括网页甚至第三方页面,但一般情况下这是不太可能的,当然现在像头条之类的 App 基本上都会增加全屏滑动返回,这种情况下基本上不出现左右滑动的手势的话交互还是很不错的;
  3. 全屏滑动返回并没有解决页面上存在滑动手势的时候侧滑返回不够灵敏的问题,有的人为了要让滑动手势生效而将全屏滑动返回禁用,附带的可能把侧滑返回也禁用了,有的人直接不管,导致滑动手势失效,一般这时候用户只能通过点击tab来完成该功能,不管何种方式,都会导致交互更垃圾,让用户不知所措;
  4. 关于侧滑返回不够灵敏的问题的可能的解决方案也许是将划入的角度从 0° 改成 +10°/-10°,这样应该会比较容易触发侧滑返回;
  5. 关于网页的手势问题,实际上在iOS上是可以通过引入多容器页来解决的,这样可以让交互跟原生页面完全一样

基于这些原因,引入 flutter_thrio 的时候遇到手势的问题,我能提供的方案是去掉原来的这类改造方案,flutter_thrio 本身只会对 FlutterViewController 进行改造,不影响原生页面。

android example跑不起来

在 iOS 页面给 flutter 发送 Notify 之后,flutter 页面要显示之后才能收到 Notify ?

能不能实现在 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);
}];

ios 无法跳转到flutter端 一直转圈 显示 hot restart

Describe the bug
example 下载下来在xcode运行 一直显示转圈

To Reproduce
在xcode真机14.3运行 无法正常显示页面

Expected behavior
控制台没有报错

Flutter Doctor
no issure

OS & Device

  • Device: iPhoneXR
  • OS: ios 14.3
  • flutter 2.0.1

Error logs
无 error log

ThrioNavigator.push("/thrio_demo/flutter1")第一次点击没有效果

我初始化是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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

Error logs
Add logs about the problem here.

Android 在特殊情况下出现的问题

如果限制 Android 后台进程,并保留 Activity,这种情况下可能会出现 Flutter 页面无法恢复的问题。

暂时没有比较优雅的解决方案,因为 Flutter 混合栈的情况下,无法将所有页面都完整恢复,暂时考虑如何在这种情况出现时能让 Flutter 页面重启到第一个页面,嵌在 Flutter 页面中的原生页面也不能恢复。

pop 手势与系统冲突, H5页面无法选择相册照片

Describe the bug
pop 手势与系统冲突, H5页面无法选择相册照片

To Reproduce
Steps to reproduce the behavior:
点击"选择照片" -> 多选(Choose Files) -> Photo Library -> 选择照片 -> 添加

Install
依次在终端执行如下命令安装依赖

  1. cd my_flutter
  2. flutter pub get
  3. flutter build ios
  4. cd flutter_webview
  5. pod install

Expected behavior
去掉 UINavigationController+PopGesture.m 文件里的手势就正常了

image

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

  • Device: iPhone6s
  • OS: iOS14.7.1

flutter_webview.zip

hello,创建 swift 版的 ios 项目时遇到问题

我在 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,那应该怎样转呢?谢谢!!

修改 demo 中的 biz1 和 flutter1 目录之后运行异常

想改个跟项目功能模块对应的名称,结果改了名称之后(已修改项目中所有的 biz1 和 flutter1),运行项目时卡在 hot restart 启动界面,点击 hot restart 无响应。

mac os 10.15.7
vs code  1.54.3
Xcode 12
iOS 14.4 模拟器

thrio 维护公告

2.1.x版本之后,不再维护 not nullsafety 分支,如可能还是尽快升级到 nullsafety 吧

本项目 API 已经稳定,不太可能出现 break change,当前稳定版本 2.0. x,当 x 是偶数时表示支持 Flutter 2.0 不带 nullsafety,当 x 是奇数时表示支持 Flutter 2.0 带 nullsafety。

thrio 是个人项目,目前是我一人在维护,原仓库不再更新。

最近遇到被问到与其它开源库对比的比较尖锐的一些问题,有时候我是不太想回答的,说多了有拆台嫌疑。

可以理解,很多人还是想得到更多信息来判断是否应不应该使用 thrio,我的几条建议如下:

  1. 看自己的需求,满足自己需求是前提
  2. 看代码质量,这是最主要的一点
  3. 自己多测测,可以的话看看稳定性如何
  4. 可参考下 issue 数量和 star 数量比,未解决 issue 数量等
  5. 看代码更新频次

最后还是说一句:thrio 是目前唯一支持 Flutter 混合栈跨栈路由的开源库,这句话从 thrio 开源至今一直都是有效的,等将来出现具备Flutter 混合栈跨栈路由的开源库,我再来改掉。

跨栈路由:无需关注页面类型是 iOS、Android 还是 Flutter,都一样具备完整的路由能力,调用者打开一个页面,接收该页面的回调,接收该页面的页面通知,即使将来其页面类型变更也无所谓。

启动Demo 闪退

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

Error logs
Add logs about the problem here.

FlutterEngine not ready

flutter侧白屏 Failed to create platform view rendering surface

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

  • Device:   真机,模拟器
  • OS: ios14
  • Version:2.0.11
  • flutter ver:2.2.3
  • swift :5.3

Error logs
platform_view.cc(81):Failed to create platform view rendering surface

谁在用 thrio?

欢迎留言写下使用 thrio 的情况,这也是对 thrio 的支持。

支持FlutterView级别的使用方式

粗略的看了下代码,貌似thrio目前默认的路由模式是单引擎单Navigator的模式,我目前有这样一个需求,Android和iOS的主页面都是有TabBar的,并且TabBar的4个TabView中,两个是FlutterView,另外两个目前只能保持Native实现,如何满足这类的需求?

cachedEngineId must not be null,是我使用方式有问题吗

Android调ThrioNavigator.push("tab_0")到flutter的activity必须继承ThrioActivity?否则没反应
ThrioActivity extends Activity,为啥不继承AppCompatActivity 如果这样好多地方不能直接使用了
间接跳转ThrioActivity后再push正常
把老项目的activity继承ThrioActivity后onCreate()里push时还有崩溃,是我集成方式不对吗,ThrioModule.init(new ThrioModule(),this,true);我只加了这一句然后就调用了push方法
企业微信截图_16213319187616

ios中类型判断的方式引起问题

- (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

[feat] Flutter端生成代码框架

虽然是混合栈框架,但引入后建议能用 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'

[feat] 增加 FlutterView 支持

官方提供的引擎实例 fork 的能力,为实现 FlutterView 的支持提供了可能,对于嵌入 tab 的场景依赖于 FlutterView ,需提供支持

android example报错

如图,android example报错
image
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

example项目无法正常打包成Android apk

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

thrio/navigator/PageRoutes.kt: (225, 34): Unresolved reference: removeLast

Describe the bug
在 vs code 上面新建 flutter 项目之后,添加 thrio 2.0.11 依赖,然后在 荣耀v10 上面运行报错。

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

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

  • Device: 荣耀v10
  • OS: android 10
  • Version EMUI 10.0.0

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.