Unverified Commit a54b1025 authored by Alex Fourman's avatar Alex Fourman Committed by GitHub

fixes DropdownButton ignoring itemHeight in popup menu (#88574) (#88576)

parent baecbdfe
......@@ -175,6 +175,7 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
}
Widget child = Container(
padding: widget.padding,
height: widget.route.itemHeight,
child: widget.route.items[widget.itemIndex],
);
final BorderRadius itemBorderRadius;
......
......@@ -3559,4 +3559,45 @@ void main() {
expect(menuItem.borderRadius, borderRadius);
});
// Regression test for https://github.com/flutter/flutter/issues/88574
testWidgets("specifying itemHeight affects popup menu items' height", (WidgetTester tester) async {
const String value = 'One';
const double itemHeight = 80;
final List<DropdownMenuItem<String>> menuItems = <String>[
value,
'Two',
'Free',
'Four'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList();
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: DropdownButton<String>(
value: value,
itemHeight: itemHeight,
onChanged: (_) {},
items: menuItems,
),
),
),
),
);
await tester.tap(find.text(value));
await tester.pumpAndSettle();
for (final DropdownMenuItem<String> item in menuItems) {
final Iterable<Element> elements = tester.elementList(find.byWidget(item));
for (final Element element in elements){
expect(element.size!.height, itemHeight);
}
}
});
}
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