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
34a62848
Unverified
Commit
34a62848
authored
Aug 31, 2022
by
Qun Cheng
Committed by
GitHub
Aug 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the default color of the trailing widget on app bar (#110635)
parent
7e7c1e4a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+3
-1
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+36
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
34a62848
...
...
@@ -942,11 +942,13 @@ class _AppBarState extends State<AppBar> {
??
appBarTheme
.
iconTheme
??
defaults
.
iconTheme
!.
copyWith
(
color:
foregroundColor
);
final
Color
?
actionForegroundColor
=
widget
.
foregroundColor
??
appBarTheme
.
foregroundColor
;
IconThemeData
actionsIconTheme
=
widget
.
actionsIconTheme
??
appBarTheme
.
actionsIconTheme
??
widget
.
iconTheme
??
appBarTheme
.
iconTheme
??
defaults
.
actionsIconTheme
?.
copyWith
(
color:
f
oregroundColor
)
??
defaults
.
actionsIconTheme
?.
copyWith
(
color:
actionF
oregroundColor
)
??
overallIconTheme
;
TextStyle
?
toolbarTextStyle
=
backwardsCompatibility
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
34a62848
...
...
@@ -2876,6 +2876,42 @@ void main() {
expect
(
actionIconColor
(),
foregroundColor
);
});
testWidgets
(
'Leading, title, and actions show correct default colors'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
themeData
=
ThemeData
.
from
(
colorScheme:
const
ColorScheme
.
light
(
onPrimary:
Colors
.
blue
,
onSurface:
Colors
.
red
,
onSurfaceVariant:
Colors
.
yellow
),
);
final
bool
material3
=
themeData
.
useMaterial3
;
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
themeData
,
home:
Scaffold
(
appBar:
AppBar
(
leading:
const
Icon
(
Icons
.
add_circle
),
title:
const
Text
(
'title'
),
actions:
const
<
Widget
>[
Icon
(
Icons
.
ac_unit
)
],
),
),
),
);
Color
textColor
()
{
return
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'title'
)).
text
.
style
!.
color
!;
}
Color
?
leadingIconColor
()
=>
iconStyle
(
tester
,
Icons
.
add_circle
)?.
color
;
Color
?
actionIconColor
()
=>
iconStyle
(
tester
,
Icons
.
ac_unit
)?.
color
;
// M2 default color are onPrimary, and M3 has onSurface for leading and title,
// onSurfaceVariant for actions.
expect
(
textColor
(),
material3
?
Colors
.
red
:
Colors
.
blue
);
expect
(
leadingIconColor
(),
material3
?
Colors
.
red
:
Colors
.
blue
);
expect
(
actionIconColor
(),
material3
?
Colors
.
yellow
:
Colors
.
blue
);
});
// Regression test for https://github.com/flutter/flutter/issues/107305
group
(
'Icons are colored correctly by IconTheme and ActionIconTheme in M3'
,
()
{
testWidgets
(
'Icons and IconButtons are colored by IconTheme in M3'
,
(
WidgetTester
tester
)
async
{
...
...
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