buildContent method
Implement this in subclasses to build the core content of the tab.
Implementation
@override
Widget buildContent(BuildContext context) {
// 1️⃣ Text-only
if (icon == null && label != null) {
return Text(
label!,
style: textStyle ?? Theme.of(context).textTheme.bodyMedium,
);
}
// 2️⃣ Icon-only
if (label == null && icon != null) {
return Icon(icon, size: iconSize);
}
// 3️⃣ Icon + Label
final children = <Widget>[
if (icon != null) Icon(icon, size: iconSize),
if (label != null)
Text(
label!,
style: textStyle ?? Theme.of(context).textTheme.bodyMedium,
),
];
// Flip order if iconFirst = false
if (!iconFirst && children.length == 2) {
children.insert(0, children.removeAt(1));
}
return vertical
? Column(
mainAxisSize: MainAxisSize.min,
spacing: spacing,
children: children,
)
: Row(
mainAxisSize: MainAxisSize.min,
spacing: spacing,
children: children,
);
}