Code Monkey home page Code Monkey logo

Comments (9)

lizhuoyuan avatar lizhuoyuan commented on July 2, 2024

看一下具体代码?

from flutter_screenutil.

qyfeng009 avatar qyfeng009 commented on July 2, 2024

main.dart
home.dart
login.dart

我是在 home 页面中完成注册的,在login中使用ScreenUtil.screenWidth 获取设备屏款,在开发模式和debug模式是可以正常获取屏宽的,只是在打包release版本后在手机上运行获取的值是0

from flutter_screenutil.

qyfeng009 avatar qyfeng009 commented on July 2, 2024

感觉像是 init 方法没有执行

from flutter_screenutil.

lizhuoyuan avatar lizhuoyuan commented on July 2, 2024

不要在initstate里面使用
因为这个时候 context还无法使用
获取屏幕数据依赖context

from flutter_screenutil.

qyfeng009 avatar qyfeng009 commented on July 2, 2024

D494DB58-E194-4A2A-9E60-D87CDD3A464E
刚才我试一下 在build 中使用 ScreenUtil.screenWidth ,可以获取的值还是 0.0,这个问题只在release版本中出现

from flutter_screenutil.

lizhuoyuan avatar lizhuoyuan commented on July 2, 2024

我一会试一下

from flutter_screenutil.

qyfeng009 avatar qyfeng009 commented on July 2, 2024

我在 login 中也注册一遍,测试发现可以获取正常的值。产生我这个问题的原因应该和我的main.dart中的页面管理代码有关,不好意思应该是我的问题,谢谢了

from flutter_screenutil.

lizhuoyuan avatar lizhuoyuan commented on July 2, 2024

找到原因就好

from flutter_screenutil.

luckysmg avatar luckysmg commented on July 2, 2024

能说一下这个页面管理具体是什么问题么,我也遇到这个问题

from flutter_screenutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.