Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
feat: improve pride rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed Feb 4, 2024
1 parent 13f0bb1 commit 9bd45f3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/kaiteki/lib/ui/pride.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "package:flutter/material.dart";
import "package:flutter/rendering.dart";

enum PrideFlag {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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
Expand Down

0 comments on commit 9bd45f3

Please sign in to comment.