preferredSize property Null safety

  1. @override
Size preferredSize
override

A size whose height depends on if the tabs have both icons and text.

AppBar uses this size to compute its own preferred size.

Implementation

@override
Size get preferredSize {
  double maxHeight = _kTabHeight;
  for (final Widget item in tabs) {
    if (item is PreferredSizeWidget) {
      final double itemHeight = item.preferredSize.height;
      maxHeight = math.max(itemHeight, maxHeight);
    }
  }
  return Size.fromHeight(maxHeight + indicatorWeight);
}