rowTabs method

Widget rowTabs(
  1. List<TabData> tabs,
  2. dynamic onTabChangedListener(
    1. int position,
    2. String title,
    3. Color? tabColor
    )
)

Implementation

Widget rowTabs(
  List<TabData> tabs,
  Function(int position, String title, Color? tabColor) onTabChangedListener,
) {
  return SafeArea(
    child: Row(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: tabs
          .map(
            (t) => TabItem(
              key: t.key,
              tabStyle: tabStyle,
              selected: t.key == tabs[currentSelected].key,
              iconData: t.iconData,
              title: t.title,
              iconColor: inactiveIconColor ?? Colors.black,
              textColor: textColor ?? Colors.black,
              backGroundGradientColor: t.tabGradient,
              tabColor: t.tabColor ?? inactiveIconColor ?? Colors.black,
              borderRadius: t.borderRadius,
              callbackFunction: (uniqueKey) {
                int selected = tabs.indexWhere((tabData) =>
                    tabData.key.toString() == uniqueKey.toString());
                _setSelected(uniqueKey);
                _initAnimationAndStart(_circleAlignX, 1);
                onTabChangedListener(
                    selected, t.title, inactiveIconColor ?? Colors.black);
              },
            ),
          )
          .toList(),
    ),
  );
}