当我在 GestureDetector 中使用 ListView 或其他滚动时,它不起作用:
new GestureDetector(
child: new Container(
alignment: FractionalOffset.center,
child: new Text("Short Content"),
decoration: new BoxDecoration(
color: Colors.red
),
),
onVerticalDragStart: (DragStartDetails detail){
print("onVerticalDragStart");
},
onVerticalDragUpdate: (DragUpdateDetails detail){
print("onVerticalDragUpdate");
},
)
Run Code Online (Sandbox Code Playgroud)
上面它适用于拖动检测,但如果我在 GestureDetector 中有其他滚动,它将不起作用
new GestureDetector(
child: new Container(
alignment: FractionalOffset.center,
child: new ListView(
children: <Widget>[
new Text("Long content "),
],
),
decoration: new BoxDecoration(
color: Colors.red
),
),
onVerticalDragStart: (DragStartDetails detail){
print("onVerticalDragStart");
},
onVerticalDragUpdate: (DragUpdateDetails detail){
print("onVerticalDragUpdate");
},
)
Run Code Online (Sandbox Code Playgroud)