help<T> method
T
help<T>({
- T? mobileSmall,
- T? mobileSmallLandscape,
- T? mobileNormal,
- T? mobileNormalLandscape,
- T? mobileLarge,
- T? mobileLargeLandscape,
- T? mobileExtraLarge,
- T? mobileExtraLargeLandscape,
- T? tabletSmall,
- T? tabletSmallLandscape,
- T? tabletNormal,
- T? tabletNormalLandscape,
- T? tabletLarge,
- T? tabletLargeLandscape,
- T? tabletExtraLarge,
- T? tabletExtraLargeLandscape,
- T? desktopSmall,
- T? desktopSmallLandscape,
- T? desktopNormal,
- T? desktopNormalLandscape,
- T? desktopLarge,
- T? desktopLargeLandscape,
- T? desktopExtraLarge,
- T? desktopExtraLargeLandscape,
Implementation
T help<T>({
T? mobileSmall,
T? mobileSmallLandscape,
T? mobileNormal,
T? mobileNormalLandscape,
T? mobileLarge,
T? mobileLargeLandscape,
T? mobileExtraLarge,
T? mobileExtraLargeLandscape,
T? tabletSmall,
T? tabletSmallLandscape,
T? tabletNormal,
T? tabletNormalLandscape,
T? tabletLarge,
T? tabletLargeLandscape,
T? tabletExtraLarge,
T? tabletExtraLargeLandscape,
T? desktopSmall,
T? desktopSmallLandscape,
T? desktopNormal,
T? desktopNormalLandscape,
T? desktopLarge,
T? desktopLargeLandscape,
T? desktopExtraLarge,
T? desktopExtraLargeLandscape,
}) {
final isPortrait = _orientation == Orientation.portrait;
if (_printScreenInfo) _printCurrentScreenInfo(_current, _size, isPortrait);
final portraitNodesList = [
if (mobileSmall != null) Node(BreakPoint.mobileSmall, mobileSmall),
if (mobileNormal != null) Node(BreakPoint.mobileNormal, mobileNormal),
if (mobileLarge != null) Node(BreakPoint.mobileLarge, mobileLarge),
if (mobileExtraLarge != null)
Node(BreakPoint.mobileExtraLarge, mobileExtraLarge),
if (tabletSmall != null) Node(BreakPoint.tabletSmall, tabletSmall),
if (tabletNormal != null) Node(BreakPoint.tabletNormal, tabletNormal),
if (tabletLarge != null) Node(BreakPoint.tabletLarge, tabletLarge),
if (tabletExtraLarge != null)
Node(BreakPoint.tabletExtraLarge, tabletExtraLarge),
if (desktopSmall != null) Node(BreakPoint.desktopSmall, desktopSmall),
if (desktopNormal != null) Node(BreakPoint.desktopNormal, desktopNormal),
if (desktopLarge != null) Node(BreakPoint.desktopLarge, desktopLarge),
if (desktopExtraLarge != null)
Node(BreakPoint.desktopExtraLarge, desktopExtraLarge),
];
final landscapeNodesList = [
if (mobileSmallLandscape != null)
Node(BreakPoint.mobileSmall, mobileSmallLandscape),
if (mobileNormalLandscape != null)
Node(BreakPoint.mobileNormal, mobileNormalLandscape),
if (mobileLargeLandscape != null)
Node(BreakPoint.mobileLarge, mobileLargeLandscape),
if (mobileExtraLargeLandscape != null)
Node(BreakPoint.mobileExtraLarge, mobileExtraLargeLandscape),
if (tabletSmallLandscape != null)
Node(BreakPoint.tabletSmall, tabletSmallLandscape),
if (tabletNormalLandscape != null)
Node(BreakPoint.tabletNormal, tabletNormalLandscape),
if (tabletLargeLandscape != null)
Node(BreakPoint.tabletLarge, tabletLargeLandscape),
if (tabletExtraLargeLandscape != null)
Node(BreakPoint.tabletExtraLarge, tabletExtraLargeLandscape),
if (desktopSmallLandscape != null)
Node(BreakPoint.desktopSmall, desktopSmallLandscape),
if (desktopNormalLandscape != null)
Node(BreakPoint.desktopNormal, desktopNormalLandscape),
if (desktopLargeLandscape != null)
Node(BreakPoint.desktopLarge, desktopLargeLandscape),
if (desktopExtraLargeLandscape != null)
Node(BreakPoint.desktopExtraLarge, desktopExtraLargeLandscape),
];
final closestNode = _findClosestNode(
_current,
isPortrait,
portraitNodesList,
landscapeNodesList,
);
if (closestNode != null)
return closestNode.value!;
else
throw Exception(
'Screen size not specified or there is no options passed from the parameters [current: `$_current`, orientation: `$_orientation`]');
}