当前位置:网站首页>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';
边栏推荐
- Huawei ENSP simulator configures ACL access control list
- Render function and virtual DOM
- Foxit pdf editor v10.1.8 green version
- MySQL - database query - use of aggregate function, aggregate query, grouping query
- 杰理之增加进关机前把触摸模块关闭流程【篇】
- Y56. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (29)
- 杰理之AD 系列 MIDI 功能说明【篇】
- 软件开发过中的采购
- 多模輸入事件分發機制詳解
- 仿ps样式js网页涂鸦板插件
猜你喜欢
随机推荐
实战模拟│JWT 登录认证
基于OpenCV haarcascades的对象检测
杰理之AD 系列 MIDI 功能说明【篇】
杰理之AD 系列 MIDI 功能说明【篇】
杰理之AD 系列 MIDI 功能说明【篇】
华为ensp模拟器 给路由器配置DHCP
Sword finger offer II 80-100 (continuous update)
JS closure
The concept and application of hash table
偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
Huawei ENSP simulator layer 3 switch
哈希表、哈希函数、布隆过滤器、一致性哈希
Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)
Idea configuration standard notes
redis事务
Pytorch---使用Pytorch实现LinkNet进行语义分割
Browser render page pass
LeetCode+ 81 - 85 单调栈专题
redis RDB AOF
【微服务|SCG】Predicate的使用