aw property
double
get
aw
Calculates adaptive width based on the screen width and design width values.
This method interpolates between a small screen value and a large screen value based on the current screen width. It returns a width that scales proportionally between the minimum and maximum design widths.
Implementation
double get aw {
double smallScreenValue = item1.toDouble();
double largeScreenValue = item2.toDouble();
double minWidth = ScreenAdaptiveConfig.instance!.designMinWidth;
double maxWidth = ScreenAdaptiveConfig.instance!.designMaxWidth;
if (ScreenAdaptiveConfig.instance!.screenWidth < minWidth) {
return smallScreenValue;
} else if (ScreenAdaptiveConfig.instance!.screenWidth > maxWidth) {
return largeScreenValue;
} else {
return smallScreenValue +
(largeScreenValue - smallScreenValue) *
(ScreenAdaptiveConfig.instance!.screenWidth - minWidth) /
(maxWidth - minWidth);
}
}