preferredSize property

  1. @override
Size get 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 {
  double maxHeight = 46.0;
  for (final Widget item in vTabs) {
    if (item is PreferredSizeWidget) {
      final double itemHeight = item.preferredSize.height;
      maxHeight = math.max(itemHeight, maxHeight);
    }
  }
  // Think about how to add indicator weight here...
  return Size.fromHeight(maxHeight + 2);
}