AppBar constructor Null safety

AppBar(
  1. {Key? key,
  2. Widget? leading,
  3. bool automaticallyImplyLeading,
  4. Widget? title,
  5. List<Widget>? actions,
  6. Widget? flexibleSpace,
  7. PreferredSizeWidget? bottom,
  8. double? elevation,
  9. Color? shadowColor,
  10. ShapeBorder? shape,
  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,
  18. bool? centerTitle,
  19. bool excludeHeaderSemantics,
  20. double? titleSpacing,
  21. double toolbarOpacity,
  22. double bottomOpacity,
  23. double? toolbarHeight,
  24. double? leadingWidth,
  25. @Deprecated('This property is obsolete and is false by default. ' 'This feature was deprecated after v2.4.0-0.0.pre.') bool? backwardsCompatibility,
  26. TextStyle? toolbarTextStyle,
  27. TextStyle? titleTextStyle,
  28. SystemUiOverlayStyle? systemOverlayStyle}
)

Creates a material design app bar.

The arguments primary, toolbarOpacity, bottomOpacity, backwardsCompatibility, and automaticallyImplyLeading must not be null. Additionally, if elevation is specified, it must be non-negative.

Typically used in the Scaffold.appBar property.

Implementation

AppBar({
  Key? key,
  this.leading,
  this.automaticallyImplyLeading = true,
  this.title,
  this.actions,
  this.flexibleSpace,
  this.bottom,
  this.elevation,
  this.shadowColor,
  this.shape,
  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.toolbarOpacity = 1.0,
  this.bottomOpacity = 1.0,
  this.toolbarHeight,
  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(elevation == null || elevation >= 0.0),
     assert(primary != null),
     assert(toolbarOpacity != null),
     assert(bottomOpacity != null),
     preferredSize = _PreferredAppBarSize(toolbarHeight, bottom?.preferredSize.height),
     super(key: key);