void _startFadeOut() { this._controller.duration = TimeSpan.FromMilliseconds(300); this._animation = new CurvedAnimation( parent: this._controller, curve: Curves.easeOut ); this._phase = CachedImagePhase.fadeOut; this._controller.reverse(1.0f); }
void _startFadeIn() { this._controller.duration = TimeSpan.FromMilliseconds(700); this._animation = new CurvedAnimation( parent: this._controller, curve: Curves.easeIn ); this._phase = CachedImagePhase.fadeIn; this._controller.forward(0.0f); }
void _updatePhase() { this.setState(() => { switch (this._phase) { case CachedImagePhase.start: this._phase = this._imageResolver._imageInfo != null ? CachedImagePhase.completed : CachedImagePhase.waiting; break; case CachedImagePhase.waiting: if (this._imageResolver._imageInfo != null) { if (this.widget.placeholder == null) { this._startFadeIn(); } else { this._startFadeOut(); } } break; case CachedImagePhase.fadeOut: if (this._controller.status == AnimationStatus.dismissed) { this._startFadeIn(); } break; case CachedImagePhase.fadeIn: if (this._controller.status == AnimationStatus.completed) { this._phase = CachedImagePhase.completed; } break; case CachedImagePhase.completed: break; } if (this._imageResolver._imageInfo != null) { this.widget.onImageResolved?.Invoke(imageInfo: this._imageResolver._imageInfo); } }); }