Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3eca034f
Unverified
Commit
3eca034f
authored
Jul 12, 2021
by
Hans Muller
Committed by
GitHub
Jul 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AppBar.backwardsCompatibility now default false, deprecated (#86198)
parent
6a51e0c2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
96 deletions
+93
-96
backdrop.dart
...ation_tests/flutter_gallery/lib/demo/shrine/backdrop.dart
+0
-1
login.dart
...egration_tests/flutter_gallery/lib/demo/shrine/login.dart
+0
-1
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+55
-12
app_bar_theme.dart
packages/flutter/lib/src/material/app_bar_theme.dart
+38
-3
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+0
-62
app_bar_theme_test.dart
packages/flutter/test/material/app_bar_theme_test.dart
+0
-17
No files found.
dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart
View file @
3eca034f
...
...
@@ -341,7 +341,6 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
@override
Widget
build
(
BuildContext
context
)
{
final
AppBar
appBar
=
AppBar
(
brightness:
Brightness
.
light
,
elevation:
0.0
,
titleSpacing:
0.0
,
title:
_BackdropTitle
(
...
...
dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart
View file @
3eca034f
...
...
@@ -29,7 +29,6 @@ class _LoginPageState extends State<LoginPage> {
appBar:
AppBar
(
elevation:
0.0
,
backgroundColor:
Colors
.
white
,
brightness:
Brightness
.
light
,
leading:
IconButton
(
icon:
const
BackButtonIcon
(),
tooltip:
MaterialLocalizations
.
of
(
context
).
backButtonTooltip
,
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
3eca034f
...
...
@@ -233,9 +233,17 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
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
,
...
...
@@ -245,6 +253,10 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
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
,
...
...
@@ -523,7 +535,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
final
Color
?
foregroundColor
;
/// {@template flutter.material.appbar.brightness}
/// This property is
obsolete
, please use [systemOverlayStyle] instead.
/// This property is
deprecated
, please use [systemOverlayStyle] instead.
///
/// Determines the brightness of the [SystemUiOverlayStyle]: for
/// [Brightness.dark], [SystemUiOverlayStyle.light] is used and fo
...
...
@@ -548,6 +560,10 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// 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}
...
...
@@ -583,13 +599,20 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
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 [b
rightness] [b
ackgroundColor], [iconTheme].
/// set along with [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}
...
...
@@ -674,21 +697,25 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
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 true.
///
/// 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.
/// value is false.
///
/// 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.
/// {@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}
...
...
@@ -729,7 +756,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// {@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
set to false
.
/// This property is only used if [backwardsCompatibility] is
false (the default)
.
///
/// If this property is null, then [AppBarTheme.systemOverlayStyle] of
/// [ThemeData.appBarTheme] is used. If that is also null, an appropriate
...
...
@@ -848,7 +875,7 @@ class _AppBarState extends State<AppBar> {
final
bool
useCloseButton
=
parentRoute
is
PageRoute
<
dynamic
>
&&
parentRoute
.
fullscreenDialog
;
final
double
toolbarHeight
=
widget
.
toolbarHeight
??
appBarTheme
.
toolbarHeight
??
kToolbarHeight
;
final
bool
backwardsCompatibility
=
widget
.
backwardsCompatibility
??
appBarTheme
.
backwardsCompatibility
??
tru
e
;
final
bool
backwardsCompatibility
=
widget
.
backwardsCompatibility
??
appBarTheme
.
backwardsCompatibility
??
fals
e
;
final
Color
backgroundColor
=
backwardsCompatibility
?
widget
.
backgroundColor
...
...
@@ -1513,9 +1540,17 @@ class SliverAppBar extends StatefulWidget {
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
,
...
...
@@ -1613,6 +1648,10 @@ class SliverAppBar extends StatefulWidget {
/// {@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}
...
...
@@ -1628,6 +1667,10 @@ class SliverAppBar extends StatefulWidget {
/// {@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}
...
...
packages/flutter/lib/src/material/app_bar_theme.dart
View file @
3eca034f
...
...
@@ -28,6 +28,10 @@ import 'theme.dart';
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
,
...
...
@@ -36,6 +40,10 @@ class AppBarTheme with Diagnosticable {
this
.
shadowColor
,
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
,
...
...
@@ -43,6 +51,10 @@ class AppBarTheme with Diagnosticable {
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
,
...
...
@@ -50,7 +62,7 @@ class AppBarTheme with Diagnosticable {
),
backgroundColor
=
backgroundColor
??
color
;
/// This property is
obsolete
, please use [systemOverlayStyle] instead.
/// This property is
deprecated
, please use [systemOverlayStyle] instead.
///
/// Overrides the default value of the obsolete [AppBar.brightness]
/// property which implicitly defines [AppBar.systemOverlayStyle] in
...
...
@@ -62,8 +74,14 @@ class AppBarTheme with Diagnosticable {
/// [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.
///
...
...
@@ -74,6 +92,10 @@ class AppBarTheme with Diagnosticable {
/// [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
...
...
@@ -124,6 +146,9 @@ class AppBarTheme with Diagnosticable {
/// [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.
///
...
...
@@ -133,6 +158,10 @@ class AppBarTheme with Diagnosticable {
/// [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].
...
...
@@ -157,7 +186,8 @@ class AppBarTheme with Diagnosticable {
/// Overrides the default value for the obsolete [AppBar.toolbarTextStyle]
/// property in all descendant [AppBar] widgets.
///
/// If this property is specified, then [backwardsCompatibility] should be true.
/// If this property is specified, then [backwardsCompatibility]
/// should be false (the default).
///
/// See also:
///
...
...
@@ -168,7 +198,8 @@ class AppBarTheme with Diagnosticable {
/// Overrides the default value of [AppBar.titleTextStyle]
/// property in all descendant [AppBar] widgets.
///
/// If this property is specified, then [backwardsCompatibility] should be true.
/// If this property is specified, then [backwardsCompatibility]
/// should be false (the default).
///
/// See also:
///
...
...
@@ -182,6 +213,10 @@ class AppBarTheme with Diagnosticable {
/// 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
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
3eca034f
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/app_bar_theme_test.dart
View file @
3eca034f
...
...
@@ -19,7 +19,6 @@ void main() {
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
actions:
<
Widget
>[
IconButton
(
icon:
const
Icon
(
Icons
.
share
),
onPressed:
()
{
}),
],
...
...
@@ -54,7 +53,6 @@ void main() {
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:
()
{
}),
...
...
@@ -143,7 +141,6 @@ void main() {
theme:
ThemeData
.
from
(
colorScheme:
const
ColorScheme
.
light
()),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
backgroundColor:
color
,
brightness:
brightness
,
systemOverlayStyle:
systemOverlayStyle
,
...
...
@@ -185,7 +182,6 @@ void main() {
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
from
(
colorScheme:
const
ColorScheme
.
light
()),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
iconTheme:
iconThemeData
,
actionsIconTheme:
actionsIconThemeData
,
actions:
<
Widget
>[
...
...
@@ -207,7 +203,6 @@ void main() {
.
copyWith
(
appBarTheme:
_appBarTheme
()),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
actions:
<
Widget
>[
IconButton
(
icon:
const
Icon
(
Icons
.
share
),
onPressed:
()
{
}),
],
...
...
@@ -244,7 +239,6 @@ void main() {
theme
=
Theme
.
of
(
context
);
return
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
actions:
<
Widget
>[
IconButton
(
icon:
const
Icon
(
Icons
.
share
),
onPressed:
()
{
}),
],
...
...
@@ -321,7 +315,6 @@ void main() {
builder:
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
iconTheme:
IconThemeData
(
color:
appBarIconColor
),
actions:
<
Widget
>[
IconButton
(
icon:
const
Icon
(
Icons
.
share
),
onPressed:
()
{
}),
...
...
@@ -355,7 +348,6 @@ void main() {
theme:
ThemeData
(
appBarTheme:
const
AppBarTheme
(
centerTitle:
true
)),
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Title'
),
backwardsCompatibility:
false
,
)),
));
...
...
@@ -368,7 +360,6 @@ void main() {
theme:
ThemeData
(
appBarTheme:
const
AppBarTheme
(
centerTitle:
true
)),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
title:
const
Text
(
'Title'
),
centerTitle:
false
,
),
...
...
@@ -384,7 +375,6 @@ void main() {
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
title:
const
Text
(
'Title'
),
)),
));
...
...
@@ -400,7 +390,6 @@ void main() {
theme:
ThemeData
(
appBarTheme:
const
AppBarTheme
(
shadowColor:
Colors
.
red
)),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
title:
const
Text
(
'Title'
),
shadowColor:
Colors
.
yellow
,
),
...
...
@@ -418,7 +407,6 @@ void main() {
theme:
ThemeData
(
appBarTheme:
const
AppBarTheme
(
titleSpacing:
kTitleSpacing
)),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
title:
const
Text
(
'Title'
),
),
),
...
...
@@ -434,7 +422,6 @@ void main() {
theme:
ThemeData
(
appBarTheme:
const
AppBarTheme
(
titleSpacing:
kTitleSpacing
)),
home:
Scaffold
(
appBar:
AppBar
(
backwardsCompatibility:
false
,
title:
const
Text
(
'Title'
),
titleSpacing:
40
,
),
...
...
@@ -452,7 +439,6 @@ void main() {
home:
const
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
backwardsCompatibility:
false
,
title:
Text
(
'Title'
),
),
],
...
...
@@ -470,7 +456,6 @@ void main() {
home:
const
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
backwardsCompatibility:
false
,
title:
Text
(
'Title'
),
titleSpacing:
40
,
),
...
...
@@ -497,7 +482,6 @@ void main() {
testWidgets
(
'AppBarTheme implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
AppBarTheme
(
backwardsCompatibility:
false
,
brightness:
Brightness
.
dark
,
backgroundColor:
Color
(
0xff000001
),
elevation:
8.0
,
...
...
@@ -518,7 +502,6 @@ void main() {
'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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment