From 90e6baaa865f2302dad74084a259290c9154251e Mon Sep 17 00:00:00 2001 From: Elias Date: Thu, 8 Feb 2024 15:16:22 +0100 Subject: [PATCH] fix(rectangle_waveform): active waveform painter not rounding the same as inactive painter --- .../rectangle_waveform/active_waveform_painter.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/src/waveforms/rectangle_waveform/active_waveform_painter.dart b/lib/src/waveforms/rectangle_waveform/active_waveform_painter.dart index b263c62..3fe6799 100644 --- a/lib/src/waveforms/rectangle_waveform/active_waveform_painter.dart +++ b/lib/src/waveforms/rectangle_waveform/active_waveform_painter.dart @@ -100,6 +100,7 @@ class RectangleActiveWaveformPainter extends ActiveWaveformPainter { WaveformAlignment waveformAlignment, bool isCentered, ) { + final radius = Radius.circular(sampleWidth); for (var i = 0; i < activeSamples.length; i++) { if (i.isEven) { final x = sampleWidth * i; @@ -114,21 +115,22 @@ class RectangleActiveWaveformPainter extends ActiveWaveformPainter { : !isCentered ? alignPosition : alignPosition - y / 2; + final rectangle = Rect.fromLTWH(x, positionFromTop, sampleWidth, y); //Draws the filled rectangles of the waveform. canvas ..drawRRect( RRect.fromRectAndRadius( - Rect.fromLTWH(x, positionFromTop, sampleWidth, y), - Radius.circular(x), + rectangle, + radius, ), paint, ) //Draws the border for the rectangles of the waveform. ..drawRRect( RRect.fromRectAndRadius( - Rect.fromLTWH(x, positionFromTop, sampleWidth, y), - Radius.circular(x), + rectangle, + radius, ), borderPaint, );