EP-u-NW / painter

A simple flutter widget to paint with your fingers
https://pub.dev/packages/painter
Other
137 stars 66 forks source link

Erasing crashes app on mobile web #38

Open theandrewmack opened 3 years ago

theandrewmack commented 3 years ago

I noticed a crash when attempting to erase in my Flutter web application only on mobile web browsers. I then tested it with the example code from pub.dev and experienced the same behavior.

It appears that paint.blendMode = BlendMode.clear; is the culprit.

One quick workaround I found is to just simulate an erase stroke by painting using the backgroundColor.

if (_eraseMode) {
  paint.blendMode = BlendMode.srcOver;
  paint.color = backgroundColor;
}

However, in my app, my PainterController has backgroundColor = Colors.transparent.

I am not that familiar with different blend modes and if there is another way to achieve my desired result.

theandrewmack commented 2 years ago

I have recently discovered that this issue only happens with the html renderer. Manually setting --web-renderer canvaskit resolves the crash.

flutter run -d chrome --web-renderer canvaskit