StrokeCap.round looks distorted and crashes on physical devices. Working fine on virtual device

ForumCategory: QuestionsStrokeCap.round looks distorted and crashes on physical devices. Working fine on virtual device
CodingCat asked 5 years ago

Hello,
I’ve been struggling with an annoying problem recently. Whenever I run my signature app on a real device StrokeCap.round causes the drawn lines to morph and distort. After several lines the app crashes. This however does not happen on a Virtual Device.
Using StrokeCap.butt solves the problem. But it’s still a pity I can’t use the round one.
Especially since the Signature class (package:flutter_signature_pad) does not allow me to change the StrokeCap (I think). 
 

Example with CustomPainter:
class Signature extends CustomPainter
{
List<Offset> points;
Signature({this.points});

@override

void paint(Canvas canvas, Size size)
{
Paint paint = new Paint()
..color = Color(0xFF00FFFF)
..strokeWidth = 5.0
..strokeCap = StrokeCap.round; //causes problems on physical devices


for(int i = 0; i < points.length-1; i++)
{
if(points[i] != null && points[i+1] != null)
{
canvas.drawLine(points[i], points[i+1], paint);
}
}
}

@override
bool shouldRepaint(Signature oldDelegate) => oldDelegate.points != points;
}

Example with Signature:

class SignatureState extends State<XSignature>
{
Widget build(BuildContext context)
{
return SIG.Signature(
color: Color(0xFF00FFFF),
strokeWidth: 7.5,
backgroundPainter: null,
onSign: null,
key: null,
);
}
}

 
Crash log:

D/libGLESv2(13102): STS_GLApi : DTS, ODTC are not allowed for Package : x.pdf_zeug
D/ViewRootImpl@68830b[MainActivity](13102): ViewPostIme pointer 0
I/zygote (13102): Do partial code cache collection, code=31KB, data=29KB
I/zygote (13102): After code cache collection, code=31KB, data=29KB
I/zygote (13102): Increasing code cache capacity to 128KB
D/ViewRootImpl@68830b[MainActivity](13102): ViewPostIme pointer 1
D/ViewRootImpl@68830b[MainActivity](13102): ViewPostIme pointer 0
I/zygote (13102): Do partial code cache collection, code=62KB, data=47KB
I/zygote (13102): After code cache collection, code=62KB, data=47KB
I/zygote (13102): Increasing code cache capacity to 256KB
F/libc (13102): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe616ffd0 in tid 13121 (1.gpu), pid 13102 (x.pdf_zeug)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: ‘samsung/gtaxlwifixx/gtaxlwifi:8.1.0/M1AJQ/T580XXU4CSA1:user/release-keys’
Revision: ‘6’
ABI: ‘arm’
pid: 13102, tid: 13121, name: 1.gpu >>> x.pdf_zeug <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe616ffd0
r0 c7bc3500 r1 e616ffd0 r2 00000010 r3 00000000
r4 e616ffd0 r5 00000001 r6 e6170000 r7 c7bc3500
r8 00000004 r9 befcf330 sl ffffffff fp 00000000
ip e88db5c8 sp c7bc34c0 lr c82fd229 pc e8862f2c cpsr 200e0010
backtrace:
#00 pc 00018f2c /system/lib/libc.so (memcpy+132)
#01 pc 0063b225 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#02 pc 00636d89 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#03 pc 0063f375 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#04 pc 005d1cb5 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#05 pc 005d234b /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#06 pc 005e04bf /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#07 pc 007039c9 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#08 pc 00523219 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#09 pc 0051daf5 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#10 pc 0051ddc9 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#11 pc 0051df55 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#12 pc 0051dcd9 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#13 pc 0051de99 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#14 pc 004fad99 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#15 pc 004fc295 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#16 pc 00010255 /system/lib/libutils.so (android::Looper::pollInner(int)+576)
#17 pc 0000ff7d /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+32)
#18 pc 0000c543 /system/lib/libandroid.so (ALooper_pollOnce+50)
#19 pc 004fc32f /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#20 pc 004f9f37 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#21 pc 004fb169 /data/app/x.pdf_zeug-5gNWwzjAPEUDmBOYz-6PQA==/lib/arm/libflutter.so (offset 0x4cb000)
#22 pc 00048811 /system/lib/libc.so (__pthread_start(void*)+24)
#23 pc 0001b369 /system/lib/libc.so (__start_thread+32)
Lost connection to device.