resolveValue<T> method
T
resolveValue<T>({
- required T defValue,
- T? defLandscape,
- T? phone,
- T? phoneLandscape,
- T? tablet,
- T? tabletLandscape,
- T? desktop,
- T? largeDesktop,
- T? watch,
Implementation
T resolveValue<T>({
required T defValue,
T? defLandscape,
T? phone,
T? phoneLandscape,
T? tablet,
T? tabletLandscape,
T? desktop,
T? largeDesktop,
T? watch,
}) {
T? orientationValue(T? portraitValue, T? landscapeValue) {
switch (orientation) {
case Orientation.landscape:
return landscapeValue ?? portraitValue;
case Orientation.portrait:
return portraitValue;
}
}
T? value;
switch (screenType) {
case ResponsiveScreenType.desktop:
value = orientationValue(desktop, largeDesktop) ??
orientationValue(tablet, tabletLandscape);
break;
case ResponsiveScreenType.tablet:
value = orientationValue(tablet, tabletLandscape);
break;
case ResponsiveScreenType.phone:
value = orientationValue(phone, phoneLandscape);
break;
case ResponsiveScreenType.watch:
value = watch;
break;
}
return value ?? orientationValue(defValue, defLandscape) ?? defValue;
}