所以我创建了一张卡片,其中包含课程的某些信息,它显示了您使用 LinearProgressIndicator 完成的课程的百分比。
Widget top(BuildContext context) {
return Row(
children: <Widget>[
Image.network(
image,
height: 100,
width: 100,
),
SizedBox(
width: 16,
),
Flexible(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(checkTitle(title),
style: Theme.of(context).textTheme.headline3),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.5,
child: LinearProgressIndicator(
value: int.parse(progress) * 0.01,
valueColor: AlwaysStoppedAnimation<Color>(LightSeaGreen),
backgroundColor: Colors.greenAccent,
// (int.parse(progress)).roundToDouble(),
),
),
Text('$progress%')
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Text(startDate), Text(finishDate)],
),
],
)),
],
);
}
我的输出, 在此处输入图像描述
但是当我更改屏幕的宽度时出现此错误 ,请在此处输入图像描述
我想要的是 LinearProgressIndicator 根据屏幕宽度做出响应。请帮助!!!