Reputation: 260
If I want to give a background color to my canvas , I use the below code :
Paint redPaint = new Paint()
..color = Colors.red
..style = PaintingStyle.fill;
canvas.drawPaint(redPaint);
And I found the other method is canvas.drawColor(Color , BlendMode), but it looks like not what I expected .
canvas.drawColor(Colors.red, BlendMode.color)
or
canvas.drawColor(Colors.red, BlendMode.clear)
Does it mean that I can not use canvas.drawColor() to give canvas a background color ?
Upvotes: 2
Views: 3038
Reputation: 2460
If you want only your source color, ie no blending than use BlendMode.src
.
You can learn about all the available blend modes here: https://api.flutter.dev/flutter/dart-ui/BlendMode-class.html
Upvotes: 3