Skip to content

Commit

Permalink
Fix DropdownButton Inkwell border radius (#106657)
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaTesser authored Jun 30, 2022
1 parent 427aecc commit 9a3b9f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/flutter/lib/src/material/dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
mouseCursor: effectiveMouseCursor,
onTap: _enabled ? _handleTap : null,
canRequestFocus: _enabled,
borderRadius: widget.borderRadius,
focusNode: focusNode,
autofocus: widget.autofocus,
focusColor: widget.focusColor ?? Theme.of(context).focusColor,
Expand Down
10 changes: 9 additions & 1 deletion packages/flutter/test/material/dropdown_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3810,7 +3810,7 @@ void main() {
expect(tester.getBottomRight(find.text(hintText)).dy, 350.0);
});

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

await tester.pumpWidget(
Expand All @@ -3834,6 +3834,14 @@ void main() {
),
);

final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer();
await gesture.moveTo(tester.getCenter(find.byType(DropdownButtonFormField<String>)));
await tester.pumpAndSettle();

final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
expect(inkFeatures, paints..rrect(rrect: RRect.fromLTRBR(0.0, 276.0, 800.0, 324.0, const Radius.circular(radius))));

await tester.tap(find.text('One'));
await tester.pumpAndSettle();

Expand Down

0 comments on commit 9a3b9f6

Please sign in to comment.