tl;dr需要容器填满垂直空间,这样它才能充当ONTAP监听器.我试过大多数解决方案,但似乎都不管用.
所以我想做的是让我的容器填满垂直空间,同时保持固定的宽度.Two first is what I have and third is what I want.我们的 idea 是让容器通过手势ontap侦听器透明.如果有人对不同的解决方案有更好的 idea ,请随时提出建议.
Widget build(BuildContext context) {
return new GestureDetector(
onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _handleDragEnd,
child: new Stack(
children: <Widget>[
new Positioned.fill(
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Container(
child: new IconButton(
padding: new EdgeInsets.only(top: 16.0, bottom: 16.0, left: 24.0, right: 24.0),
icon: new Icon(Icons.warning),
color: Colors.black12,
onPressed: () {},
)
),
],
),
),
new SlideTransition(
position: new Tween<Offset>(
begin: Offset(0.0, 0.0),
end: const Offset(-0.6, 0.0),
).animate(_animation),
child: new Card(
child: new Row(
children: <Widget>[
new Container(
width: 20.0,
height: 20.0,
color: Colors.amber,
),
new Expanded(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_getListTile(),
_ifStoplineIsToBeShown()
],
),
)
],
)
),
),
],
)
);
}
考虑到我已经try 了很多不同的方法,但似乎都没有奏效,我很确定我错过了一些东西.
我还上传了一张带有here的图片.
PS.我知道我已将高度设置为固定值,但这是显示容器的唯一方式.