@@ -144,6 +144,15 @@ double getOpacity(WidgetTester tester, String textValue) {
144144  return  opacityWidget.opacity.value;
145145}
146146
147+ double  getStaticOpacity (WidgetTester  tester, String  textValue) {
148+   return  tester.widget <Opacity >(
149+     find.ancestor (
150+       of:  find.text (textValue),
151+       matching:  find.byType (Opacity ),
152+     ).first,
153+   ).opacity;
154+ }
155+ 
147156void  main () {
148157  testWidgets ('InputDecorator input/label text layout' , (WidgetTester  tester) async  {
149158    // The label appears above the input text 
@@ -963,7 +972,7 @@ void main() {
963972    expect (tester.getBottomLeft (find.text ('text' )).dy, 44.0 );
964973    expect (tester.getTopLeft (find.text ('label' )).dy, 20.0 );
965974    expect (tester.getBottomLeft (find.text ('label' )).dy, 36.0 );
966-     expect (getOpacity (tester, 'hint' ), 0.0 );
975+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
967976    expect (getBorderBottom (tester), 56.0 );
968977    expect (getBorderWeight (tester), 1.0 );
969978
@@ -979,17 +988,6 @@ void main() {
979988      ),
980989    );
981990
982-     // The hint's opacity animates from 0.0 to 1.0. 
983-     // The animation's duration is 200ms. 
984-     {
985-       await  tester.pump (const  Duration (milliseconds:  50 ));
986-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
987-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
988-       await  tester.pump (const  Duration (milliseconds:  50 ));
989-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
990-       expect (hintOpacity100ms, inExclusiveRange (hintOpacity50ms, 1.0 ));
991-     }
992- 
993991    await  tester.pumpAndSettle ();
994992    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 56.0 ));
995993    expect (tester.getTopLeft (find.text ('text' )).dy, 28.0 );
@@ -998,7 +996,7 @@ void main() {
998996    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
999997    expect (tester.getTopLeft (find.text ('hint' )).dy, 28.0 );
1000998    expect (tester.getBottomLeft (find.text ('hint' )).dy, 44.0 );
1001-     expect (getOpacity (tester, 'hint' ), 1.0 );
999+     expect (getStaticOpacity (tester, 'hint' ), 1.0 );
10021000    expect (getBorderBottom (tester), 56.0 );
10031001    expect (getBorderWeight (tester), 2.0 );
10041002
@@ -1012,17 +1010,6 @@ void main() {
10121010      ),
10131011    );
10141012
1015-     // The hint's opacity animates from 1.0 to 0.0. 
1016-     // The animation's duration is 200ms. 
1017-     {
1018-       await  tester.pump (const  Duration (milliseconds:  50 ));
1019-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
1020-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
1021-       await  tester.pump (const  Duration (milliseconds:  50 ));
1022-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
1023-       expect (hintOpacity100ms, inExclusiveRange (0.0 , hintOpacity50ms));
1024-     }
1025- 
10261013    await  tester.pumpAndSettle ();
10271014    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 56.0 ));
10281015    expect (tester.getTopLeft (find.text ('text' )).dy, 28.0 );
@@ -1031,7 +1018,7 @@ void main() {
10311018    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
10321019    expect (tester.getTopLeft (find.text ('hint' )).dy, 28.0 );
10331020    expect (tester.getBottomLeft (find.text ('hint' )).dy, 44.0 );
1034-     expect (getOpacity (tester, 'hint' ), 0.0 );
1021+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
10351022    expect (getBorderBottom (tester), 56.0 );
10361023    expect (getBorderWeight (tester), 2.0 );
10371024  });
@@ -1071,7 +1058,7 @@ void main() {
10711058    expect (tester.getBottomLeft (find.text ('text' )).dy, 40.0 );
10721059    expect (tester.getTopLeft (find.text ('label' )).dy, 16.0 );
10731060    expect (tester.getBottomLeft (find.text ('label' )).dy, 32.0 );
1074-     expect (getOpacity (tester, 'hint' ), 0.0 );
1061+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
10751062    expect (getBorderBottom (tester), 48.0 );
10761063    expect (getBorderWeight (tester), 1.0 );
10771064
@@ -1093,7 +1080,7 @@ void main() {
10931080    expect (tester.getBottomLeft (find.text ('text' )).dy, 40.0 );
10941081    expect (tester.getTopLeft (find.text ('label' )).dy, 8.0 );
10951082    expect (tester.getBottomLeft (find.text ('label' )).dy, 20.0 );
1096-     expect (getOpacity (tester, 'hint' ), 1.0 );
1083+     expect (getStaticOpacity (tester, 'hint' ), 1.0 );
10971084    expect (getBorderBottom (tester), 48.0 );
10981085    expect (getBorderWeight (tester), 2.0 );
10991086  });
@@ -1868,7 +1855,7 @@ void main() {
18681855    expect (tester.getBottomLeft (find.text ('text' )).dy, 40.0 );
18691856    expect (tester.getTopLeft (find.text ('label' )).dy, 16.0 );
18701857    expect (tester.getBottomLeft (find.text ('label' )).dy, 32.0 );
1871-     expect (getOpacity (tester, 'hint' ), 0.0 );
1858+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
18721859    expect (getBorderBottom (tester), 48.0 );
18731860    expect (getBorderWeight (tester), 1.0 );
18741861
@@ -1885,17 +1872,6 @@ void main() {
18851872      ),
18861873    );
18871874
1888-     // The hint's opacity animates from 0.0 to 1.0. 
1889-     // The animation's duration is 200ms. 
1890-     {
1891-       await  tester.pump (const  Duration (milliseconds:  50 ));
1892-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
1893-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
1894-       await  tester.pump (const  Duration (milliseconds:  50 ));
1895-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
1896-       expect (hintOpacity100ms, inExclusiveRange (hintOpacity50ms, 1.0 ));
1897-     }
1898- 
18991875    await  tester.pumpAndSettle ();
19001876    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 48.0 ));
19011877    expect (tester.getTopLeft (find.text ('text' )).dy, 24.0 );
@@ -1904,7 +1880,7 @@ void main() {
19041880    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
19051881    expect (tester.getTopLeft (find.text ('hint' )).dy, 24.0 );
19061882    expect (tester.getBottomLeft (find.text ('hint' )).dy, 40.0 );
1907-     expect (getOpacity (tester, 'hint' ), 1.0 );
1883+     expect (getStaticOpacity (tester, 'hint' ), 1.0 );
19081884    expect (getBorderBottom (tester), 48.0 );
19091885    expect (getBorderWeight (tester), 2.0 );
19101886
@@ -1919,17 +1895,6 @@ void main() {
19191895      ),
19201896    );
19211897
1922-     // The hint's opacity animates from 1.0 to 0.0. 
1923-     // The animation's duration is 200ms. 
1924-     {
1925-       await  tester.pump (const  Duration (milliseconds:  50 ));
1926-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
1927-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
1928-       await  tester.pump (const  Duration (milliseconds:  50 ));
1929-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
1930-       expect (hintOpacity100ms, inExclusiveRange (0.0 , hintOpacity50ms));
1931-     }
1932- 
19331898    await  tester.pumpAndSettle ();
19341899    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 48.0 ));
19351900    expect (tester.getTopLeft (find.text ('text' )).dy, 24.0 );
@@ -1938,7 +1903,7 @@ void main() {
19381903    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
19391904    expect (tester.getTopLeft (find.text ('hint' )).dy, 24.0 );
19401905    expect (tester.getBottomLeft (find.text ('hint' )).dy, 40.0 );
1941-     expect (getOpacity (tester, 'hint' ), 0.0 );
1906+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
19421907    expect (getBorderBottom (tester), 48.0 );
19431908    expect (getBorderWeight (tester), 2.0 );
19441909  });
@@ -1962,7 +1927,7 @@ void main() {
19621927    expect (tester.getBottomLeft (find.text ('text' )).dy, 48.0 );
19631928    expect (tester.getTopLeft (find.text ('label' )).dy, 24.0 );
19641929    expect (tester.getBottomLeft (find.text ('label' )).dy, 40.0 );
1965-     expect (getOpacity (tester, 'hint' ), 0.0 );
1930+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
19661931    expect (getBorderBottom (tester), 64.0 );
19671932    expect (getBorderWeight (tester), 1.0 );
19681933
@@ -1979,17 +1944,6 @@ void main() {
19791944      ),
19801945    );
19811946
1982-     // The hint's opacity animates from 0.0 to 1.0. 
1983-     // The animation's duration is 200ms. 
1984-     {
1985-       await  tester.pump (const  Duration (milliseconds:  50 ));
1986-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
1987-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
1988-       await  tester.pump (const  Duration (milliseconds:  50 ));
1989-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
1990-       expect (hintOpacity100ms, inExclusiveRange (hintOpacity50ms, 1.0 ));
1991-     }
1992- 
19931947    await  tester.pumpAndSettle ();
19941948    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 64.0 ));
19951949    expect (tester.getTopLeft (find.text ('text' )).dy, 32.0 );
@@ -1998,7 +1952,7 @@ void main() {
19981952    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
19991953    expect (tester.getTopLeft (find.text ('hint' )).dy, 32.0 );
20001954    expect (tester.getBottomLeft (find.text ('hint' )).dy, 48.0 );
2001-     expect (getOpacity (tester, 'hint' ), 1.0 );
1955+     expect (getStaticOpacity (tester, 'hint' ), 1.0 );
20021956    expect (getBorderBottom (tester), 64.0 );
20031957    expect (getBorderWeight (tester), 2.0 );
20041958
@@ -2013,17 +1967,6 @@ void main() {
20131967      ),
20141968    );
20151969
2016-     // The hint's opacity animates from 1.0 to 0.0. 
2017-     // The animation's duration is 200ms. 
2018-     {
2019-       await  tester.pump (const  Duration (milliseconds:  50 ));
2020-       final  double  hintOpacity50ms =  getOpacity (tester, 'hint' );
2021-       expect (hintOpacity50ms, inExclusiveRange (0.0 , 1.0 ));
2022-       await  tester.pump (const  Duration (milliseconds:  50 ));
2023-       final  double  hintOpacity100ms =  getOpacity (tester, 'hint' );
2024-       expect (hintOpacity100ms, inExclusiveRange (0.0 , hintOpacity50ms));
2025-     }
2026- 
20271970    await  tester.pumpAndSettle ();
20281971    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 64.0 ));
20291972    expect (tester.getTopLeft (find.text ('text' )).dy, 32.0 );
@@ -2032,7 +1975,7 @@ void main() {
20321975    expect (tester.getBottomLeft (find.text ('label' )).dy, 24.0 );
20331976    expect (tester.getTopLeft (find.text ('hint' )).dy, 32.0 );
20341977    expect (tester.getBottomLeft (find.text ('hint' )).dy, 48.0 );
2035-     expect (getOpacity (tester, 'hint' ), 0.0 );
1978+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
20361979    expect (getBorderBottom (tester), 64.0 );
20371980    expect (getBorderWeight (tester), 2.0 );
20381981  });
@@ -3270,7 +3213,7 @@ void main() {
32703213    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 18.0 ));
32713214    expect (tester.getSize (find.text ('text' )).height, 16.0 );
32723215    expect (tester.getTopLeft (find.text ('text' )).dy, 1.0 );
3273-     expect (getOpacity (tester, 'hint' ), 0.0 );
3216+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
32743217    expect (getBorderWeight (tester), 1.0 );
32753218
32763219    await  tester.pumpWidget (
@@ -3293,7 +3236,7 @@ void main() {
32933236    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 16.0 ));
32943237    expect (tester.getSize (find.text ('text' )).height, 16.0 );
32953238    expect (tester.getTopLeft (find.text ('text' )).dy, 0.0 );
3296-     expect (getOpacity (tester, 'hint' ), 0.0 );
3239+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
32973240    expect (getBorderWeight (tester), 1.0 );
32983241
32993242    await  tester.pumpWidget (
@@ -3315,7 +3258,7 @@ void main() {
33153258    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , kMinInteractiveDimension));
33163259    expect (tester.getSize (find.text ('text' )).height, 16.0 );
33173260    expect (tester.getTopLeft (find.text ('text' )).dy, 16.0 );
3318-     expect (getOpacity (tester, 'hint' ), 0.0 );
3261+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
33193262    expect (getBorderWeight (tester), 0.0 );
33203263  });
33213264
@@ -3337,7 +3280,7 @@ void main() {
33373280    expect (tester.getSize (find.byType (InputDecorator )), const  Size (800.0 , 16.0 ));
33383281    expect (tester.getSize (find.text ('text' )).height, 16.0 );
33393282    expect (tester.getTopLeft (find.text ('text' )).dy, 0.0 );
3340-     expect (getOpacity (tester, 'hint' ), 0.0 );
3283+     expect (getStaticOpacity (tester, 'hint' ), 0.0 );
33413284    expect (getBorderWeight (tester), 0.0 );
33423285
33433286    // The hint should appear 
@@ -5083,7 +5026,7 @@ void main() {
50835026    );
50845027    await  tester.pumpAndSettle ();
50855028
5086-     expect (getOpacity (tester, 'hint' ), 1.0 );
5029+     expect (getStaticOpacity (tester, 'hint' ), 1.0 );
50875030  });
50885031
50895032  testWidgets ('InputDecorator floating label width scales when focused' , (WidgetTester  tester) async  {
0 commit comments