diegoveloper / flutter_percent_indicator

Flutter percent indicator library
BSD 2-Clause "Simplified" License
679 stars 206 forks source link

Enable rotation of linear gradient in circular percent indicator. #86

Closed ecokeco closed 3 years ago

ecokeco commented 3 years ago

The linear gradient in the circular percent indicator always starts at the top and ends at the bottom regardless of the startAngle parameter. This is not appropriate if you want the gradient to start at the point where the progress bar starts and to end at the point where the progress bar ends.

Current (default) behaviour: current_behaviour

Newly implemented behaviour: new_behaviour

I added the parameter rotateLinearGradient whose default value is false to avoid breaking changes, and setting it to true enables the described functionality.

Usage example: CircularPercentIndicator( radius: 100.0, lineWidth: 10.0, percent: 0.75, startAngle: 45, rotateLinearGradient: true, circularStrokeCap: CircularStrokeCap.round, backgroundColor: Colors.grey, maskFilter: MaskFilter.blur(BlurStyle.solid, 3), linearGradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Colors.orange, Colors.yellow], ), )

It would be great if we could have this optional behvaiour implemented in the official widget.

diegoveloper commented 3 years ago

Awesome, thanks for the contribution