简体   繁体   中英

Flutter - How to control the border width of the circular progress indicator?

I have been using the CircularProgressIndicator class to show a circular progress indicator with SizedBox class to control the size of the child widget a while ago, just like that:

...
SizedBox(
  width: 20.0,
  height: 20.0,
  child: CircularProgressIndicator(
    valueColor: AlwaysStoppedAnimation<Color>(
    Colors.deepOrange,
    ),
  ),
)
...

But i'm encountering that its width is exaggerated, Can i reduce the width of that indicator?

Any suggestions or advice would be appreciated. Thanks.

You can use strokeWidth property of CircularProgressIndicator to define it's width.

SizedBox(
 width: 20.0,
 height: 20.0,
   child: CircularProgressIndicator(
     strokeWidth: 2.0,
     valueColor: AlwaysStoppedAnimation<Color>(
       Colors.deepOrange,
      ),
    ),
 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM