Search code examples
fluttersizer

why sizer dealing with padding value as a hight?


I am using sizer library, but i am wondering why padding value is assigned as a height top:5.h instead of weight top:5.w?.

The code in the Sizer documentation is:

 Padding(
      padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 3.h),
      child: Container(),
    );

Solution

  • This looks more logical

    Padding(
          padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 3.w),
          child: Container(),
        );
    

    It creates :
    A vertical padding of 5% of the screen height
    An horizontal padding of 3% of the screen width

    It might be a mistake in the doc, you could suggest an edit on the repo