fillWidgetByDataList method

List<Widget> fillWidgetByDataList(
  1. bool isScrollable
)

Implementation

List<Widget> fillWidgetByDataList(bool isScrollable) {
  List<Widget> widgets = <Widget>[];
  List<BadgeTab>? tabList = widget.tabs;
  if (tabList != null && tabList.isNotEmpty) {
    double? minWidth;
    if (widget.tabWidth != null) {
      minWidth = widget.tabWidth;
    } else {
      double tabUseWidth = widget.showMore
          ? MediaQuery.of(context).size.width - _moreSpacing
          : MediaQuery.of(context).size.width;
      if (tabList.length <= _scrollableLimitTabLength) {
        minWidth = tabUseWidth / tabList.length;
      } else {
        minWidth = tabUseWidth / 4.5;
      }
    }
    for (int i = 0; i < tabList.length; i++) {
      BadgeTab badgeTab = tabList[i];
      if (widget.mode == BrnTabBarBadgeMode.average) {
        widgets.add(
            _wrapAverageWidget(badgeTab, minWidth, i == tabList.length - 1));
      } else {
        widgets.add(_wrapOriginWidget(
            badgeTab, i == tabList.length - 1, isScrollable));
      }
    }
  }
  return widgets;
}