SliverAppBar constructor Null safety

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. @Deprecated('This property is no longer used, please use systemOverlayStyle instead. ' 'This feature was deprecated after v2.4.0-0.0.pre.') Brightness? brightness,
  16. IconThemeData? iconTheme,
  17. IconThemeData? actionsIconTheme,
  18. @Deprecated('This property is no longer used, please use toolbarTextStyle and titleTextStyle instead. ' 'This feature was deprecated after v2.4.0-0.0.pre.') TextTheme? textTheme,
  19. bool primary = true,
  20. bool? centerTitle,
  21. bool excludeHeaderSemantics = false,
  22. double? titleSpacing,
  23. double? collapsedHeight,
  24. double? expandedHeight,
  25. bool floating = false,
  26. bool pinned = false,
  27. bool snap = false,
  28. bool stretch = false,
  29. double stretchTriggerOffset = 100.0,
  30. AsyncCallback? onStretchTrigger,
  31. ShapeBorder? shape,
  32. double toolbarHeight = kToolbarHeight,
  33. double? leadingWidth,
  34. @Deprecated('This property is obsolete and is false by default. ' 'This feature was deprecated after v2.4.0-0.0.pre.') bool? backwardsCompatibility,
  35. TextStyle? toolbarTextStyle,
  36. TextStyle? titleTextStyle,
  37. SystemUiOverlayStyle? systemOverlayStyle}
)

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

The arguments forceElevated, primary, floating, pinned, snap and automaticallyImplyLeading must not be null.

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,
  @Deprecated(
    'This property is no longer used, please use systemOverlayStyle instead. '
    'This feature was deprecated after v2.4.0-0.0.pre.',
  )
  this.brightness,
  this.iconTheme,
  this.actionsIconTheme,
  @Deprecated(
    'This property is no longer used, please use toolbarTextStyle and titleTextStyle instead. '
    'This feature was deprecated after v2.4.0-0.0.pre.',
  )
  this.textTheme,
  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,
  @Deprecated(
    'This property is obsolete and is false by default. '
    'This feature was deprecated after v2.4.0-0.0.pre.',
  )
  this.backwardsCompatibility,
  this.toolbarTextStyle,
  this.titleTextStyle,
  this.systemOverlayStyle,
}) : assert(automaticallyImplyLeading != null),
     assert(forceElevated != null),
     assert(primary != null),
     assert(floating != null),
     assert(pinned != null),
     assert(snap != null),
     assert(stretch != null),
     assert(toolbarHeight != null),
     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].');