renderTab method
Widget
renderTab(
- ScrollController scrollController,
- Widget? widgetTitle,
- String? title,
- int? maxLineTitle,
- TextStyle? styleTitle,
- EdgeInsets? marginTitle,
- Widget? widgetDescription,
- String? description,
- int? maxLineTextDescription,
- TextStyle? styleDescription,
- EdgeInsets? marginDescription,
- String? pathImage,
- double? widthImage,
- double? heightImage,
- BoxFit? foregroundImageFit,
- Widget? centerWidget,
- Function? onCenterItemPress,
- Color? backgroundColor,
- Color? colorBegin,
- Color? colorEnd,
- AlignmentGeometry? directionColorBegin,
- AlignmentGeometry? directionColorEnd,
- String? backgroundImage,
- BoxFit? backgroundImageFit,
- double? backgroundOpacity,
- Color? backgroundOpacityColor,
- 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,
),
);
}