@@ -215,13 +215,7 @@ public override void dispose() {
215
215
}
216
216
217
217
public bool _shouldAnimateTween < T2 > ( Tween < T2 > tween , T2 targetValue ) {
218
- var curTargetValue = tween . end ;
219
-
220
- if ( tween . end == null || typeof ( T2 ) == typeof ( float ) &&
221
- ( float ) Convert . ChangeType ( tween . end , typeof ( float ) ) == - 1.0f ) {
222
- curTargetValue = tween . begin ;
223
- }
224
- return ! targetValue . Equals ( curTargetValue ) ;
218
+ return ! targetValue . Equals ( tween . end != null ? tween . end : tween . begin ) ;
225
219
}
226
220
227
221
public void _updateTween < T2 > ( Tween < T2 > tween , T2 targetValue ) {
@@ -472,16 +466,18 @@ public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
472
466
}
473
467
474
468
class _AnimatedOpacityState : ImplicitlyAnimatedWidgetState < AnimatedOpacity > {
475
- FloatTween _opacity ;
469
+ NullableFloatTween _opacity ;
476
470
Animation < float > _opacityAnimation ;
477
471
478
472
protected override void forEachTween ( TweenVisitor visitor ) {
479
- this . _opacity = ( FloatTween ) visitor . visit ( this , this . _opacity , this . widget . opacity ,
480
- ( float value ) => new FloatTween ( begin : value , end : - 1.0f ) ) ;
473
+ this . _opacity = ( NullableFloatTween ) visitor . visit ( this , this . _opacity , this . widget . opacity ,
474
+ ( float ? value ) => new NullableFloatTween ( begin : value ) ) ;
481
475
}
482
476
483
477
protected override void didUpdateTweens ( ) {
484
- this . _opacityAnimation = this . animation . drive ( this . _opacity ) ;
478
+ float ? endValue = this . _opacity . end ?? this . _opacity . begin ?? null ;
479
+ D . assert ( endValue != null ) ;
480
+ this . _opacityAnimation = this . animation . drive ( new FloatTween ( begin : this . _opacity . begin . Value , end : endValue . Value ) ) ;
485
481
}
486
482
487
483
public override Widget build ( BuildContext context ) {
0 commit comments