File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
214214 } else {
215215 _updateProgress ();
216216 }
217- _diameter = widget.radius * 2 ;
217+ _calculateDiameter () ;
218218 super .initState ();
219219 }
220220
@@ -229,6 +229,11 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
229229 @override
230230 void didUpdateWidget (CircularPercentIndicator oldWidget) {
231231 super .didUpdateWidget (oldWidget);
232+
233+ if (oldWidget.radius != widget.radius) {
234+ _calculateDiameter ();
235+ }
236+
232237 if (oldWidget.percent != widget.percent ||
233238 oldWidget.startAngle != widget.startAngle) {
234239 if (_animationController != null ) {
@@ -248,10 +253,14 @@ class _CircularPercentIndicatorState extends State<CircularPercentIndicator>
248253 _checkIfNeedCancelAnimation (oldWidget);
249254 }
250255
251- _updateProgress () {
256+ void _updateProgress () {
252257 setState (() => _percent = widget.percent);
253258 }
254259
260+ void _calculateDiameter () {
261+ _diameter = widget.radius * 2 ;
262+ }
263+
255264 @override
256265 Widget build (BuildContext context) {
257266 super .build (context);
You can’t perform that action at this time.
0 commit comments