[英][Flutter Error]-Making Linear Progress Indicator Responsive
所以我創建了一張卡片,其中包含課程的某些信息,它顯示了您使用 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)],
),
],
)),
],
);
}
我的 output,在此處輸入圖像描述
但是當我更改屏幕的寬度時出現此錯誤,請在此處輸入圖像描述
我想要的是 LinearProgressIndicator 根據屏幕寬度做出響應。請幫助!!!
用Expanded
包裹LinearProgressIndicator
。
Expanded(
child: LinearProgressIndicator(
value: int.parse(progress) * 0.01,
valueColor: AlwaysStoppedAnimation<Color>(LightSeaGreen),
backgroundColor: Colors.greenAccent,
// (int.parse(progress)).roundToDouble(),
),
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.