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 {
  AppBarConfig _defaultConfig = themeData ?? AppBarConfig();
  _defaultConfig = BaseThemeConfig.instance
      .getConfig(configId: _defaultConfig.configId)
      .appBarConfig
      .merge(_defaultConfig);
  return Size.fromHeight(
      _defaultConfig.appBarHeight + (bottom?.preferredSize.height ?? 0.0));
}