preferredSize property

  1. @override
Size preferredSize
override

The size this widget would prefer if it were otherwise unconstrained.

In many cases it's only necessary to define one preferred dimension. For example the Scaffold only depends on its app bar's preferred height. In that case implementations of this method can just return Size.fromHeight(myAppBarHeight).

Implementation

@override
Size get preferredSize {
  for (final Widget item in tabs) {
    if (item is Tab) {
      final Tab tab = item;
      if ((tab.text != null || tab.child != null) && tab.icon != null)
        return Size.fromHeight(_kTextAndIconTabHeight + indicatorWeight);
    }
  }
  return Size.fromHeight(_kTabHeight + indicatorWeight);
}