helpBuilder<T> method

T helpBuilder<T>({
  1. HelpBuilderCallback<T>? mobileSmall,
  2. HelpBuilderCallback<T>? mobileSmallLandscape,
  3. HelpBuilderCallback<T>? mobileNormal,
  4. HelpBuilderCallback<T>? mobileNormalLandscape,
  5. HelpBuilderCallback<T>? mobileLarge,
  6. HelpBuilderCallback<T>? mobileLargeLandscape,
  7. HelpBuilderCallback<T>? mobileExtraLarge,
  8. HelpBuilderCallback<T>? mobileExtraLargeLandscape,
  9. HelpBuilderCallback<T>? tabletSmall,
  10. HelpBuilderCallback<T>? tabletSmallLandscape,
  11. HelpBuilderCallback<T>? tabletNormal,
  12. HelpBuilderCallback<T>? tabletNormalLandscape,
  13. HelpBuilderCallback<T>? tabletLarge,
  14. HelpBuilderCallback<T>? tabletLargeLandscape,
  15. HelpBuilderCallback<T>? tabletExtraLarge,
  16. HelpBuilderCallback<T>? tabletExtraLargeLandscape,
  17. HelpBuilderCallback<T>? desktopSmall,
  18. HelpBuilderCallback<T>? desktopSmallLandscape,
  19. HelpBuilderCallback<T>? desktopNormal,
  20. HelpBuilderCallback<T>? desktopNormalLandscape,
  21. HelpBuilderCallback<T>? desktopLarge,
  22. HelpBuilderCallback<T>? desktopLargeLandscape,
  23. HelpBuilderCallback<T>? desktopExtraLarge,
  24. HelpBuilderCallback<T>? desktopExtraLargeLandscape,
})

Takes T Function(double width, double height) as a parameter

Implementation

T helpBuilder<T>({
  HelpBuilderCallback<T>? mobileSmall,
  HelpBuilderCallback<T>? mobileSmallLandscape,
  HelpBuilderCallback<T>? mobileNormal,
  HelpBuilderCallback<T>? mobileNormalLandscape,
  HelpBuilderCallback<T>? mobileLarge,
  HelpBuilderCallback<T>? mobileLargeLandscape,
  HelpBuilderCallback<T>? mobileExtraLarge,
  HelpBuilderCallback<T>? mobileExtraLargeLandscape,
  HelpBuilderCallback<T>? tabletSmall,
  HelpBuilderCallback<T>? tabletSmallLandscape,
  HelpBuilderCallback<T>? tabletNormal,
  HelpBuilderCallback<T>? tabletNormalLandscape,
  HelpBuilderCallback<T>? tabletLarge,
  HelpBuilderCallback<T>? tabletLargeLandscape,
  HelpBuilderCallback<T>? tabletExtraLarge,
  HelpBuilderCallback<T>? tabletExtraLargeLandscape,
  HelpBuilderCallback<T>? desktopSmall,
  HelpBuilderCallback<T>? desktopSmallLandscape,
  HelpBuilderCallback<T>? desktopNormal,
  HelpBuilderCallback<T>? desktopNormalLandscape,
  HelpBuilderCallback<T>? desktopLarge,
  HelpBuilderCallback<T>? desktopLargeLandscape,
  HelpBuilderCallback<T>? desktopExtraLarge,
  HelpBuilderCallback<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(_size.width, _size.height, _orientation);
  else
    throw Exception(
        'Screen size not specified or there is no options passed from the parameters [current: `$_current`, orientation: `$_orientation`]');
}