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. Color? shadowColor,
  10. bool forceElevated = false,
  11. Color? backgroundColor,
  12. Color? foregroundColor,
  13. @Deprecated('This property is no longer used, please use systemOverlayStyle instead. ' 'This feature was deprecated after v2.4.0-0.0.pre.') Brightness? brightness,
  14. IconThemeData? iconTheme,
  15. IconThemeData? actionsIconTheme,
  16. @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,
  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. @Deprecated('This property is obsolete and is false by default. ' 'This feature was deprecated after v2.4.0-0.0.pre.') bool? backwardsCompatibility,
  33. TextStyle? toolbarTextStyle,
  34. TextStyle? titleTextStyle,
  35. 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({
  Key? key,
  this.leading,
  this.automaticallyImplyLeading = true,
  this.title,
  this.actions,
  this.flexibleSpace,
  this.bottom,
  this.elevation,
  this.shadowColor,
  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].'),
     super(key: key);