有时候,我想将项目排列在一列中,每个项目之间的间距不同。典型的实现使用SizedBox或Container.padding,但都不允许使用负值。从Flutter 1.0开始,是否有任何方法可以实现负间距?
return Column(
children: <Widget>[
Container(height:20, width: 20, color: Color(0x800000FF),),
SizedBox(height: -10,), // Illegal, can't be negative
Container(height:20, width: 20, color: Color(0x80FF0000),),
Container(
padding: EdgeInsets.fromLTRB(0, -10, 0, 0), // Illegal, can't be negative
child: Container(height:20, width: 20, color: Color(0x8000FF00),),
)
],
);