naturalWidth static method

double? naturalWidth(
  1. int count,
  2. double label, {
  3. double horizontal = 2 * inset,
  4. bool search = false,
})

The width of UIKit's bar of count tabs whose widest label is label points wide, or null for four tabs or more, which fill the width they are given. Each tab is 94pt wide, or 39pt wider than the widest label; three tabs with short labels make a 274pt bar. horizontal is the padding at its two ends.

Beside a search tab's circle (search), only a bar of one or two tabs hugs them.

Implementation

static double? naturalWidth(
  int count,
  double label, {
  double horizontal = 2 * inset,
  bool search = false,
}) {
  if (count > (search ? 2 : 3)) {
    return null;
  }
  final double tab = math.max(94, label + 39);
  return count * tab - _overlap(count, search: search) + horizontal;
}