Implementation
set tileDisplay(TileDisplay newTileDisplay) {
final oldTileDisplay = _display;
_display = newTileDisplay;
// Handle disabling/enabling of animation controller if necessary
oldTileDisplay.when(
instantaneous: (instantaneous) {
newTileDisplay.when(
fadeIn: (fadeIn) {
// Became animated.
_animationController = AnimationController(
duration: fadeIn.duration,
vsync: vsync,
value: _active ? 1.0 : 0.0,
);
},
);
},
fadeIn: (fadeIn) {
newTileDisplay.when(instantaneous: (instantaneous) {
// No longer animated.
_animationController!.dispose();
_animationController = null;
}, fadeIn: (fadeIn) {
// Still animated with different fade.
_animationController!.duration = fadeIn.duration;
});
},
);
if (!_disposed) notifyListeners();
}