buildTabView method
Implementation
@protected
Widget buildTabView(BuildParameters params) {
var children = <Widget>[];
if (params.widgets["children"] != null) {
for (Map childSpec in params.widgets["children"] as List<Map>) {
children.add(builder.buildWidget(
params.context, childSpec, params.state, params.parentContext));
}
}
var tabs = <Widget>[];
if (params.widgets["tabs"] != null) {
for (Map childSpec in params.widgets["tabs"] as List<Map>) {
tabs.add(builder.buildWidget(
params.context, childSpec, params.state, params.parentContext));
}
}
final overlayColor = tryParseColor(params.props["overlayColor"]);
return DefaultTabController(
key: properties.getKey(params.id),
length: min(children.length, tabs.length),
initialIndex: parseInt(params.props["initialIndex"]),
child: Column(
key: properties.getKey("${params.id}_tabs"),
mainAxisSize: params.props["mainAxisSize"] == "min"
? MainAxisSize.min
: MainAxisSize.max,
mainAxisAlignment: params.buildProp("mainAxisAlignment"),
crossAxisAlignment: params.buildProp("crossAxisAlignment"),
verticalDirection: params.buildProp("verticalDirection"),
children: [
TabBar(
tabs: tabs,
padding: params.buildProp("padding"),
indicator: params.buildProp("indicator"),
indicatorColor: tryParseColor(params.props["indicatorColor"]),
indicatorPadding:
params.buildProp("indicatorPadding") ?? EdgeInsets.zero,
indicatorSize: params.buildProp("indicatorSize"),
indicatorWeight:
parseDouble(params.props["indicatorWeight"], defaultValue: 2.0),
isScrollable: parseBool(params.props["isScrollable"]),
labelColor: tryParseColor(params.props["labelColor"]),
labelPadding: params.buildProp("labelPadding"),
labelStyle: params.buildProp("labelStyle"),
unselectedLabelColor:
tryParseColor(params.props["unselectedLabelColor"]),
unselectedLabelStyle: params.buildProp("unselectedLabelStyle"),
dividerColor: tryParseColor(params.props["dividerColor"]),
dividerHeight: tryParseDouble(params.props["dividerHeight"]),
overlayColor: overlayColor != null
? MaterialStatePropertyAll<Color>(overlayColor)
: null,
),
Expanded(
child: TabBarView(
key: properties.getKey("${params.id}_tabViews"),
children: children,
)),
],
),
);
}