我需要一个灵活的右箭头,以便它可以根据屏幕大小调整,这是可能使用扩展/灵活的小部件,但与堆栈小部件我不能使用扩展/灵活的小部件...
ListView(
children: ListTile.divideTiles(
context: context,
tiles: [
Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(240.0, 189.0, 0.00, 0.00),
child: Icon(Icons.arrow_right, color: Colors.black,)),
Row(
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(100.00, 200.0, 0.0, 0.00),
width: 150.0,
height: 1.0,
color: Colors.black,),
],
),
],
),
],
).toList(),
),发布于 2019-09-17 19:40:49
当您使用Stack小部件时,Stack小部件的子级中的每个小部件都将显示为一个层。因此,不使用Expended或Flexible作为Stack的子级,而是使用Container小部件,然后添加Expanded或Flexible作为子级。
Stack(
children: <Widget>[
Container(
width: double.infinity,
height: double.infinity,
child: Row(
children: <Widget>[
Expanded(
flex: 1,
),
Expanded(
flex: 2,
)
],
),
)
],
),
顺便说一句,如果你想在屏幕上的某个角落或任何地方添加一个图标,请使用定位的小部件。
https://stackoverflow.com/questions/57969833
复制相似问题