我正在尝试使用颤振/飞镖将一组对象集中在一行中。我尝试过各种方法,但都失败了。我希望图标在屏幕的左边,其余的变量(旅行、跟随者和跟随者)在剩余的空间中居中。我尝试过各种使用MainAxisAlignment和CrossAxisAlignment类的方法,这些方法都是基于我在其中找到的一些解决方案,但都没有奏效。我做错了什么?
Column(
children: <Widget>[
ClipOval(
child: Material(
color: Colors.grey, // button color
child: InkWell(
child: SizedBox(
width: 80,
height: 80,
child: Align(
alignment: Alignment.center,
child: Icon(
Icons.person,
size: 65.0,
),
),
),
),
),
)
],
),
Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
trips, followers, following,
],
),
],
),图像1:当前的外观

图像2:颤振检查器视图

发布于 2020-02-27 11:18:05
你想要在三个文本之间均匀地分配图标上的空间,对吗?我会解决这个问题,方法是将3个小部件包装在另一行中,剩下的空间不带图标,然后将文本封装到一个扩展的小部件中,这个小部件填充了其余的空间。
我想旅行,追随者和跟随者都是专栏。
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Column(
children: <Widget>[
ClipOval(
....(your stuff)
)
]
),
Row(
children: <Widget>[
Expanded(
child: trips
),
Expanded(
child: followers
),
Expanded(
child: following
),
]
)
]
) //Row End在Row文档中,您可以看到展开如何占用三分之一的可用空间。[1]
https://stackoverflow.com/questions/60382582
复制相似问题