Unverified Commit 500a3324 authored by Dheeraj Verma's avatar Dheeraj Verma Committed by GitHub

[DropdownButtonFormField] Add borderRadius property (#95944)

parent 99bf2e9b
...@@ -1540,6 +1540,9 @@ class DropdownButtonFormField<T> extends FormField<T> { ...@@ -1540,6 +1540,9 @@ class DropdownButtonFormField<T> extends FormField<T> {
double? menuMaxHeight, double? menuMaxHeight,
bool? enableFeedback, bool? enableFeedback,
AlignmentGeometry alignment = AlignmentDirectional.centerStart, AlignmentGeometry alignment = AlignmentDirectional.centerStart,
BorderRadius? borderRadius,
// When adding new arguments, consider adding similar arguments to
// DropdownButton.
}) : assert(items == null || items.isEmpty || value == null || }) : assert(items == null || items.isEmpty || value == null ||
items.where((DropdownMenuItem<T> item) { items.where((DropdownMenuItem<T> item) {
return item.value == value; return item.value == value;
...@@ -1615,6 +1618,7 @@ class DropdownButtonFormField<T> extends FormField<T> { ...@@ -1615,6 +1618,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
menuMaxHeight: menuMaxHeight, menuMaxHeight: menuMaxHeight,
enableFeedback: enableFeedback, enableFeedback: enableFeedback,
alignment: alignment, alignment: alignment,
borderRadius: borderRadius,
), ),
), ),
); );
......
...@@ -3678,4 +3678,51 @@ void main() { ...@@ -3678,4 +3678,51 @@ void main() {
expect(tester.takeException(), null); expect(tester.takeException(), null);
}); });
testWidgets('BorderRadius property works properly for DropdownButtonFormField', (WidgetTester tester) async {
const double radius = 20.0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: DropdownButtonFormField<String>(
borderRadius: BorderRadius.circular(radius),
value: 'One',
items: <String>['One', 'Two', 'Three', 'Four']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (_) { },
),
),
),
),
);
await tester.tap(find.text('One'));
await tester.pumpAndSettle();
expect(
find.ancestor(
of: find.text('One').last,
matching: find.byType(CustomPaint),
).at(2),
paints
..save()
..rrect()
..rrect()
..rrect()
..rrect(rrect: const RRect.fromLTRBXY(0.0, 0.0, 800.0, 208.0, radius, radius)),
);
final InkWell firstItem = tester.widget(find.widgetWithText(InkWell, 'One'));
final InkWell lastItem = tester.widget(find.widgetWithText(InkWell, 'Four'));
expect(firstItem.borderRadius, const BorderRadius.vertical(top: Radius.circular(radius)));
expect(lastItem.borderRadius, const BorderRadius.vertical(bottom: Radius.circular(radius)));
});
} }
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