@@ -96,60 +96,56 @@ void main() {
96
96
expect (actualDecoration.boxShadow, null );
97
97
});
98
98
99
- testWidgets (
100
- 'animations work with curves test' ,
101
- // TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
102
- experimentalLeakTesting: LeakTesting .settings.withTracked (classes: const < String > ['CurvedAnimation' ]),
103
- (WidgetTester tester) async {
104
- final CurvedAnimation animation = CurvedAnimation (
105
- parent: controller,
106
- curve: Curves .easeOut,
107
- );
108
- addTearDown (animation.dispose);
109
- final Animation <Decoration > curvedDecorationAnimation =
110
- decorationTween.animate (animation);
111
-
112
- final DecoratedBoxTransition transitionUnderTest = DecoratedBoxTransition (
113
- decoration: curvedDecorationAnimation,
114
- position: DecorationPosition .foreground,
115
- child: const Text (
116
- "Doesn't matter" ,
117
- textDirection: TextDirection .ltr,
118
- ),
119
- );
120
-
121
- await tester.pumpWidget (transitionUnderTest);
122
-
123
- RenderDecoratedBox actualBox = tester.renderObject (find.byType (DecoratedBox ));
124
- BoxDecoration actualDecoration = actualBox.decoration as BoxDecoration ;
125
-
126
- expect (actualDecoration.color, const Color (0xFFFFFFFF ));
127
- expect (actualDecoration.boxShadow! [0 ].blurRadius, 10.0 );
128
- expect (actualDecoration.boxShadow! [0 ].spreadRadius, 4.0 );
129
- expect (actualDecoration.boxShadow! [0 ].color, const Color (0x66000000 ));
130
-
131
- controller.value = 0.5 ;
132
-
133
- await tester.pump ();
134
- actualBox = tester.renderObject (find.byType (DecoratedBox ));
135
- actualDecoration = actualBox.decoration as BoxDecoration ;
136
-
137
- // Same as the test above but the values should be much closer to the
138
- // tween's end values given the easeOut curve.
139
- expect (actualDecoration.color, const Color (0xFF505050 ));
140
- expect (actualDecoration.border, isA <Border >());
141
- final Border border = actualDecoration.border! as Border ;
142
- expect (border.left.width, moreOrLessEquals (1.9 , epsilon: 0.1 ));
143
- expect (border.left.style, BorderStyle .solid);
144
- expect (border.left.color, const Color (0xFF151515 ));
145
- expect (actualDecoration.borderRadius! .resolve (TextDirection .ltr).topLeft.x, moreOrLessEquals (6.8 , epsilon: 0.1 ));
146
- expect (actualDecoration.shape, BoxShape .rectangle);
147
- expect (actualDecoration.boxShadow! [0 ].blurRadius, moreOrLessEquals (3.1 , epsilon: 0.1 ));
148
- expect (actualDecoration.boxShadow! [0 ].spreadRadius, moreOrLessEquals (1.2 , epsilon: 0.1 ));
149
- // Scaling a shadow doesn't change the color.
150
- expect (actualDecoration.boxShadow! [0 ].color, const Color (0x66000000 ));
151
- },
152
- );
99
+ testWidgets ('animations work with curves test' ,
100
+ // TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
101
+ experimentalLeakTesting: LeakTesting .settings.withTracked (classes: const < String > ['CurvedAnimation' ]),
102
+ (WidgetTester tester) async {
103
+ final Animation <Decoration > curvedDecorationAnimation =
104
+ decorationTween.animate (CurvedAnimation (
105
+ parent: controller,
106
+ curve: Curves .easeOut,
107
+ ));
108
+
109
+ final DecoratedBoxTransition transitionUnderTest = DecoratedBoxTransition (
110
+ decoration: curvedDecorationAnimation,
111
+ position: DecorationPosition .foreground,
112
+ child: const Text (
113
+ "Doesn't matter" ,
114
+ textDirection: TextDirection .ltr,
115
+ ),
116
+ );
117
+
118
+ await tester.pumpWidget (transitionUnderTest);
119
+
120
+ RenderDecoratedBox actualBox = tester.renderObject (find.byType (DecoratedBox ));
121
+ BoxDecoration actualDecoration = actualBox.decoration as BoxDecoration ;
122
+
123
+ expect (actualDecoration.color, const Color (0xFFFFFFFF ));
124
+ expect (actualDecoration.boxShadow! [0 ].blurRadius, 10.0 );
125
+ expect (actualDecoration.boxShadow! [0 ].spreadRadius, 4.0 );
126
+ expect (actualDecoration.boxShadow! [0 ].color, const Color (0x66000000 ));
127
+
128
+ controller.value = 0.5 ;
129
+
130
+ await tester.pump ();
131
+ actualBox = tester.renderObject (find.byType (DecoratedBox ));
132
+ actualDecoration = actualBox.decoration as BoxDecoration ;
133
+
134
+ // Same as the test above but the values should be much closer to the
135
+ // tween's end values given the easeOut curve.
136
+ expect (actualDecoration.color, const Color (0xFF505050 ));
137
+ expect (actualDecoration.border, isA <Border >());
138
+ final Border border = actualDecoration.border! as Border ;
139
+ expect (border.left.width, moreOrLessEquals (1.9 , epsilon: 0.1 ));
140
+ expect (border.left.style, BorderStyle .solid);
141
+ expect (border.left.color, const Color (0xFF151515 ));
142
+ expect (actualDecoration.borderRadius! .resolve (TextDirection .ltr).topLeft.x, moreOrLessEquals (6.8 , epsilon: 0.1 ));
143
+ expect (actualDecoration.shape, BoxShape .rectangle);
144
+ expect (actualDecoration.boxShadow! [0 ].blurRadius, moreOrLessEquals (3.1 , epsilon: 0.1 ));
145
+ expect (actualDecoration.boxShadow! [0 ].spreadRadius, moreOrLessEquals (1.2 , epsilon: 0.1 ));
146
+ // Scaling a shadow doesn't change the color.
147
+ expect (actualDecoration.boxShadow! [0 ].color, const Color (0x66000000 ));
148
+ });
153
149
});
154
150
155
151
testWidgets ('AlignTransition animates' , (WidgetTester tester) async {
0 commit comments