refactor!: Replace Offset with opacityFrom and opacityTo in ColorEffect (#2876)

`ColorEffect`'s API was a bit confusing because it used `Offset` for
getting values of opacity start and end from user. This PR changes that
to use optional `opacityFrom` and `opacityTo` double parameters. It also
adds validate checks on these value to make sure that are between 0 and
1.
This commit is contained in:
DevKage
2023-11-27 18:51:18 +05:30
committed by GitHub
parent f4ff31174a
commit 0fd2662d4b
7 changed files with 69 additions and 16 deletions

View File

@ -69,11 +69,11 @@ class CollidableEmber extends Ember with CollisionCallbacks {
add(
ColorEffect(
index < 2 ? Colors.red : Colors.green,
const Offset(0, 0.9),
EffectController(
duration: 0.2,
alternate: true,
),
opacityTo: 0.9,
),
);
}