From 9bd45f3577621085591685ef707be5233dfa706e Mon Sep 17 00:00:00 2001 From: Craftplacer <22963120+Craftplacer@users.noreply.github.com> Date: Sun, 4 Feb 2024 13:31:52 +0100 Subject: [PATCH] feat: improve pride rendering --- src/kaiteki/lib/ui/pride.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/kaiteki/lib/ui/pride.dart b/src/kaiteki/lib/ui/pride.dart index ff9dbf4d..3e68907d 100644 --- a/src/kaiteki/lib/ui/pride.dart +++ b/src/kaiteki/lib/ui/pride.dart @@ -1,3 +1,4 @@ +import "package:flutter/material.dart"; import "package:flutter/rendering.dart"; enum PrideFlag { @@ -58,6 +59,11 @@ class PridePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { + final rect = Rect.fromLTWH(0, 0, size.width, size.height); + final paint = Paint()..color = Color.fromRGBO(255, 255, 255, opacity); + + canvas.saveLayer(rect, paint); + final stripes = flag.colors; final height = size.height / stripes.length; for (var i = 0; i < stripes.length; i++) { @@ -69,9 +75,11 @@ class PridePainter extends CustomPainter { size.width, (y + height).ceilToDouble(), ), - Paint()..color = stripes[i].withOpacity(opacity), + Paint()..color = stripes[i], ); } + + canvas.restore(); } @override