preferredSize property

  1. @override
Size get preferredSize
override
  1. use by { appBar: BaseAppBar() }, the BaseThemeData.appBarHeight won't work, will use preferredSize's height
  2. use by { appBar: BaseAppBar().build(context) }, the BaseThemeData.appBarHeight will work, will replace the preferredSize's height
  3. Pay attention, two ways's build order is different 1.build BaseScaffold before build BaseAppBar 2.build BaseScaffold after build BaseAppBar

Implementation

@override
Size get preferredSize {
  double _height =
      height != null ? height! : (isCupertinoMode ? 44.0 : kToolbarHeight);
  final Widget? middle =
      valueOf('title', title) ?? valueOf('middle', this.middle);
  if (middle != null && bottom != null) {
    _height += bottom!.preferredSize.height;
  }
  return Size.fromHeight(_height);
}