pushTab method

void pushTab(
  1. TabSwitcherTab tab, {
  2. int index = 0,
  3. bool foreground = true,
})

Implementation

void pushTab(TabSwitcherTab tab, {int index = 0, bool foreground = true}) {
  //if (_tabs.isEmpty) {
  //  foreground = true;
  //}

  _tabs.add(tab);
  tab._index = _tabs.length - 1;

  if (foreground) {
    _currentTab?.onSave(_currentTab!._state);
    _currentTab = tab;
    if (_switcherActive == true) {
      _switcherActive = false;
      _switchModeSubject.add(_switcherActive!);
    }
    _currentTabChangedSubject.sink.add(_currentTab);
  }

  _newTabSubject.sink.add(tab);
}