在MIUI13 (Android 12)系统上工具类在Release模式下不可用
cfanboy opened this issue · 1 comments
cfanboy commented
经测,在小米K40 Pro+手机(MIUI 13.0.5, Android 12)上,如使用Release模式运行:flutter run --release
screenWidth, screenHeight, statusBarHeight, bottomBarHeight, appBarHeight等基础属性全为0,间接导致几乎所有方法均返回为0,如getSp
hzysky commented
1.建议使用ScreenUtil.getScreenW(context)
iOS 同样出现这种情况
2.在初始化的时候 延迟获取 screenWidth, screenHeight, statusBarHeight, bottomBarHeight, appBarHeight 然后保存下来