当前位置:网站首页>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';
边栏推荐
- Gobang go to work fishing tools can be LAN / man-machine
- Pytorch---使用Pytorch实现LinkNet进行语义分割
- 【观察】联想:3X(1+N)智慧办公解决方案,释放办公生产力“乘数效应”
- 偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
- 多模輸入事件分發機制詳解
- Actual combat simulation │ JWT login authentication
- admas零件名重复
- Huawei ENSP simulator enables devices of multiple routers to access each other
- Hwinfo hardware detection tool v7.26 green version
- 实战模拟│JWT 登录认证
猜你喜欢
福昕PDF编辑器v10.1.8绿色版
ApplicationContext 与 BeanFactory 区别(MS)
华为ensp模拟器 DNS服务器的配置
NetWare r7000 Merlin system virtual memory creation failed, prompting that the USB disk reading and writing speed does not meet the requirements. Solution, is it necessary to create virtual memory??
Introduction to pressure measurement of JMeter
杰理之AD 系列 MIDI 功能说明【篇】
Hwinfo hardware detection tool v7.26 green version
The concept and application of hash table
uniapp 富文本编辑器使用
华为ensp模拟器 三层交换机
随机推荐
多模输入事件分发机制详解
The concept and application of hash table
插入排序,选择排序,冒泡排序
From automation to digital twins, what can Tupo do?
Solution of 5g unstable 5g signal often dropped in NetWare r7000 Merlin system
Hands on deep learning (III) -- convolutional neural network CNN
Why is TCP three handshakes and four waves
VIM asynchronous problem
IIC (STM32)
TweenMax表情按钮js特效
Redis:Redis配置文件相关配置、Redis的持久化
杰理之AD 系列 MIDI 功能说明【篇】
B站视频 声音很小——解决办法
uniapp 富文本编辑器使用
Poster cover of glacier
RFID仓库管理系统解决方案有哪些功能模块
【服务器数据恢复】某品牌服务器存储raid5数据恢复案例
LeetCode 7. 整数反转
acwing 3302. 表达式求值
测试员的算法面试题-找众数