This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user