Unverified Commit 35bffd20 authored by Craig Labenz's avatar Craig Labenz Committed by GitHub

Improved handling of AppBar's `action` Icon sizes (#78886)

parent 6c0c6d30
......@@ -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,
);
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment