当前位置:网站首页>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';
边栏推荐
猜你喜欢
华为ensp模拟器 配置ACL访问控制列表
Redis:Redis配置文件相关配置、Redis的持久化
伦敦银走势图分析的新方法
搭建一个仪式感点满的网站,并内网穿透发布到公网 1/2
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
admas零件名重复
maya灯建模
PS竖排英文和数字文字怎么改变方向(变竖直显示)
Idea restore default shortcut key
Huawei ENSP simulator configures ACL access control list
随机推荐
colResizable.js自动调整表格宽度插件
Actual combat simulation │ JWT login authentication
【1200. 最小絕對差】
ApplicationContext 与 BeanFactory 区别(MS)
Idea configuration standard notes
Hands on deep learning (III) -- convolutional neural network CNN
MySQL statement execution details
实战模拟│JWT 登录认证
Routing configuration and connectivity test of Huawei simulator ENSP
Render function and virtual DOM
【optimtool.unconstrain】无约束优化工具箱
shp数据制作3DTiles白膜
网络命名空间
acwing 3302. Expression evaluation
【服务器数据恢复】某品牌服务器存储raid5数据恢复案例
RFID仓储管理系统解决方案的优点
华为模拟器ensp的路由配置以及连通测试
IIC (STM32)
Go language notes (2) some simple applications of go
Poster cover of glacier