当前位置:网站首页>In the release version, the random white screen does not display the content after opening the shutter
In the release version, the random white screen does not display the content after opening the shutter
2022-07-04 21:17:00 【SkyCloud5+2】
Using the command line
flutter run --release --verbose
It can be on the simulator , simulation release Running status on , Turn off the app process , There is also a log when you open it again
White screen reason :
Flutter To speed up application startup , Not waiting size assignment , Start rendering the interface .
terms of settlement :
monitor window Change in size , When not empty , Again runApp;runApp Must first WidgetsFlutterBinding.ensureInitialized(), Make sure there are WidgetsFlutterBinding example , Otherwise, the screen will be black
Future<void> main() async {
// If size yes 0, Set callback , In the callback runApp
if(window.physicalSize.isEmpty){
print("window size is zero");
window.onMetricsChanged = (){
// In the callback ,size It could still be 0
if(!window.physicalSize.isEmpty){
window.onMetricsChanged = null;
print("window onMetricsChanged,run app");
runMyApp();
}
};
} else{
// If size Not 0, directly runApp
print("window load success,run app");
runMyApp();
}
}
void runMyApp() async{
print("window: ${window.physicalSize.width} ${window.physicalSize.height}");
// Ensure that the loading is completed , only runApp
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
Use window Need to import dart:ui
import 'dart:ui';
边栏推荐
猜你喜欢
colResizable.js自动调整表格宽度插件
Leetcode+ 81 - 85 monotone stack topic
接口設計時的一些建議
接口设计时的一些建议
仿ps样式js网页涂鸦板插件
In the face of the same complex test task, why can the elder sort out the solution quickly? Ali's ten-year test engineers showed their skills
IIC (STM32)
B站视频 声音很小——解决办法
HWiNFO硬件检测工具v7.26绿色版
网件r7000梅林系统5g不稳定 5g信号经常掉线解决方法
随机推荐
Foxit pdf editor v10.1.8 green version
FastDfs的快速入门,三分钟带你上传下载文件到云服务器
LeetCode 7. Integer inversion
数十亿公民信息遭泄漏!公有云上的数据安全还有“救”吗?
吐槽 B 站收费,是怪它没钱么?
企业数字化转型最佳实践案例:基于云的数字化平台系统安全措施简介与参考
冰河的海报封面
五子棋 上班摸鱼工具 可局域网/人机
软件开发过中的采购
RFID仓储管理系统解决方案的优点
redis RDB AOF
UTF encoding and character set in golang
测试用例 (TC)
Golang中UTF编码和字符集
伦敦银走势图分析的新方法
Huawei simulator ENSP common commands
为什么说不变模式可以提高性能
网件r7000梅林系统虚拟内存创建失败,提示USB磁盘读写速度不满足要求解决办法,有需要创建虚拟内存吗??
嵌入式TC 测试用例
y56.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(二九)