alibaba / flutter_boost

FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts
https://github.com/alibaba/flutter_boost
MIT License
6.97k stars 1.23k forks source link

【Android】原生跳转flutter页面时,黑屏问题 #1831

Closed XiYoung777 closed 5 months ago

XiYoung777 commented 1 year ago

Steps to Reproduce

点击跳转flutter页面

问题出现在视频第2秒,必现

视频地址: https://xingyunos.oss-cn-hangzhou.aliyuncs.com/tmp/android%E5%8E%9F%E7%94%9F%E8%B7%B3flutter%E9%BB%91%E5%B1%8F.mp4 demo下载: https://xingyunos.oss-cn-hangzhou.aliyuncs.com/tmp/FlutterBoosterDemo.zip

Flutter Boost Version 4.2.0 Target Platform: Android Target OS version/browser: HarmonyOS 3.0.0 Devices: HUAWEI P50

Logs

[✓] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.7.3 on channel stable at /Users/wangsheng/Library/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9944297138 (3 months ago), 2023-02-08 15:46:04 -0800 • Engine revision 248290d6d5 • Dart version 2.19.2 • DevTools version 2.20.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/wangsheng/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = /Users/wangsheng/Library/Android/sdk • Java binary at: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java • Java version Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) • All Android licenses accepted.

[✗] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS development. Download at: https://developer.apple.com/xcode/download/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2022.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart ✗ Unable to find bundled Java version. • Try updating or re-installing Android Studio.

[✓] Connected device (3 available) • ABR AL80 (mobile) • NQS0222C16000024 • android-arm64 • Android 12 (API 31) • macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability • All required HTTP hosts are available

XiYoung777 commented 1 year ago

@0xZOne @joechan-cq 还请帮忙看下,谢谢啦

joechan-cq commented 1 year ago

FlutterBoostActivity的theme并不是透明的,你使用透明模式启动就会黑屏。如果要使用透明模式,请参考example中的TransparencyPageActivity,新建透明theme:

    <style name="TranTheme.Translucente" parent="android:style/Theme.Translucent">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>
XiYoung777 commented 1 year ago

FlutterBoostActivity的theme并不是透明的,你使用透明模式启动就会黑屏。如果要使用透明模式,请参考example中的TransparencyPageActivity,新建透明theme:

    <style name="TranTheme.Translucente" parent="android:style/Theme.Translucent">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>

好的,我这边调整试下