-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure to initialize ScreenUtil before accessing it #196
Comments
Maybe you should rerun |
You can put |
不知道什么原因,直接使用 如果自己包装的话,就不会
我很困惑。 |
Same problem here. ════════ Exception caught by widgets library ═══════════════════════════════════ The offending widget is: LayoutBuilder To return an empty space that causes the building widget to fill available room, return "Container()". To return an empty space that takes as little room as possible, return "Container(width: 0.0, height: 0.0)". When the exception was thrown, this was the stack |
@jasonlaw ok, I know, thank you |
@lizhuoyuan |
这个应该是flutter对Build Widget更换了处理时机,建议去Flutter 提交一个issue |
I've also met that after packing, some devices will be directly grayed out when they load slowly |
It seems I need to study this issue carefully |
please try 4.0.3 |
我也遇到的同样的问题,没解决 |
原因很简单,ScreenUtilInit里的child是传过来的参数,相当于提前build好的child widget,把这个提前build好的widget放到LayoutBuilder里的效果可想而知 如果你自己在外面放一个LayoutBuilder,然后把child widget放到builder里当然就不会出现child widegt的尺寸没有初始化的问题 所以这个问题的解决方法也很简单,就是把传过来的child widget换成builder |
Hi all,
I am trying to implement flutter_screenutil like this in my project
`Widget build(BuildContext context) {
Bu when I restart the app in debug mode I got this error.
Ensure to initialize ScreenUtil before accessing it. Please execute the init method : ScreenUtil.init() 'package:flutter_screenutil/screenutil.dart': Failed assertion: line 33 pos 7: '_instance != null'
Bu when I Hot Reload the app the error is not showing.
I am using the version 4.0.2+3
Flutter version: 1.22.5
I attached a video about the error.
Thanks.
aa.mov
The text was updated successfully, but these errors were encountered: