Skip to content

Commit

Permalink
Remove back button when using end drawer (#63272)
Browse files Browse the repository at this point in the history
  • Loading branch information
gusghrlrl101 committed Sep 15, 2020
1 parent 37b03ec commit dfd0c62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/app_bar.dart
Expand Up @@ -555,7 +555,7 @@ class _AppBarState extends State<AppBar> {
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
);
} else {
if (canPop)
if (!hasEndDrawer && canPop)
leading = useCloseButton ? const CloseButton() : const BackButton();
}
}
Expand Down
17 changes: 17 additions & 0 deletions packages/flutter/test/material/app_bar_test.dart
Expand Up @@ -2194,4 +2194,21 @@ void main() {
// By default toolbarHeight is 56.0.
expect(tester.getRect(find.byKey(key)), const Rect.fromLTRB(0, 0, 100, 56));
});

testWidgets("AppBar with EndDrawer doesn't have leading", (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Scaffold(
appBar: AppBar(),
endDrawer: const Drawer(),
),
));

final Finder endDrawerFinder = find.byTooltip('Open navigation menu');
await tester.tap(endDrawerFinder);
await tester.pump();

final Finder appBarFinder = find.byType(NavigationToolbar);
NavigationToolbar getAppBarWidget(Finder finder) => tester.widget<NavigationToolbar>(finder);
expect(getAppBarWidget(appBarFinder).leading, null);
});
}

0 comments on commit dfd0c62

Please sign in to comment.