【发布时间】:2021-08-20 02:20:58
【问题描述】:
基本上,我正在尝试使用以下代码在 2 个容器之间放置一个空格,因此每个 But mainAxisAlignment 小部件都不起作用。两个容器在开始时相互粘在一起
Positioned(
bottom: 10,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
decoration: BoxDecoration(
child: Padding(
padding: EdgeInsets.all(5.0),
child: Text(product.name,
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.w300)))),
Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white),
borderRadius: BorderRadius.circular(5.0)),
child: Padding(
padding: EdgeInsets.all(5.0),
child: Text(
'${PriceConverter.convertPrice(context, _startingPrice, discount: product.discount, discountType: product.discountType, asFixed: 1)}'
'${_endingPrice != null ? ' - ${PriceConverter.convertPrice(context, _endingPrice, discount: product.discount, discountType: product.discountType, asFixed: 1)}' : ''}',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.normal))))
],
)
),
【问题讨论】:
-
容器是否填满了行?此外,添加空间的一种简单方法是将容器包装在 Padding 小部件中或在容器之间插入 SizedBox(width:10.0)
标签: flutter