我在用颤振
我有一个圆形的容器,用这个代码
new Container(
width: 50.0,
height: 50.0,
decoration: new BoxDecoration(
shape: BoxShape.circle)
我想让这个圆圈在屏幕上像这样移动
我该怎么做呢?谢谢您
最佳答案
您要查找的是Draggable
小部件。然后,您可以使用onDraggableCanceled
来处理转换,它将被传递并偏移,您可以使用它来更新位置。
onDraggableCanceled :(velocity,offset){
//update the position here
}
更新
检查完图像后,您需要将“Drop me here”(将我放在此处)部分设置为具有方法
onAccept
的DragTarget,该方法将在您拖放Draggable
时处理逻辑。