buildAppBar static method

SliverAppBar buildAppBar(
  1. BuildContext context,
  2. {double? headerHeight,
  3. bool? centerTitle,
  4. Widget? pageTitle,
  5. Widget? leading,
  6. bool pinned = true,
  7. bool floating = false,
  8. List<Widget>? actions,
  9. Color? appBarColor,
  10. Color? pageBackground,
  11. AsyncCallback? onStretch,
  12. bool? showAppBarDivider,
  13. HeroBar? expanded,
  14. bool? isImpliedLeading}
)

Implementation

static SliverAppBar buildAppBar(
  BuildContext context, {
  double? headerHeight,
  bool? centerTitle,
  Widget? pageTitle,
  Widget? leading,
  bool pinned = true,
  bool floating = false,
  List<Widget>? actions,
  Color? appBarColor,
  Color? pageBackground,
  AsyncCallback? onStretch,
  bool? showAppBarDivider,
  HeroBar? expanded,
  bool? isImpliedLeading,
}) {
  return SliverAppBar(
    toolbarHeight: headerHeight ?? sunnySpacing.appBarHeight,
    centerTitle: centerTitle,
    pinned: pinned,
    title: pageTitle,
    floating: floating,
    actions: actions,
    leading: leading,
    automaticallyImplyLeading:
        !context.isInModal && isImpliedLeading != false,
    backgroundColor:
        appBarColor ?? pageBackground ?? sunnyColors.appBarBackground,
    elevation: 0,
    stretch: onStretch != null,
    onStretchTrigger: onStretch,
    expandedHeight: expanded?.expandedSize?.height,
    bottom: showAppBarDivider == true ? DividingLine.preferredSize() : null,
    flexibleSpace: expanded == null
        ? null
        : FlexibleSpaceBar(
            background: expanded,
            stretchModes:
                onStretch == null ? [] : [StretchMode.zoomBackground],
          ),
  );
}