uiTabView method
- required List<
CTabItem> tabItems, - Key? key,
- bool automaticIndicatorColorAdjustment = true,
- Color? backgroundColor,
- Clip clipBehavior = Clip.hardEdge,
- double? height,
- EdgeInsetsGeometry? iconMargin,
- double indicatorWeight = 2.0,
- bool isScrollable = false,
- void onTap()?,
- TabBarTheme? style,
- double viewportFraction = 1.0,
Constructs a tab view of content to allow for users to switch between widgets of data.
Implementation
Widget uiTabView({
required List<CTabItem> tabItems,
Key? key,
bool automaticIndicatorColorAdjustment = true,
Color? backgroundColor,
Clip clipBehavior = Clip.hardEdge,
double? height,
EdgeInsetsGeometry? iconMargin,
double indicatorWeight = 2.0,
bool isScrollable = false,
void Function(int)? onTap,
TabBarTheme? style,
double viewportFraction = 1.0,
}) {
// Parse the tabItems to construct the tab data.
var tabs = <Widget>[];
var contentList = <Widget>[];
for (var w in tabItems) {
tabs.add(
Tab(
key: key,
icon: w.icon is IconData ? Icon(w.icon) : w.icon,
iconMargin: iconMargin,
height: height,
text: w.title,
),
);
contentList.add(w.content);
}
// Go build the tabbed view based on that data and other configuration
// items
return DefaultTabController(
length: tabItems.length,
child: Scaffold(
appBar: AppBar(
backgroundColor: backgroundColor,
toolbarHeight: height ?? 50.0,
bottom: PreferredSize(
preferredSize: Size.zero,
child: SizedBox(
height: height ?? 50.0,
child: TabBar(
automaticIndicatorColorAdjustment:
automaticIndicatorColorAdjustment,
dividerColor: style?.dividerColor,
dividerHeight: style?.dividerHeight,
indicator: style?.indicator,
indicatorColor: style?.indicatorColor,
indicatorSize: style?.indicatorSize,
indicatorWeight: indicatorWeight,
labelColor: style?.labelColor,
labelPadding: style?.labelPadding,
labelStyle: style?.labelStyle,
isScrollable: isScrollable,
onTap: onTap,
overlayColor: style?.overlayColor,
padding: EdgeInsets.zero,
tabAlignment: style?.tabAlignment,
unselectedLabelColor: style?.unselectedLabelColor,
unselectedLabelStyle: style?.unselectedLabelStyle,
tabs: tabs,
),
),
),
),
body: TabBarView(
clipBehavior: clipBehavior,
viewportFraction: viewportFraction,
children: contentList,
),
),
);
}