CoderUni / responsive_sizer

Responsive Sizer helps implement are responsive layout by providing helper widgets and extensions

Home Page:https://pub.dev/packages/responsive_sizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why 100.sp != (50.sp)*2

q876625596 opened this issue · comments

I set the width to 50.sp and then to 100.sp and found that they are not 2x

Hi @q876625596 , 50.sp * 2 is not equal to 100.sp because of the way .sp is calculated:

  double get sp =>
      this * ((Device height + Device width) + Device pixelRatio * Device aspectRatio) / 2.08) / 100;
        ^<----------------------------------------
        |                                        |
  The this here is the number (50.sp will make this = 50)

I hope this clarifies your question :)