AppBar constructor Null safety
- {Key? key,
- Widget? leading,
- bool automaticallyImplyLeading = true,
- Widget? title,
- List<
Widget> ? actions, - Widget? flexibleSpace,
- PreferredSizeWidget? bottom,
- double? elevation,
- double? scrolledUnderElevation,
- ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
- Color? shadowColor,
- Color? surfaceTintColor,
- ShapeBorder? shape,
- Color? backgroundColor,
- Color? foregroundColor,
- @Deprecated('This property is no longer used, please use systemOverlayStyle instead. ' 'This feature was deprecated after v2.4.0-0.0.pre.') Brightness? brightness,
- IconThemeData? iconTheme,
- IconThemeData? 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.') TextTheme? textTheme,
- bool primary = true,
- bool? centerTitle,
- bool excludeHeaderSemantics = false,
- double? titleSpacing,
- double toolbarOpacity = 1.0,
- double bottomOpacity = 1.0,
- double? toolbarHeight,
- double? leadingWidth,
- @Deprecated('This property is obsolete and is false by default. ' 'This feature was deprecated after v2.4.0-0.0.pre.') bool? backwardsCompatibility,
- TextStyle? toolbarTextStyle,
- TextStyle? titleTextStyle,
- 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({
super.key,
this.leading,
this.automaticallyImplyLeading = true,
this.title,
this.actions,
this.flexibleSpace,
this.bottom,
this.elevation,
this.scrolledUnderElevation,
this.notificationPredicate = defaultScrollNotificationPredicate,
this.shadowColor,
this.surfaceTintColor,
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(notificationPredicate != null),
assert(primary != null),
assert(toolbarOpacity != null),
assert(bottomOpacity != null),
preferredSize = _PreferredAppBarSize(toolbarHeight, bottom?.preferredSize.height);