Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/web_ui/lib/src/engine/shader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class GradientLinear extends EngineGradient {
}
}

// TODO(flutter_web): Add screenshot tests when infra is ready.
class GradientRadial extends EngineGradient {
GradientRadial(this.center, this.radius, this.colors, this.colorStops,
this.tileMode, this.matrix4)
Expand All @@ -176,7 +177,22 @@ class GradientRadial extends EngineGradient {

@override
Object createPaintStyle(html.CanvasRenderingContext2D ctx) {
throw UnimplementedError();
// TODO(flutter_web): see https://github.com/flutter/flutter/issues/32819
if (matrix4 != null && !Matrix4.fromFloat64List(matrix4).isIdentity()) {
throw UnimplementedError('matrix4 not supported in GradientRadial shader');
}
final html.CanvasGradient gradient =
ctx.createRadialGradient(center.dx, center.dy, 0, center.dx, center.dy, radius);
if (colorStops == null) {
assert(colors.length == 2);
gradient.addColorStop(0, colors[0].toCssString());
gradient.addColorStop(1, colors[1].toCssString());
return gradient;
}
for (int i = 0; i < colors.length; i++) {
gradient.addColorStop(colorStops[i], colors[i].toCssString());
}
return gradient;
}

@override
Expand Down