You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SweepGradient (conic gradient) for decorations and shaders #112
I searched the existing feature requests and this is not a duplicate.
Framework or plugin?
Framework
Platform
Both
Use case
There is no sweep (conic) gradient. painting.dart has LinearGradient and RadialGradient, and the canvas Gradient has two kinds ("1 = linear, 2 = radial", lib/src/widgets/custom_paint.dart), so BoxDecoration(gradient: SweepGradient(...)) doesn't compile and a CustomPaint can't fill with one.
We wanted a rotating gradient edge around a card and a progress ring with a sweep of colour. Both platforms have this natively (CAGradientLayer.type = .conic on iOS, android.graphics.SweepGradient). Our workaround is our own small Swift plugin just for this one effect, iOS only. An SkSL shader through dartnative_skia would also work but adds several MB to the app for one gradient.
Proposal
Add Flutter's SweepGradient to painting.dart, usable in BoxDecoration and through createShader for Paint.shader, and a Gradient.sweep factory in package:dartnative/canvas.dart:
Activity