SliverAppBar constructor

const SliverAppBar({
  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 = false,
  25. bool snap = false,
  26. bool stretch = false,
  27. double stretchTriggerOffset = 100.0,
  28. AsyncCallback? onStretchTrigger,
  29. ShapeBorder? shape,
  30. double toolbarHeight = kToolbarHeight,
  31. double? leadingWidth,
  32. TextStyle? toolbarTextStyle,
  33. TextStyle? titleTextStyle,
  34. SystemUiOverlayStyle? systemOverlayStyle,
  35. bool forceMaterialTransparency = false,
  36. Clip? clipBehavior,
})

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

Implementation

const SliverAppBar({
  super.key,
  this.leading,
  this.automaticallyImplyLeading = true,
  this.title,
  this.actions,
  this.flexibleSpace,
  this.bottom,
  this.elevation,
  this.scrolledUnderElevation,
  this.shadowColor,
  this.surfaceTintColor,
  this.forceElevated = false,
  this.backgroundColor,
  this.foregroundColor,
  this.iconTheme,
  this.actionsIconTheme,
  this.primary = true,
  this.centerTitle,
  this.excludeHeaderSemantics = false,
  this.titleSpacing,
  this.collapsedHeight,
  this.expandedHeight,
  this.floating = false,
  this.pinned = false,
  this.snap = false,
  this.stretch = false,
  this.stretchTriggerOffset = 100.0,
  this.onStretchTrigger,
  this.shape,
  this.toolbarHeight = kToolbarHeight,
  this.leadingWidth,
  this.toolbarTextStyle,
  this.titleTextStyle,
  this.systemOverlayStyle,
  this.forceMaterialTransparency = false,
  this.clipBehavior,
}) : assert(floating || !snap, 'The "snap" argument only makes sense for floating app bars.'),
     assert(stretchTriggerOffset > 0.0),
     assert(
      collapsedHeight == null || collapsedHeight >= toolbarHeight,
      'The "collapsedHeight" argument has to be larger than or equal to [toolbarHeight].',
     ),
     _variant = _SliverAppVariant.small;