Flutter插件拉起的Dialog Activity在息屏亮屏后背景色黑屏

653 阅读1分钟

创建一个简单的flutter plugin工程,在android native侧startActivity方式拉起一个Activity,给该Activity配置DialogTheme,这样它看起来就是一个对话框,背景是flutter demo的界面,半透明效果。这时息屏,再亮屏,发现flutter demo的界面黑掉了。查看flutter的生命周期回调,发现flutter app处于paused状态,这是flutter的bug吗?

AppLifecycleState --> AppLifecycleState.resumed

拉起Dialog Activity后: AppLifecycleState --> AppLifecycleState.inactive

息屏后: AppLifecycleState --> AppLifecycleState.paused

亮屏后没有回到inactive状态

Screenshot_20211213_152042_com.example.hello2.hello2_example[1].jpg

Screenshot_20211213_152057_com.example.hello2.hello2_example[1].jpg