Revert "AppBar.backwardsCompatibility now default false, deprecated (#86198)"
This reverts commit 3eca034ffdbac7d48867a0a89003eec8dbca871f.
diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart
index 56e59b7..e45e18d 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart
@@ -341,6 +341,7 @@
@override
Widget build(BuildContext context) {
final AppBar appBar = AppBar(
+ brightness: Brightness.light,
elevation: 0.0,
titleSpacing: 0.0,
title: _BackdropTitle(
diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart
index a3faa01..0022f03 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart
@@ -29,6 +29,7 @@
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.white,
+ brightness: Brightness.light,
leading: IconButton(
icon: const BackButtonIcon(),
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart
index 544a45b..a7db222 100644
--- a/packages/flutter/lib/src/material/app_bar.dart
+++ b/packages/flutter/lib/src/material/app_bar.dart
@@ -233,17 +233,9 @@
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,
@@ -253,10 +245,6 @@
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,
@@ -540,7 +528,7 @@
final Color? foregroundColor;
/// {@template flutter.material.appbar.brightness}
- /// This property is deprecated, please use [systemOverlayStyle] instead.
+ /// This property is obsolete, please use [systemOverlayStyle] instead.
///
/// Determines the brightness of the [SystemUiOverlayStyle]: for
/// [Brightness.dark], [SystemUiOverlayStyle.light] is used and fo
@@ -565,10 +553,6 @@
/// is light or dark.
/// * [backwardsCompatibility], which forces AppBar to use this
/// obsolete property.
- @Deprecated(
- 'This property is no longer used, please use systemOverlayStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final Brightness? brightness;
/// {@template flutter.material.appbar.iconTheme}
@@ -604,20 +588,13 @@
final IconThemeData? actionsIconTheme;
/// {@template flutter.material.appbar.textTheme}
- /// This property is deprecated, please use [toolbarTextStyle] and
- /// [titleTextStyle] instead.
- ///
/// The typographic styles to use for text in the app bar. Typically this is
- /// set along with [backgroundColor], [iconTheme].
+ /// set along with [brightness] [backgroundColor], [iconTheme].
///
/// If this property is null, then [AppBarTheme.textTheme] of
/// [ThemeData.appBarTheme] is used. If that is also null, then
/// [ThemeData.primaryTextTheme] is used.
/// {@endtemplate}
- @Deprecated(
- 'This property is no longer used, please use toolbarTextStyle and titleTextStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final TextTheme? textTheme;
/// {@template flutter.material.appbar.primary}
@@ -702,25 +679,21 @@
final double? leadingWidth;
/// {@template flutter.material.appbar.backwardsCompatibility}
- /// This property is deprecated and is false by default.
- ///
/// If true, preserves the original defaults for the [backgroundColor],
/// [iconTheme], [actionsIconTheme] properties, and the original use of
/// the [textTheme] and [brightness] properties.
///
/// If this property is null, then [AppBarTheme.backwardsCompatibility] of
/// [ThemeData.appBarTheme] is used. If that is also null, the default
- /// value is false.
+ /// value is true.
///
- /// This is a temporary property and it has been deprecated. App
- /// developers are encouraged to opt into the new features by
- /// leaving it default (false) and using the [foregroundColor] and
- /// [systemOverlayStyle] properties as needed.
+ /// This is a temporary property. When setting it to false is no
+ /// longer considered a breaking change, it will be deprecated and
+ /// its default value will be changed to false. App developers are
+ /// encouraged to opt into the new features by setting it to false
+ /// and using the [foregroundColor] and [systemOverlayStyle]
+ /// properties as needed.
/// {@endtemplate}
- @Deprecated(
- 'This property is obsolete and is false by default. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final bool? backwardsCompatibility;
/// {@template flutter.material.appbar.toolbarTextStyle}
@@ -761,7 +734,7 @@
/// {@template flutter.material.appbar.systemOverlayStyle}
/// Specifies the style to use for the system overlays that overlap the AppBar.
///
- /// This property is only used if [backwardsCompatibility] is false (the default).
+ /// This property is only used if [backwardsCompatibility] is set to false.
///
/// If this property is null, then [AppBarTheme.systemOverlayStyle] of
/// [ThemeData.appBarTheme] is used. If that is also null, an appropriate
@@ -880,7 +853,7 @@
final bool useCloseButton = parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
final double toolbarHeight = widget.toolbarHeight ?? appBarTheme.toolbarHeight ?? kToolbarHeight;
- final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? false;
+ final bool backwardsCompatibility = widget.backwardsCompatibility ?? appBarTheme.backwardsCompatibility ?? true;
final Color backgroundColor = backwardsCompatibility
? widget.backgroundColor
@@ -1545,17 +1518,9 @@
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,
@@ -1653,10 +1618,6 @@
/// {@macro flutter.material.appbar.brightness}
///
/// This property is used to configure an [AppBar].
- @Deprecated(
- 'This property is no longer used, please use systemOverlayStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final Brightness? brightness;
/// {@macro flutter.material.appbar.iconTheme}
@@ -1672,10 +1633,6 @@
/// {@macro flutter.material.appbar.textTheme}
///
/// This property is used to configure an [AppBar].
- @Deprecated(
- 'This property is no longer used, please use toolbarTextStyle and titleTextStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final TextTheme? textTheme;
/// {@macro flutter.material.appbar.primary}
diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart
index f0eccfc..49ba0ee 100644
--- a/packages/flutter/lib/src/material/app_bar_theme.dart
+++ b/packages/flutter/lib/src/material/app_bar_theme.dart
@@ -28,10 +28,6 @@
class AppBarTheme with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.appBarTheme].
const AppBarTheme({
- @Deprecated(
- 'This property is no longer used, please use systemOverlayStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
this.brightness,
Color? color,
Color? backgroundColor,
@@ -41,10 +37,6 @@
this.shape,
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.centerTitle,
this.titleSpacing,
@@ -52,10 +44,6 @@
this.toolbarTextStyle,
this.titleTextStyle,
this.systemOverlayStyle,
- @Deprecated(
- 'This property is obsolete and is false by default. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
this.backwardsCompatibility,
}) : assert(
color == null || backgroundColor == null,
@@ -63,7 +51,7 @@
),
backgroundColor = backgroundColor ?? color;
- /// This property is deprecated, please use [systemOverlayStyle] instead.
+ /// This property is obsolete, please use [systemOverlayStyle] instead.
///
/// Overrides the default value of the obsolete [AppBar.brightness]
/// property which implicitly defines [AppBar.systemOverlayStyle] in
@@ -75,14 +63,8 @@
/// [AppBar.systemOverlayStyle] in all descendant [AppBar] widgets.
/// * [AppBar.backwardsCompatibility], which forces [AppBar] to depend
/// on this obsolete property.
- @Deprecated(
- 'This property is no longer used, please use systemOverlayStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final Brightness? brightness;
- /// This property is deprecated, please use [backgroundColor] instead.
- ///
/// Obsolete property that overrides the default value of
/// [AppBar.backgroundColor] in all descendant [AppBar] widgets.
///
@@ -93,10 +75,6 @@
/// [AppBar.backgroundColor].
/// * [AppBar.backwardsCompatibility], which forces [AppBar] to depend
/// on this obsolete property.
- @Deprecated(
- 'This property is no longer used, please use backgroundColor instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
Color? get color => backgroundColor;
/// Overrides the default value of [AppBar.backgroundColor] in all
@@ -151,9 +129,6 @@
/// [AppBar.foregroundColor] in all descendant widgets.
final IconThemeData? actionsIconTheme;
- /// This property is deprecated, please use [toolbarTextStyle] and
- /// [titleTextStyle] instead.
- ///
/// Overrides the default value of the obsolete [AppBar.textTheme]
/// property in all descendant [AppBar] widgets.
///
@@ -163,10 +138,6 @@
/// [AppBar.toolbarTextStyle in all descendant [AppBar] widgets.
/// * [titleTextStyle], which overrides the default value for
/// [AppBar.titleTextStyle in all descendant [AppBar] widgets.
- @Deprecated(
- 'This property is no longer used, please use toolbarTextStyle and titleTextStyle instead. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final TextTheme? textTheme;
/// Overrides the default value for [AppBar.centerTitle].
@@ -191,8 +162,7 @@
/// Overrides the default value for the obsolete [AppBar.toolbarTextStyle]
/// property in all descendant [AppBar] widgets.
///
- /// If this property is specified, then [backwardsCompatibility]
- /// should be false (the default).
+ /// If this property is specified, then [backwardsCompatibility] should be true.
///
/// See also:
///
@@ -203,8 +173,7 @@
/// Overrides the default value of [AppBar.titleTextStyle]
/// property in all descendant [AppBar] widgets.
///
- /// If this property is specified, then [backwardsCompatibility]
- /// should be false (the default).
+ /// If this property is specified, then [backwardsCompatibility] should be true.
///
/// See also:
///
@@ -218,10 +187,6 @@
/// Overrides the default value of [AppBar.backwardsCompatibility]
/// property in all descendant [AppBar] widgets.
- @Deprecated(
- 'This property is obsolete and is false by default. '
- 'This feature was deprecated after v2.4.0-0.0.pre.',
- )
final bool? backwardsCompatibility;
/// Creates a copy of this object with the given fields replaced with the
diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart
index 5300949..20ac614 100644
--- a/packages/flutter/test/material/app_bar_test.dart
+++ b/packages/flutter/test/material/app_bar_test.dart
@@ -27,6 +27,7 @@
primary: true,
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
title: const Text('AppBar Title'),
floating: floating,
pinned: pinned,
@@ -72,6 +73,7 @@
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
),
),
@@ -92,6 +94,7 @@
theme: ThemeData(platform: platform),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
),
),
@@ -110,6 +113,7 @@
theme: ThemeData(platform: platform),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
actions: const <Widget>[
Icon(Icons.thumb_up),
@@ -131,6 +135,7 @@
theme: ThemeData(platform: platform),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
actions: const <Widget>[
Icon(Icons.thumb_up),
@@ -153,6 +158,7 @@
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: true,
title: const Text('X'),
),
@@ -172,6 +178,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
title: const Placeholder(key: Key('X')),
),
@@ -191,6 +198,7 @@
textDirection: TextDirection.rtl,
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
title: const Placeholder(key: Key('X')),
),
@@ -209,6 +217,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
titleSpacing: 32.0,
title: const Placeholder(key: Key('X')),
@@ -229,6 +238,7 @@
textDirection: TextDirection.rtl,
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
titleSpacing: 32.0,
title: const Placeholder(key: Key('X')),
@@ -250,6 +260,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
title: const Text('X'),
),
@@ -272,6 +283,7 @@
textDirection: TextDirection.rtl,
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
title: const Text('X'),
),
@@ -298,6 +310,7 @@
return MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
leading: leading,
centerTitle: false,
title: Container(
@@ -361,6 +374,7 @@
return MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
leading: leading,
centerTitle: true,
title: Container(
@@ -415,6 +429,7 @@
textDirection: TextDirection.rtl,
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
leading: leading,
centerTitle: true,
title: Container(
@@ -460,6 +475,7 @@
home: SizedBox(
height: kToolbarHeight,
child: AppBar(
+ backwardsCompatibility: false,
leading: const Text('L'),
title: const Text('No Scaffold'),
actions: const <Widget>[Text('A1'), Text('A2')],
@@ -483,6 +499,7 @@
width: 0.0,
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
),
),
@@ -506,6 +523,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
key: appBarKey,
leading: SizedBox(key: leadingKey, height: 50.0),
title: SizedBox(key: titleKey, height: 40.0),
@@ -605,6 +623,7 @@
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
),
drawer: Column(), // Doesn't really matter. Triggers a hamburger regardless.
@@ -623,6 +642,7 @@
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('X'),
actions: const <Widget> [
IconButton(
@@ -992,6 +1012,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
forceElevated: forceElevated,
elevation: elevation,
@@ -1075,6 +1096,7 @@
child: Scaffold(
primary: true,
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('title'),
),
),
@@ -1100,6 +1122,7 @@
child: Scaffold(
primary: false,
appBar: AppBar(
+ backwardsCompatibility: false,
bottom: PreferredSize(
preferredSize: const Size.fromHeight(200.0),
child: Container(),
@@ -1127,6 +1150,7 @@
child: Scaffold(
primary: true,
appBar: AppBar(
+ backwardsCompatibility: false,
bottom: PreferredSize(
preferredSize: const Size.fromHeight(200.0),
child: Container(),
@@ -1152,6 +1176,7 @@
child: MediaQuery(
data: topPadding100,
child: AppBar(
+ backwardsCompatibility: false,
primary: false,
title: const Text('title'),
),
@@ -1181,6 +1206,7 @@
body: Column(
children: <Widget>[
AppBar(
+ backwardsCompatibility: false,
title: const Text('title'),
),
],
@@ -1220,6 +1246,7 @@
home: Scaffold(
drawer: const Drawer(),
appBar: AppBar(
+ backwardsCompatibility: false,
automaticallyImplyLeading: false,
),
),
@@ -1326,6 +1353,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
title: const Text('Abc'),
actions: <Widget>[
IconButton(
@@ -1367,6 +1395,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: key),
title: const Text('Abc'),
actions: const <Widget>[
@@ -1388,6 +1417,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: key),
title: const Text('Abc'),
actions: const <Widget>[
@@ -1418,6 +1448,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: key),
title: const Text('Abc'),
actions: const <Widget>[
@@ -1459,6 +1490,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: key),
title: const Text('Abc'),
actions: const <Widget>[
@@ -1506,6 +1538,7 @@
child: Scaffold(
primary: false,
appBar: AppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: leadingKey), // Forced to 56x56, see _kLeadingWidth in app_bar.dart.
title: Placeholder(key: titleKey, fallbackHeight: kToolbarHeight),
actions: <Widget>[ Placeholder(key: trailingKey, fallbackWidth: 10) ],
@@ -1551,6 +1584,7 @@
primary: true,
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: leadingKey),
title: Placeholder(key: titleKey, fallbackHeight: kToolbarHeight),
actions: <Widget>[ Placeholder(key: trailingKey) ],
@@ -1589,6 +1623,7 @@
primary: true,
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: leadingKey),
title: Placeholder(key: titleKey),
actions: <Widget>[ Placeholder(key: trailingKey) ],
@@ -1611,6 +1646,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: const Text('Leading'),
title: const Text('Title'),
actions: const <Widget>[
@@ -1696,6 +1732,7 @@
textDirection: TextDirection.rtl,
child: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: const Text('Leading'),
title: const Text('Title'),
actions: const <Widget>[
@@ -1784,6 +1821,7 @@
MaterialApp(
home: Center(
child: AppBar(
+ backwardsCompatibility: false,
leading: const Text('Leading'),
title: const ExcludeSemantics(child: Text('Title')),
excludeHeaderSemantics: true,
@@ -1841,6 +1879,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Text('Leading'),
flexibleSpace: ExcludeSemantics(child: Text('Title')),
actions: <Widget>[Text('Action 1')],
@@ -1911,6 +1950,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Text('Leading'),
flexibleSpace: Text('Flexible space'),
actions: <Widget>[Text('Action 1')],
@@ -1985,6 +2025,7 @@
theme: darkTheme,
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('test'),
),
),
@@ -2005,6 +2046,7 @@
theme: lightTheme,
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('test'),
),
),
@@ -2025,6 +2067,7 @@
theme: lightTheme,
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('test'),
),
),
@@ -2045,6 +2088,7 @@
theme: darkTheme,
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('test'),
),
),
@@ -2072,6 +2116,7 @@
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
expandedHeight: appBarHeight,
pinned: false,
floating: true,
@@ -2125,6 +2170,7 @@
await tester.pumpWidget(
MaterialApp(
home: AppBar(
+ backwardsCompatibility: false,
leading: const Text('L'),
title: const Text('No Scaffold'),
actions: const <Widget>[Text('A1'), Text('A2')],
@@ -2148,6 +2194,7 @@
await tester.pumpWidget(
MaterialApp(
home: AppBar(
+ backwardsCompatibility: false,
leading: const Text('L'),
title: const Text('No Scaffold'),
actions: const <Widget>[Text('A1'), Text('A2')],
@@ -2171,6 +2218,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Text('L'),
title: Text('No Scaffold'),
actions: <Widget>[Text('A1'), Text('A2')],
@@ -2198,6 +2246,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Text('L'),
title: Text('No Scaffold'),
actions: <Widget>[Text('A1'), Text('A2')],
@@ -2228,6 +2277,7 @@
data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
child: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: false,
title: const Text('Jumbo', style: TextStyle(fontSize: 18)),
),
@@ -2268,6 +2318,7 @@
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
centerTitle: centerTitle,
title: MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
@@ -2328,6 +2379,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
title: const Text('Jumbo'),
pinned: pinned,
floating: floating,
@@ -2361,6 +2413,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
toolbarHeight: 48,
),
@@ -2438,6 +2491,7 @@
await tester.pumpWidget(MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
leading: const Placeholder(key: key),
leadingWidth: 100,
title: const Text('Title'),
@@ -2455,6 +2509,7 @@
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
leading: Placeholder(key: key),
leadingWidth: 100,
title: Text('Title'),
@@ -2517,6 +2572,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
leading: Icon(Icons.add_circle, key: leadingIconKey),
@@ -2603,6 +2659,7 @@
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
elevation: 0,
backgroundColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.scrolledUnder) ? scrolledColor : defaultColor;
@@ -2663,6 +2720,7 @@
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
elevation: 0,
backgroundColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.scrolledUnder) ? scrolledColor : defaultColor;
@@ -2724,6 +2782,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
elevation: 0,
backgroundColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.scrolledUnder) ? scrolledColor : defaultColor;
@@ -2775,6 +2834,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
elevation: 0,
backgroundColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.scrolledUnder) ? scrolledColor : defaultColor;
@@ -2830,6 +2890,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('AppBar'),
),
body: Scrollbar(
@@ -2857,6 +2918,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
elevation: 0,
backgroundColor: MaterialStateColor.resolveWith((Set<MaterialState> states) {
return states.contains(MaterialState.scrolledUnder) ? scrolledColor : defaultColor;
diff --git a/packages/flutter/test/material/app_bar_theme_test.dart b/packages/flutter/test/material/app_bar_theme_test.dart
index dd8be5d..ceb33e1 100644
--- a/packages/flutter/test/material/app_bar_theme_test.dart
+++ b/packages/flutter/test/material/app_bar_theme_test.dart
@@ -19,6 +19,7 @@
MaterialApp(
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
actions: <Widget>[
IconButton(icon: const Icon(Icons.share), onPressed: () { }),
],
@@ -54,6 +55,7 @@
theme: ThemeData(appBarTheme: appBarTheme),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('App Bar Title'),
actions: <Widget>[
IconButton(icon: const Icon(Icons.share), onPressed: () { }),
@@ -146,6 +148,7 @@
),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
backgroundColor: color,
brightness: brightness,
systemOverlayStyle: systemOverlayStyle,
@@ -189,6 +192,7 @@
await tester.pumpWidget(MaterialApp(
theme: ThemeData.from(colorScheme: const ColorScheme.light()),
home: Scaffold(appBar: AppBar(
+ backwardsCompatibility: false,
iconTheme: iconThemeData,
actionsIconTheme: actionsIconThemeData,
actions: <Widget>[
@@ -210,6 +214,7 @@
.copyWith(appBarTheme: _appBarTheme()),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
actions: <Widget>[
IconButton(icon: const Icon(Icons.share), onPressed: () { }),
],
@@ -246,6 +251,7 @@
theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
actions: <Widget>[
IconButton(icon: const Icon(Icons.share), onPressed: () { }),
],
@@ -322,6 +328,7 @@
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
iconTheme: IconThemeData(color: appBarIconColor),
actions: <Widget>[
IconButton(icon: const Icon(Icons.share), onPressed: () { }),
@@ -355,6 +362,7 @@
theme: ThemeData(appBarTheme: const AppBarTheme(centerTitle: true)),
home: Scaffold(appBar: AppBar(
title: const Text('Title'),
+ backwardsCompatibility: false,
)),
));
@@ -367,6 +375,7 @@
theme: ThemeData(appBarTheme: const AppBarTheme(centerTitle: true)),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
centerTitle: false,
),
@@ -382,6 +391,7 @@
await tester.pumpWidget(MaterialApp(
theme: ThemeData(platform: TargetPlatform.iOS),
home: Scaffold(appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
)),
));
@@ -397,6 +407,7 @@
theme: ThemeData(appBarTheme: const AppBarTheme(shadowColor: Colors.red)),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
shadowColor: Colors.yellow,
),
@@ -414,6 +425,7 @@
theme: ThemeData(appBarTheme: const AppBarTheme(titleSpacing: kTitleSpacing)),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
),
),
@@ -429,6 +441,7 @@
theme: ThemeData(appBarTheme: const AppBarTheme(titleSpacing: kTitleSpacing)),
home: Scaffold(
appBar: AppBar(
+ backwardsCompatibility: false,
title: const Text('Title'),
titleSpacing: 40,
),
@@ -446,6 +459,7 @@
home: const CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
title: Text('Title'),
),
],
@@ -463,6 +477,7 @@
home: const CustomScrollView(
slivers: <Widget>[
SliverAppBar(
+ backwardsCompatibility: false,
title: Text('Title'),
titleSpacing: 40,
),
@@ -489,6 +504,7 @@
testWidgets('AppBarTheme implements debugFillProperties', (WidgetTester tester) async {
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
const AppBarTheme(
+ backwardsCompatibility: false,
brightness: Brightness.dark,
backgroundColor: Color(0xff000001),
elevation: 8.0,
@@ -509,6 +525,7 @@
'shadowColor: Color(0xff000002)',
'centerTitle: true',
'titleSpacing: 40.0',
+ 'backwardsCompatibility: false',
]);
// On the web, Dart doubles and ints are backed by the same kind of object because