fix(ui_components): fix MultiColor lerp method

This commit is contained in:
Malo Léon 2023-02-21 13:27:19 +01:00
parent 6537945946
commit 25224469b5

View File

@ -64,12 +64,15 @@ class MultiColor {
);
} else if (a.isGradient && b.isGradient) {
final colors = List<Color>.empty(growable: true);
for (int i = 0; i < a.colors.length; i++) {
final shortestList =
(a.colors.length > b.colors.length) ? b.colors : a.colors;
for (int i = 0; i < shortestList.length; i++) {
final lerpColor = Color.lerp(a.colors[i], b.colors[i], t);
if (lerpColor != null) {
colors.add(lerpColor);
}
}
return MultiColor(colors);
}
return b;
}