Unverified Commit 18e36dcb authored by Taha Tesser's avatar Taha Tesser Committed by GitHub
parent 4dbeb3fb
......@@ -728,6 +728,7 @@ class _SnackBarState extends State<SnackBar> {
shape: shape,
elevation: elevation,
color: backgroundColor,
clipBehavior: widget.clipBehavior,
child: Theme(
data: effectiveTheme,
child: accessibleNavigation || theme.useMaterial3
......
......@@ -2857,6 +2857,50 @@ testWidgets('SnackBarAction backgroundColor works as a Color', (WidgetTester tes
contains('disabledBackgroundColor must not be provided when background color is a MaterialStateColor'))
);
});
testWidgets('SnackBar material applies SnackBar.clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Container(),
),
),
);
final ScaffoldMessengerState scaffoldMessengerState = tester.state(find.byType(ScaffoldMessenger));
scaffoldMessengerState.showSnackBar(
const SnackBar(content: Text('I am a snack bar.')),
);
await tester.pumpAndSettle(); // Have the SnackBar fully animate out.
Material material = tester.widget<Material>(
find.descendant(of: find.byType(SnackBar),
matching: find.byType(Material))
);
expect(material.clipBehavior, Clip.hardEdge);
scaffoldMessengerState.hideCurrentSnackBar(); // Hide the SnackBar.
await tester.pumpAndSettle(); // Have the SnackBar fully animate out.
scaffoldMessengerState.showSnackBar(
const SnackBar(
content: Text('I am a snack bar.'),
clipBehavior: Clip.antiAlias,
),
);
await tester.pumpAndSettle(); // Have the SnackBar fully animate in.
material = tester.widget<Material>(
find.descendant(of: find.byType(SnackBar),
matching: find.byType(Material))
);
expect(material.clipBehavior, Clip.antiAlias);
});
}
/// Start test for "SnackBar dismiss test".
......
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