Reputation: 1
I have a question about using flutter_screenutil package.
The package has two methods for setting width
and height
.
ScreenUtil().setWidth(540)
or ScreenUtil().setHeight(540)
540.w
or 540.h
I am confused about which method should I use?
Upvotes: 0
Views: 367
Reputation: 51
you can use any one method , both methods will give you same result
Container(
width: ScreenUtil().setWidth(540),
height:ScreenUtil().setHeight(540),
)
Container(
width: 540.w,
height:540.h,
)
Upvotes: 0
Reputation: 398
If your dart sdk>=2.6, you can use extension functions:
example:
instead of :
Container(
width: ScreenUtil().setWidth(50),
height:ScreenUtil().setHeight(200),
)
you can use it like this:
Container(
width: 50.w,
height:200.h
)
Upvotes: 1