Add clipRRect parameter to WaveStyle#258
Conversation
|
@seelrd Thanks for your contribution. Can you please share what issue you were facing? Also, if it was with labels then you can pass |
|
@ujas-m-simformsolutions |
| try { | ||
| return await _methodChannel.invokeMethod(Constants.getDecibel); | ||
| } catch (e) { | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
This change to getDecibel looks unrelated to the clipRRect feature — could it move to its own PR? Beyond scope, returning 0 in the catch is risky: the method returns Future<double?>, so 0 reads as a genuine decibel value and callers can't distinguish a real reading from a failure.
I'd let the PlatformException propagate, or return null to signal "no value", and log the error rather than discard it. The bound e is also unused (the analyzer flags unused_catch_clause) — catch (_) or on PlatformException catch would be cleaner.
| /// Applies this clipRRect to waveforms. | ||
| final RRect? clipRRect; |
There was a problem hiding this comment.
Exposing this as a raw RRect means callers have to hardcode absolute LTRB coordinates and the box size, then recompute them whenever the layout or orientation changes. The idiomatic shape for a rounded-rect parameter is BorderRadius, which the painter can resolve against its own size on each paint and stay correct across devices. Could we take a BorderRadius here instead? The doc comment also just restates the field name — a line on what gets clipped, with a short example like gradient has, would help.
|
@seelrd Thanks for this, and apologies for the delay. A few things before this can move forward:
Thanks! |
With this, you can provide an RRect to clip paint with to WaveStyle.
For example:
This way waveforms can be painted inside a rectangle with border radius.