@@ -16,7 +16,7 @@ void main() {
16
16
// to ease the check on [Rect] later.
17
17
alignment: Alignment .topLeft,
18
18
child: SizedBox (width: 20 , height: 20 ,
19
- child: InsetShadowBox (top: 7 , bottom: 3 ,
19
+ child: InsetShadowBox (top: 7 , bottom: 3 , start : 5 , end : 6 ,
20
20
color: Colors .red,
21
21
child: SizedBox .shrink ())))));
22
22
@@ -42,7 +42,7 @@ void main() {
42
42
};
43
43
}
44
44
45
- testWidgets ('render shadow correctly' , (tester) async {
45
+ testWidgets ('render shadow correctly: top/bottom ' , (tester) async {
46
46
await tester.pumpWidget (const Directionality (
47
47
textDirection: TextDirection .ltr,
48
48
child: Center (
@@ -61,4 +61,33 @@ void main() {
61
61
..something (paintGradient (rect: const Rect .fromLTRB (0 , 100 - 7 , 100 , 100 )))
62
62
) as Matcher );
63
63
});
64
+
65
+ final textDirectionVariant =
66
+ ValueVariant <TextDirection >({TextDirection .ltr, TextDirection .rtl});
67
+
68
+ testWidgets ('render shadow correctly: start/end' , (tester) async {
69
+ final textDirection = textDirectionVariant.currentValue! ;
70
+ await tester.pumpWidget (Directionality (
71
+ textDirection: textDirection,
72
+ child: Center (
73
+ // This would be forced to fill up the screen
74
+ // if not wrapped in a widget like [Center].
75
+ child: SizedBox (width: 100 , height: 100 ,
76
+ child: InsetShadowBox (start: 3 , end: 7 ,
77
+ color: Colors .red,
78
+ child: SizedBox (width: 30 , height: 30 ))))));
79
+
80
+ final box = tester.renderObject (find.byType (InsetShadowBox ));
81
+ check (box).legacyMatcher (
82
+ // The coordinate system of these [Rect]'s is relative to the parent
83
+ // of the [Gradient] from [InsetShadowBox], not the entire [FlutterView].
84
+ switch (textDirection) {
85
+ TextDirection .ltr => paints
86
+ ..something (paintGradient (rect: Rect .fromLTRB (0 , 0 , 0 + 3 , 100 )))
87
+ ..something (paintGradient (rect: Rect .fromLTRB (100 - 7 , 0 , 100 , 100 ))),
88
+ TextDirection .rtl => paints
89
+ ..something (paintGradient (rect: Rect .fromLTRB (100 - 3 , 0 , 100 , 100 )))
90
+ ..something (paintGradient (rect: Rect .fromLTRB (0 , 0 , 0 + 7 , 100 ))),
91
+ } as Matcher );
92
+ }, variant: textDirectionVariant);
64
93
}
0 commit comments