@@ -2857,6 +2857,50 @@ testWidgets('SnackBarAction backgroundColor works as a Color', (WidgetTester tes
2857
2857
contains ('disabledBackgroundColor must not be provided when background color is a MaterialStateColor' ))
2858
2858
);
2859
2859
});
2860
+
2861
+ testWidgets ('SnackBar material applies SnackBar.clipBehavior' , (WidgetTester tester) async {
2862
+ await tester.pumpWidget (
2863
+ MaterialApp (
2864
+ home: Scaffold (
2865
+ body: Container (),
2866
+ ),
2867
+ ),
2868
+ );
2869
+
2870
+ final ScaffoldMessengerState scaffoldMessengerState = tester.state (find.byType (ScaffoldMessenger ));
2871
+ scaffoldMessengerState.showSnackBar (
2872
+ const SnackBar (content: Text ('I am a snack bar.' )),
2873
+ );
2874
+
2875
+ await tester.pumpAndSettle (); // Have the SnackBar fully animate out.
2876
+
2877
+ Material material = tester.widget <Material >(
2878
+ find.descendant (of: find.byType (SnackBar ),
2879
+ matching: find.byType (Material ))
2880
+ );
2881
+
2882
+ expect (material.clipBehavior, Clip .hardEdge);
2883
+
2884
+ scaffoldMessengerState.hideCurrentSnackBar (); // Hide the SnackBar.
2885
+
2886
+ await tester.pumpAndSettle (); // Have the SnackBar fully animate out.
2887
+
2888
+ scaffoldMessengerState.showSnackBar (
2889
+ const SnackBar (
2890
+ content: Text ('I am a snack bar.' ),
2891
+ clipBehavior: Clip .antiAlias,
2892
+ ),
2893
+ );
2894
+
2895
+ await tester.pumpAndSettle (); // Have the SnackBar fully animate in.
2896
+
2897
+ material = tester.widget <Material >(
2898
+ find.descendant (of: find.byType (SnackBar ),
2899
+ matching: find.byType (Material ))
2900
+ );
2901
+
2902
+ expect (material.clipBehavior, Clip .antiAlias);
2903
+ });
2860
2904
}
2861
2905
2862
2906
/// Start test for "SnackBar dismiss test".
0 commit comments