Skip to content

Commit e8f8a82

Browse files
authored
Revert "Fix DropdownButton menu clip" (#104203)
1 parent 24bd28f commit e8f8a82

File tree

2 files changed

+21
-55
lines changed

2 files changed

+21
-55
lines changed

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

+21-24
Original file line numberDiff line numberDiff line change
@@ -286,30 +286,27 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
286286
namesRoute: true,
287287
explicitChildNodes: true,
288288
label: localizations.popupMenuLabel,
289-
child: ClipRRect(
290-
borderRadius: widget.borderRadius ?? BorderRadius.zero,
291-
child: Material(
292-
type: MaterialType.transparency,
293-
textStyle: route.style,
294-
child: ScrollConfiguration(
295-
// Dropdown menus should never overscroll or display an overscroll indicator.
296-
// Scrollbars are built-in below.
297-
// Platform must use Theme and ScrollPhysics must be Clamping.
298-
behavior: ScrollConfiguration.of(context).copyWith(
299-
scrollbars: false,
300-
overscroll: false,
301-
physics: const ClampingScrollPhysics(),
302-
platform: Theme.of(context).platform,
303-
),
304-
child: PrimaryScrollController(
305-
controller: widget.route.scrollController!,
306-
child: Scrollbar(
307-
thumbVisibility: true,
308-
child: ListView(
309-
padding: kMaterialListPadding,
310-
shrinkWrap: true,
311-
children: children,
312-
),
289+
child: Material(
290+
type: MaterialType.transparency,
291+
textStyle: route.style,
292+
child: ScrollConfiguration(
293+
// Dropdown menus should never overscroll or display an overscroll indicator.
294+
// Scrollbars are built-in below.
295+
// Platform must use Theme and ScrollPhysics must be Clamping.
296+
behavior: ScrollConfiguration.of(context).copyWith(
297+
scrollbars: false,
298+
overscroll: false,
299+
physics: const ClampingScrollPhysics(),
300+
platform: Theme.of(context).platform,
301+
),
302+
child: PrimaryScrollController(
303+
controller: widget.route.scrollController!,
304+
child: Scrollbar(
305+
thumbVisibility: true,
306+
child: ListView(
307+
padding: kMaterialListPadding,
308+
shrinkWrap: true,
309+
children: children,
313310
),
314311
),
315312
),

packages/flutter/test/material/dropdown_test.dart

-31
Original file line numberDiff line numberDiff line change
@@ -3839,35 +3839,4 @@ void main() {
38393839
expect(tester.getBottomRight(find.text(hintText)).dx, 776.0);
38403840
expect(tester.getBottomRight(find.text(hintText)).dy, 350.0);
38413841
});
3842-
3843-
testWidgets('BorderRadius property clips dropdown menu', (WidgetTester tester) async {
3844-
const double radius = 20.0;
3845-
3846-
await tester.pumpWidget(
3847-
MaterialApp(
3848-
home: Scaffold(
3849-
body: Center(
3850-
child: DropdownButtonFormField<String>(
3851-
borderRadius: BorderRadius.circular(radius),
3852-
value: 'One',
3853-
items: <String>['One', 'Two', 'Three', 'Four']
3854-
.map<DropdownMenuItem<String>>((String value) {
3855-
return DropdownMenuItem<String>(
3856-
value: value,
3857-
child: Text(value),
3858-
);
3859-
}).toList(),
3860-
onChanged: (_) { },
3861-
),
3862-
),
3863-
),
3864-
),
3865-
);
3866-
3867-
await tester.tap(find.text('One'));
3868-
await tester.pumpAndSettle();
3869-
3870-
final RenderClipRRect renderClip = tester.allRenderObjects.whereType<RenderClipRRect>().first;
3871-
expect(renderClip.borderRadius, BorderRadius.circular(radius));
3872-
});
38733842
}

0 commit comments

Comments
 (0)