当前位置:网站首页>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 --verboseIt 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';边栏推荐
猜你喜欢

Explication détaillée du mécanisme de distribution des événements d'entrée multimodes

Huawei ENSP simulator configures DHCP for router

shp数据制作3DTiles白膜

Automatic generation of interface automatic test cases by actual operation

Huawei ENSP simulator configures ACL access control list
![[server data recovery] a case of RAID5 data recovery stored in a brand of server](/img/a2/e03dcb30276d115969fbd00f1830dc.png)
[server data recovery] a case of RAID5 data recovery stored in a brand of server

What are the functional modules of RFID warehouse management system solution

heatmap.js图片热点热力图插件

MySQL - database query - use of aggregate function, aggregate query, grouping query

HWiNFO硬件检测工具v7.26绿色版
随机推荐
Idea plug-in
Advantages of RFID warehouse management system solution
Nmap scan
IIC (STM32)
Huawei ENSP simulator layer 3 switch
为什么说不变模式可以提高性能
ApplicationContext 与 BeanFactory 区别(MS)
redis缓存
2021 CCPC 哈尔滨 I. Power and Zero(二进制 + 思维)
杰理之AD 系列 MIDI 功能说明【篇】
基于OpenCV haarcascades的对象检测
【服务器数据恢复】某品牌服务器存储raid5数据恢复案例
colResizable.js自动调整表格宽度插件
Pytorch---使用Pytorch实现LinkNet进行语义分割
PS vertical English and digital text how to change direction (vertical display)
Google colab踩坑
Browser render page pass
嵌入式TC 测试用例
五子棋 上班摸鱼工具 可局域网/人机
Golang中UTF编码和字符集