你好,我什至无法使用 crossaxisalignment 将行居中放置在卡片中
如果我用中心小部件覆盖该行,请帮忙...
` 卡片( elevation: 4.0, // 卡牌高度 孩子:中心( 孩子:填充( padding: EdgeInsets.all(16.0), // 卡内边距 孩子:行(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, // Align children in the middle vertically
children: <Widget>[
Column(
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
Column(
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
Column(
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
],
),
`
通过在列中添加 mainAxisAlignment: MainAxisAlignment.center,您应该获得结果。
Card( elevation: 4.0, // Card elevation
child: Padding( padding: EdgeInsets.all(16.0), // Padding inside the card
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, // Align children in the middle vertically
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Following',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 16.0,
),
),
],
),
],
)))