我正在尝试为我的应用程序制作一个加载屏幕,我正在使用
widget,但我想知道有没有办法让它在高度和宽度上更大,它太小了。
有人能帮我一下吗?
发布于 2018-08-18 03:01:12
你可以把你的
在一个
小部件
@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
child: CircularProgressIndicator(),
height: 200.0,
width: 200.0,
),
SizedBox(
child: CircularProgressIndicator(),
height: 50.0,
width: 50.0,
),
SizedBox(
child: CircularProgressIndicator(),
height: 10.0,
width: 10.0,
)
],
),
),
);
发布于 2020-02-04 09:14:29
请测试你的答案。
只需将CircularProgressIndicator放在SizedBox或容器中:
main() =>
runApp(
SizedBox(width: 30, height: 30, child: CircularProgressIndicator()));
..。仍然会导致CircularProgressIndicator填充可用空间。SizedBox不约束CircularProgressIndicator (这看起来像Flutter中的错误)。
但是,使用Center包装它将使其正常工作:
main() =>
runApp(Center(child:
SizedBox( width: 30, height: 30, child: CircularProgressIndicator())));
我在Github上抱怨过这种令人困惑的行为。flutter团队做出了有益的回应,提供了新的文档,解释说如果无法确定小部件的对齐方式,则可以忽略小部件的所需大小。
https://github.com/flutter/website/pull/5010/commits/3070c777a61b493b46cdde92fa7afc21de7adf25
发布于 2019-09-18 23:09:24
属性包装指示器,可以更好地控制指示器的大小。
小工具。这不会造成伤害,但可以完成工作。在我的例子中,is使用了一个
按钮内部的小加载指示器。
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Container(
height: 20,
width: 20,
margin: EdgeInsets.all(5),
child: CircularProgressIndicator(
strokeWidth: 2.0,
valueColor : AlwaysStoppedAnimation(Colors.white),
),
),
),
],
);
https://stackoverflow.com/questions/51901379
复制相似问题