layout method

void layout(
  1. Size size,
  2. int count, {
  3. EdgeInsets padding = const EdgeInsets.all(inset),
  4. bool search = false,
})

Lays the bar out at size with count tabs, padding inside its edges.

Implementation

void layout(
  Size size,
  int count, {
  EdgeInsets padding = const EdgeInsets.all(inset),
  bool search = false,
}) {
  final bool first = _size == Size.zero;
  _size = size;
  _padding = padding;
  _count = count;
  _search = search;
  _selected = _selected.clamp(0, count - 1);
  if (first || !isActive) {
    _anchor = _clampToBar(tabCenter(_selected));
    _offset.snap(0);
    _shadow.snap(_anchor);
    _history.clear();
    _anchorLog.clear();
  } else if (_touch == null) {
    _anchor = tabCenter(_selected);
    _anchorLog.clear();
  }
}