[英]How to create a circular progress bar in flutter
I am trying to figure out how to curve a fractionally sized box inside a container in flutter.我试图弄清楚如何在 flutter 的容器内弯曲一个小尺寸的盒子。
The code I currently have just creates a giant circle inside the border.我目前的代码只是在边界内创建了一个巨大的圆圈。
decoration: BoxDecoration(border: Border.all(),
shape: BoxShape.circle),
width: 112,
height: 112,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: FractionallySizedBox(
widthFactor:.90,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.green,),),
Here is what I am trying to achieve (but with the green bar only showing 20% instead of the 100% shown here):这是我想要实现的目标(但绿色条仅显示 20% 而不是此处显示的 100%):
Why don't you use CircularProgressIndicator widget and a Text widget in a stack?为什么不在堆栈中使用 CircularProgressIndicator 小部件和 Text 小部件?
You can set strokeWidth and the progress of a circularProgressIndicator like this:您可以像这样设置 strokeWidth 和 circularProgressIndicator 的进度:
CircularProgressIndicator(
value: yourProgress,
strokeWidth: yourStrokeWidth)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.