render method

  1. @override
Widget render(
  1. BuildContext context,
  2. AntdTabBarStyle style
)
override

Implementation

@override
Widget render(BuildContext context, AntdTabBarStyle style) {
  var childList = <Widget>[];
  for (int i = 0; i < items.length; i++) {
    var item = items[i];
    var active = activeIndex == i;
    var child = AntdBox(
      style: style.itemStyle,
      options: const AntdTapOptions(
          behavior: HitTestBehavior.opaque, alwaysTriggerTap: true),
      onTap: item.builder != null
          ? null
          : () {
              onChange?.call(i);
            },
      child: AntdColumn(
        style: style.itemColumnStyle,
        children: [
          if (item.icon != null)
            AntdIconWrap(
                style: active ? style.activeIconStyle : style.iconStyle,
                child: active ? (item.activeIcon ?? item.icon) : item.icon),
          if (item.title != null)
            AntdBox(
              style: active ? style.activeTitleStyle : style.titleStyle,
              child: item.title,
            ),
        ],
      ),
    );
    childList.add(Expanded(
        child: item.builder != null
            ? item.builder!.call(child, i, active)
            : child));
  }
  return AntdBox(
    style: style.bodyStyle,
    innerSafeArea: safeArea,
    child: Row(
      mainAxisSize: MainAxisSize.min,
      children: childList,
    ),
  );
}