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
0b657236
Unverified
Commit
0b657236
authored
May 04, 2023
by
chunhtai
Committed by
GitHub
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleans up appbar imply leading logic (#125315)
fixes
https://github.com/flutter/flutter/issues/80256
parent
b00f1c45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+1
-5
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+27
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
0b657236
...
...
@@ -827,7 +827,6 @@ class _AppBarState extends State<AppBar> {
final
bool
hasDrawer
=
scaffold
?.
hasDrawer
??
false
;
final
bool
hasEndDrawer
=
scaffold
?.
hasEndDrawer
??
false
;
final
bool
canPop
=
parentRoute
?.
canPop
??
false
;
final
bool
useCloseButton
=
parentRoute
is
PageRoute
<
dynamic
>
&&
parentRoute
.
fullscreenDialog
;
final
double
toolbarHeight
=
widget
.
toolbarHeight
??
appBarTheme
.
toolbarHeight
??
kToolbarHeight
;
...
...
@@ -897,10 +896,7 @@ class _AppBarState extends State<AppBar> {
leading
=
DrawerButton
(
style:
IconButton
.
styleFrom
(
iconSize:
overallIconTheme
.
size
??
24
),
);
// TODO(chunhtai): remove (!hasEndDrawer && canPop) once internal tests
// are migrated.
// https://github.com/flutter/flutter/issues/80256.
}
else
if
((!
hasEndDrawer
&&
canPop
)
||
(
parentRoute
?.
impliesAppBarDismissal
??
false
))
{
}
else
if
(
parentRoute
?.
impliesAppBarDismissal
??
false
)
{
leading
=
useCloseButton
?
const
CloseButton
()
:
const
BackButton
();
}
}
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
0b657236
...
...
@@ -3946,6 +3946,33 @@ void main() {
);
});
testWidgets
(
'Only local entries that imply app bar dismissal will introduce an back button'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
key
=
GlobalKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
key:
key
,
appBar:
AppBar
(),
),
),
);
expect
(
find
.
byType
(
BackButton
),
findsNothing
);
// Push one entry that doesn't imply app bar dismissal.
ModalRoute
.
of
(
key
.
currentContext
!)!.
addLocalHistoryEntry
(
LocalHistoryEntry
(
onRemove:
()
{},
impliesAppBarDismissal:
false
),
);
await
tester
.
pump
();
expect
(
find
.
byType
(
BackButton
),
findsNothing
);
// Push one entry that implies app bar dismissal.
ModalRoute
.
of
(
key
.
currentContext
!)!.
addLocalHistoryEntry
(
LocalHistoryEntry
(
onRemove:
()
{}),
);
await
tester
.
pump
();
expect
(
find
.
byType
(
BackButton
),
findsOneWidget
);
});
testWidgets
(
'AppBar.preferredHeightFor'
,
(
WidgetTester
tester
)
async
{
late
double
preferredHeight
;
late
Size
preferredSize
;
...
...
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