Fix DropdownButton
menu clip (#102970)
This commit is contained in:
parent
90868d3ba3
commit
2f657536c8
@ -286,6 +286,8 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
|
|||||||
namesRoute: true,
|
namesRoute: true,
|
||||||
explicitChildNodes: true,
|
explicitChildNodes: true,
|
||||||
label: localizations.popupMenuLabel,
|
label: localizations.popupMenuLabel,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: widget.borderRadius ?? BorderRadius.zero,
|
||||||
child: Material(
|
child: Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
textStyle: route.style,
|
textStyle: route.style,
|
||||||
@ -314,6 +316,7 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3839,4 +3839,35 @@ void main() {
|
|||||||
expect(tester.getBottomRight(find.text(hintText)).dx, 776.0);
|
expect(tester.getBottomRight(find.text(hintText)).dx, 776.0);
|
||||||
expect(tester.getBottomRight(find.text(hintText)).dy, 350.0);
|
expect(tester.getBottomRight(find.text(hintText)).dy, 350.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('BorderRadius property clips dropdown menu', (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();
|
||||||
|
|
||||||
|
final RenderClipRRect renderClip = tester.allRenderObjects.whereType<RenderClipRRect>().first;
|
||||||
|
expect(renderClip.borderRadius, BorderRadius.circular(radius));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user