getTabByIndexWedget method

dynamic getTabByIndexWedget(
  1. int index,
  2. dynamic tabName,
  3. dynamic context
)

Implementation

getTabByIndexWedget(int index, tabName, context) {
  myLogAll('getTabByIndexWedget');
  List<Widget> titleWidgets = [];
  var dataThis = _tabList[tabName][gData][index];
  if (!(dataThis[gVisible] ?? true)) {
    return null;
  }

  titleWidgets.add(Text(getSCurrent(dataThis[gLabel]),
      style: TextStyle(
          fontSize:
              getFontSize(_tabList[tabName]) ?? (_defaultFontSize + 5.0),
          fontWeight: index == _tabList[tabName][gTabIndex]
              ? FontWeight.bold
              : FontWeight.normal,
          color: index == _tabList[tabName][gTabIndex]
              ? fromBdckcolor(_defaultBackGroundColor)
              : Colors.black)));
  if ((dataThis[gCanRefresh] ?? "true") != "false") {
    titleWidgets.add(MyIcon({
      gValue: 0xf2f7,
      gLabel: gRefresh,
      gColor: Colors.green,
      gAction: gLocalAction,
      gTabIndex: index,
      gTabName: tabName
    }));
  }
  if ((dataThis[gCanClose] ?? "true") != "false") {
    titleWidgets.add(MyIcon({
      gValue: 63467,
      gLabel: gRemove,
      gColor: Colors.green,
      gAction: gLocalAction,
      gTabIndex: index,
      gTabName: tabName
    }));
  }

  return GestureDetector(
    onTap: () {
      _tabList[tabName][gTabIndex] = index;
      clearMFocusNode(context);
      //_tabIndex = index;
      myNotifyListeners();
    },
    child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: titleWidgets,
            ),
            Container(
              margin: const EdgeInsets.only(top: 20.0 / 4),
              height: 2.0,
              width: 30.0,
              color: index == _tabList[tabName][gTabIndex]
                  ? Colors.black
                  : Colors.transparent,
            ),
          ],
        )),
  );
}