renderTab method

Widget renderTab(
  1. ScrollController scrollController,
  2. Widget? widgetTitle,
  3. String? title,
  4. int? maxLineTitle,
  5. TextStyle? styleTitle,
  6. EdgeInsets? marginTitle,
  7. Widget? widgetDescription,
  8. String? description,
  9. int? maxLineTextDescription,
  10. TextStyle? styleDescription,
  11. EdgeInsets? marginDescription,
  12. String? pathImage,
  13. double? widthImage,
  14. double? heightImage,
  15. BoxFit? foregroundImageFit,
  16. Widget? centerWidget,
  17. Function? onCenterItemPress,
  18. Color? backgroundColor,
  19. Color? colorBegin,
  20. Color? colorEnd,
  21. AlignmentGeometry? directionColorBegin,
  22. AlignmentGeometry? directionColorEnd,
  23. String? backgroundImage,
  24. BoxFit? backgroundImageFit,
  25. double? backgroundOpacity,
  26. Color? backgroundOpacityColor,
  27. BlendMode? backgroundBlendMode,
)

Implementation

Widget renderTab(
  ScrollController scrollController,

  // Title
  Widget? widgetTitle,
  String? title,
  int? maxLineTitle,
  TextStyle? styleTitle,
  EdgeInsets? marginTitle,

  // Description
  Widget? widgetDescription,
  String? description,
  int? maxLineTextDescription,
  TextStyle? styleDescription,
  EdgeInsets? marginDescription,

  // Image
  String? pathImage,
  double? widthImage,
  double? heightImage,
  BoxFit? foregroundImageFit,

  // Center Widget
  Widget? centerWidget,
  Function? onCenterItemPress,

  // Background color
  Color? backgroundColor,
  Color? colorBegin,
  Color? colorEnd,
  AlignmentGeometry? directionColorBegin,
  AlignmentGeometry? directionColorEnd,

  // Background image
  String? backgroundImage,
  BoxFit? backgroundImageFit,
  double? backgroundOpacity,
  Color? backgroundOpacityColor,
  BlendMode? backgroundBlendMode,
) {
  final listView = ListView(
    controller: scrollController,
    children: <Widget>[
      Container(
        // Title
        margin: marginTitle ??
            const EdgeInsets.only(
                top: 70.0, bottom: 50.0, left: 20.0, right: 20.0),
        child: widgetTitle ??
            Text(
              title ?? '',
              style: styleTitle ??
                  const TextStyle(
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                    fontSize: 30.0,
                  ),
              maxLines: maxLineTitle ?? 1,
              textAlign: TextAlign.center,
              overflow: TextOverflow.ellipsis,
            ),
      ),

      // Image or Center widget
      GestureDetector(
        onTap: onCenterItemPress as void Function()?,
        child: pathImage != null
            ? Image.asset(
                pathImage,
                width: widthImage ?? 200.0,
                height: heightImage ?? 200.0,
                fit: foregroundImageFit ?? BoxFit.contain,
              )
            : Center(child: centerWidget ?? Container()),
      ),

      // Description
      Container(
        margin: marginDescription ??
            const EdgeInsets.fromLTRB(20.0, 50.0, 20.0, 50.0),
        child: widgetDescription ??
            Text(
              description ?? '',
              style: styleDescription ??
                  const TextStyle(color: Colors.white, fontSize: 18.0),
              textAlign: TextAlign.center,
              maxLines: maxLineTextDescription ?? 100,
              overflow: TextOverflow.ellipsis,
            ),
      ),
    ],
  );
  return Container(
    width: double.infinity,
    height: double.infinity,
    decoration: backgroundImage != null
        ? BoxDecoration(
            image: DecorationImage(
              image: AssetImage(backgroundImage),
              fit: backgroundImageFit ?? BoxFit.cover,
              colorFilter: ColorFilter.mode(
                backgroundOpacityColor != null
                    ? backgroundOpacityColor
                        .withOpacity(backgroundOpacity ?? 0.5)
                    : Colors.black.withOpacity(backgroundOpacity ?? 0.5),
                backgroundBlendMode ?? BlendMode.darken,
              ),
            ),
          )
        : BoxDecoration(
            gradient: LinearGradient(
              colors: backgroundColor != null
                  ? [backgroundColor, backgroundColor]
                  : [
                      colorBegin ?? Colors.amberAccent,
                      colorEnd ?? Colors.amberAccent
                    ],
              begin: directionColorBegin ?? Alignment.topLeft,
              end: directionColorEnd ?? Alignment.bottomRight,
            ),
          ),
    child: Container(
      margin: const EdgeInsets.only(bottom: 60.0),
      child: verticalScrollbarBehavior != scrollbarBehavior.HIDE
          ? Platform.isIOS
              ? CupertinoScrollbar(
                  controller: scrollController,
                  isAlwaysShown: verticalScrollbarBehavior ==
                      scrollbarBehavior.SHOW_ALWAYS,
                  child: listView,
                )
              : Scrollbar(
                  controller: scrollController,
                  isAlwaysShown: verticalScrollbarBehavior ==
                      scrollbarBehavior.SHOW_ALWAYS,
                  child: listView,
                )
          : listView,
    ),
  );
}