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
35bffd20
Unverified
Commit
35bffd20
authored
Apr 22, 2021
by
Craig Labenz
Committed by
GitHub
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved handling of AppBar's `action` Icon sizes (#78886)
parent
6c0c6d30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+2
-0
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+72
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
35bffd20
...
...
@@ -865,6 +865,7 @@ class _AppBarState extends State<AppBar> {
if
(
hasDrawer
)
{
leading
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
iconSize:
overallIconTheme
.
size
??
24
,
onPressed:
_handleDrawerButton
,
tooltip:
MaterialLocalizations
.
of
(
context
).
openAppDrawerTooltip
,
);
...
...
@@ -938,6 +939,7 @@ class _AppBarState extends State<AppBar> {
}
else
if
(
hasEndDrawer
)
{
actions
=
IconButton
(
icon:
const
Icon
(
Icons
.
menu
),
iconSize:
overallIconTheme
.
size
??
24
,
onPressed:
_handleDrawerButtonEnd
,
tooltip:
MaterialLocalizations
.
of
(
context
).
openAppDrawerTooltip
,
);
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
35bffd20
...
...
@@ -538,6 +538,78 @@ void main() {
expect
(
yCenter
(
appBarKey
),
equals
(
yCenter
(
action1Key
)));
});
testWidgets
(
'AppBar drawer icon has default size'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Howdy!'
),
),
drawer:
const
Drawer
(),
),
),
);
final
double
iconSize
=
const
IconThemeData
.
fallback
().
size
!;
expect
(
tester
.
getSize
(
find
.
byIcon
(
Icons
.
menu
)),
equals
(
Size
(
iconSize
,
iconSize
)),
);
});
testWidgets
(
'AppBar drawer icon is sized by iconTheme'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Howdy!'
),
iconTheme:
const
IconThemeData
(
size:
30
),
),
drawer:
const
Drawer
(),
),
),
);
expect
(
tester
.
getSize
(
find
.
byIcon
(
Icons
.
menu
)),
equals
(
const
Size
(
30
,
30
)),
);
});
testWidgets
(
'AppBar endDrawer icon has default size'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Howdy!'
),
),
endDrawer:
const
Drawer
(),
),
),
);
final
double
iconSize
=
const
IconThemeData
.
fallback
().
size
!;
expect
(
tester
.
getSize
(
find
.
byIcon
(
Icons
.
menu
)),
equals
(
Size
(
iconSize
,
iconSize
)),
);
});
testWidgets
(
'AppBar endDrawer icon is sized by iconTheme'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Howdy!'
),
iconTheme:
const
IconThemeData
(
size:
30
),
),
endDrawer:
const
Drawer
(),
),
),
);
expect
(
tester
.
getSize
(
find
.
byIcon
(
Icons
.
menu
)),
equals
(
const
Size
(
30
,
30
)),
);
});
testWidgets
(
'leading button extends to edge and is square'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
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