SliverAppBar.large constructor Null safety

  1. {Key? key,
  2. Widget? leading,
  3. bool automaticallyImplyLeading = true,
  4. Widget? title,
  5. List<Widget>? actions,
  6. Widget? flexibleSpace,
  7. PreferredSizeWidget? bottom,
  8. double? elevation,
  9. double? scrolledUnderElevation,
  10. Color? shadowColor,
  11. Color? surfaceTintColor,
  12. bool forceElevated = false,
  13. Color? backgroundColor,
  14. Color? foregroundColor,
  15. IconThemeData? iconTheme,
  16. IconThemeData? actionsIconTheme,
  17. bool primary = true,
  18. bool? centerTitle,
  19. bool excludeHeaderSemantics = false,
  20. double? titleSpacing,
  21. double? collapsedHeight,
  22. double? expandedHeight,
  23. bool floating = false,
  24. bool pinned = true,
  25. bool snap = false,
  26. bool stretch = false,
  27. double stretchTriggerOffset = 100.0,
  28. AsyncCallback? onStretchTrigger,
  29. ShapeBorder? shape,
  30. double toolbarHeight = _LargeScrollUnderFlexibleConfig.collapsedHeight,
  31. double? leadingWidth,
  32. TextStyle? toolbarTextStyle,
  33. TextStyle? titleTextStyle,
  34. SystemUiOverlayStyle? systemOverlayStyle}

Creates a Material Design large top app bar that can be placed in a CustomScrollView.

Returns a SliverAppBar configured with appropriate defaults for a large top app bar as defined in Material 3. It starts fully expanded with the title in an area underneath the main row of icons. When the CustomScrollView is scrolled, the title will be scrolled under the main row. When it is fully collapsed, a smaller version of the title will fade in on the main row. The reverse will happen if it is expanded again.

This sample shows how to use SliverAppBar.large in a CustomScrollView.

To create a local project with this code sample, run:
flutter create --sample=material.SliverAppBar.large.1 mysample

See also:


factory SliverAppBar.large({
  Key? key,
  Widget? leading,
  bool automaticallyImplyLeading = true,
  Widget? title,
  List<Widget>? actions,
  Widget? flexibleSpace,
  PreferredSizeWidget? bottom,
  double? elevation,
  double? scrolledUnderElevation,
  Color? shadowColor,
  Color? surfaceTintColor,
  bool forceElevated = false,
  Color? backgroundColor,
  Color? foregroundColor,
  IconThemeData? iconTheme,
  IconThemeData? actionsIconTheme,
  bool primary = true,
  bool? centerTitle,
  bool excludeHeaderSemantics = false,
  double? titleSpacing,
  double? collapsedHeight,
  double? expandedHeight,
  bool floating = false,
  bool pinned = true,
  bool snap = false,
  bool stretch = false,
  double stretchTriggerOffset = 100.0,
  AsyncCallback? onStretchTrigger,
  ShapeBorder? shape,
  double toolbarHeight = _LargeScrollUnderFlexibleConfig.collapsedHeight,
  double? leadingWidth,
  TextStyle? toolbarTextStyle,
  TextStyle? titleTextStyle,
  SystemUiOverlayStyle? systemOverlayStyle,
}) {
  return SliverAppBar(
    key: key,
    leading: leading,
    automaticallyImplyLeading: automaticallyImplyLeading,
    actions: actions,
    flexibleSpace: flexibleSpace ?? _ScrollUnderFlexibleSpace(
      title: title,
      variant: _ScrollUnderFlexibleVariant.large,
      centerCollapsedTitle: centerTitle,
      primary: primary,
    bottom: bottom,
    elevation: elevation,
    scrolledUnderElevation: scrolledUnderElevation,
    shadowColor: shadowColor,
    surfaceTintColor: surfaceTintColor,
    forceElevated: forceElevated,
    backgroundColor: backgroundColor,
    foregroundColor: foregroundColor,
    iconTheme: iconTheme,
    actionsIconTheme: actionsIconTheme,
    primary: primary,
    centerTitle: centerTitle,
    excludeHeaderSemantics: excludeHeaderSemantics,
    titleSpacing: titleSpacing,
    collapsedHeight: collapsedHeight ?? _LargeScrollUnderFlexibleConfig.collapsedHeight,
    expandedHeight: expandedHeight ?? _LargeScrollUnderFlexibleConfig.expandedHeight,
    floating: floating,
    pinned: pinned,
    snap: snap,
    stretch: stretch,
    stretchTriggerOffset: stretchTriggerOffset,
    onStretchTrigger: onStretchTrigger,
    shape: shape,
    toolbarHeight: toolbarHeight,
    leadingWidth: leadingWidth,
    toolbarTextStyle: toolbarTextStyle,
    titleTextStyle: titleTextStyle,
    systemOverlayStyle: systemOverlayStyle,