Skip to content

Commit 9a3b9f6

Browse files
authored
Fix DropdownButton Inkwell border radius (#106657)
1 parent 427aecc commit 9a3b9f6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/flutter/lib/src/material/dropdown.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
15091509
mouseCursor: effectiveMouseCursor,
15101510
onTap: _enabled ? _handleTap : null,
15111511
canRequestFocus: _enabled,
1512+
borderRadius: widget.borderRadius,
15121513
focusNode: focusNode,
15131514
autofocus: widget.autofocus,
15141515
focusColor: widget.focusColor ?? Theme.of(context).focusColor,

packages/flutter/test/material/dropdown_test.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3810,7 +3810,7 @@ void main() {
38103810
expect(tester.getBottomRight(find.text(hintText)).dy, 350.0);
38113811
});
38123812

3813-
testWidgets('BorderRadius property clips dropdown menu', (WidgetTester tester) async {
3813+
testWidgets('BorderRadius property clips dropdown button and dropdown menu', (WidgetTester tester) async {
38143814
const double radius = 20.0;
38153815

38163816
await tester.pumpWidget(
@@ -3834,6 +3834,14 @@ void main() {
38343834
),
38353835
);
38363836

3837+
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
3838+
await gesture.addPointer();
3839+
await gesture.moveTo(tester.getCenter(find.byType(DropdownButtonFormField<String>)));
3840+
await tester.pumpAndSettle();
3841+
3842+
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
3843+
expect(inkFeatures, paints..rrect(rrect: RRect.fromLTRBR(0.0, 276.0, 800.0, 324.0, const Radius.circular(radius))));
3844+
38373845
await tester.tap(find.text('One'));
38383846
await tester.pumpAndSettle();
38393847

0 commit comments

Comments
 (0)