When drawing lines in AbstractCustomPainter subclass, the behavior of Paint.strokeCap differs from the designated behavior described in the flutter doc, as StrokeCap.round shows a half-painted line cap.
Test Script:
using Unity.UIWidgets.engine;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace FinGameWorks.Scripts.Views.Test
{
public class CurveTestPanel : UIWidgetsPanel
{
protected override Widget createWidget()
{
return new CustomPaint(foregroundPainter:new TestCurveCustomPainter());
}
}
public class TestCurveCustomPainter : AbstractCustomPainter
{
public override void paint(Canvas canvas, Size size)
{
Paint bezierPaint = new Paint
{
style = PaintingStyle.stroke,
color = Color.black,
strokeWidth = 5,
strokeCap = StrokeCap.round,
strokeJoin = StrokeJoin.round
};
Path bezierPath = new Path();
float offset = 60.0f;
bezierPath.moveTo(10, 10);
bezierPath.bezierTo(10 + offset,10,size.width - 10 - offset,size.height-10,size.width - 10,size.height-10);
canvas.drawPath(bezierPath, bezierPaint);
}
public override bool shouldRepaint(CustomPainter oldDelegate)
{
return true;
}
}
}
Environment: Unity 2018.3.11f1, macOS, UIWidgets commit d73cf411752b0ab6e73587b4cc8d46707cb8cc46
When drawing lines in AbstractCustomPainter subclass, the behavior of Paint.strokeCap differs from the designated behavior described in the flutter doc, as StrokeCap.round shows a half-painted line cap.
Test Script:
Test Image:
Notice line caps are not rounded.