常规Paint
对象似乎并没有改变使用drawVertices
绘制的线条的外观。这是我尝试过的。
// Doesn't do anything
var brush = Paint()..color = Colors.blue..strokeWidth = 4..style = PaintingStyle.stroke;
// The only shaders I've found are UI.Gradient and UI.ImageShader
brush = brush..shader = UI.Gradient.linear(
Offset(0, 0),
// absurd numbers
Offset(10000, 10000),
[Colors.blue, Colors.blue],
);
canvas.drawVertices(
UI.Vertices.raw(
VertexMode.triangleStrip,
storage,
// This will change the colors of the faces not the lines
// colors: _encodeColorList(storageCount.map((_) => Colors.white).toList())
),
BlendMode.dstIn,
brush,
);
// Copied from dart:ui
Int32List _encodeColorList(List<Color> colors) {
final int colorCount = colors.length;
final Int32List result = Int32List(colorCount);
for (int i = 0; i < colorCount; ++i) result[i] = colors[i].value;
return result;
}
线条颜色始终为黑色:
编辑:
这可能是框架错误。这是Github issue for reference。