responsiveWidget method
return a responsive widget depending on screen type
Implementation
Widget responsiveWidget(
{required Widget forUnInitialDevices,
Widget? forPortraitMobileScreen,
Widget? forLandscapeMobileScreen,
Widget? forPortraitTabletScreen,
Widget? forLandscapeTabletScreen,
Widget? forDesktopScreen,
Widget? forTVScreen}) {
if (_responsiveHandler._screenType == ScreenType.phone)
return (_responsiveHandler._deviceInfo.orientation == Orientation.portrait
? forPortraitMobileScreen
: forLandscapeMobileScreen) ??
forUnInitialDevices;
else if (_responsiveHandler._screenType == ScreenType.tabletOrIpad)
return (_responsiveHandler._deviceInfo.orientation == Orientation.portrait
? forPortraitTabletScreen
: forLandscapeTabletScreen) ??
forUnInitialDevices;
else if (_responsiveHandler._screenType == ScreenType.desktop ||
_responsiveHandler._screenType == ScreenType.website)
return forDesktopScreen ?? forUnInitialDevices;
else
return forTVScreen ?? forUnInitialDevices;
}