apply method
Apply the given progress
level to the effect's target.
Here progress
is a variable that is typically in the range from 0 to 1,
with 0 being the initial state, and 1 the final state of the effect. See
EffectController for details.
This is a main method that MUST be implemented in every derived class.
Implementation
@override
void apply(double progress) {
final deltaProgress = progress - previousProgress;
final currentOpacity = target.opacity + _roundingError;
final deltaOpacity = _opacityOffset * deltaProgress;
final newOpacity = (currentOpacity + deltaOpacity).clamp(0, 1).toDouble();
target.opacity = newOpacity;
_roundingError = newOpacity - target.opacity;
}