🏷 Backport some code improvements from the null-safety branch (#603)

This commit is contained in:
Serge Matveenko
2021-01-09 05:25:29 +03:00
committed by GitHub
parent 5b1988ca36
commit 16eaef3bb1
28 changed files with 168 additions and 149 deletions

View File

@ -121,10 +121,8 @@ class ParallaxLayer {
/// multiplying the [baseVelocity] with the [velocityMultiplier].
ParallaxLayer(
this.parallaxImage, {
this.velocityMultiplier,
}) {
velocityMultiplier ??= Vector2.all(1.0);
}
Vector2 velocityMultiplier,
}) : velocityMultiplier = velocityMultiplier ?? Vector2.all(1.0);
Vector2 currentOffset() => _scroll;
@ -241,10 +239,8 @@ class Parallax {
Parallax(
this.layers, {
this.baseVelocity,
}) {
baseVelocity ??= Vector2.zero();
}
Vector2 baseVelocity,
}) : baseVelocity = baseVelocity ?? Vector2.zero();
/// The base offset of the parallax, can be used in an outer update loop
/// if you want to transition the parallax to a certain position.