[英]Flutter: How to size progress indicator inside the container?
Container(
height: 150,
width: 150,
child: _loading
? Container(
height: 50,
width: 50,
child: CircularProgressIndicator(),
)
: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.blue)),
onPressed: () {},
child: Text('update'),
),
);
我正在嘗試像上面的代碼一樣將按鈕切換到CircularProgressIndicator()
。 但是,指標的大小並沒有設置為父容器的大小(寬高 50),而是設置為爺爺的Container (width height 150)
。 有什么方法可以將大小設置為 50 px 容器?
將CircularProgressIndicator
包裝在FittedBox
中
像這樣:
Container(
height: 50,
width: 50,
child: FittedBox(child: CircularProgressIndicator()),
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.