OpenFlutter / flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
https://pub.dartlang.org/packages/flutter_screenutil
Apache License 2.0
3.88k stars 494 forks source link

After removing allowFontScalingSelf parameter used in old project everything looks big #408

Closed onguc closed 2 years ago

onguc commented 2 years ago

I bought a previously written project. However, in the version used in the project, the allowFontScalingSelf parameter has been removed in new versions. When I removed this parameter, the text and icons started to appear too big. Any ideas on solving this?

Previous Icon Size:

previous_icon_size

New Icon Size:

new_icon_size

Thanks in advance

onguc commented 2 years ago

I found the reason. Dimensions may be calculated differently in the old version and different in the new version. I fixed the problem by giving designSize the physical size of the device as below:


Widget build(BuildContext context) { 
    var physicalScreenSize = window.physicalSize;
    var physicalWidth = physicalScreenSize.width;
    var physicalHeight = physicalScreenSize.height;
    return ScreenUtilInit(
        designSize: Size(physicalWidth, physicalHeight),
       ...
  }