我正在捕获图像并想对该图像进行一些计算,为此我需要获取图像上某些点的位置。为此,我使用了可拖动元素,我的想法是拖动一个元素到图像上,获取可拖动元素的 x 和 y 位置进行计算。
我使用了以下代码
body: Container(
child: Stack(
children: <Widget>[
Image.file(File(widget.imagePath)),
Draggable(
axis: Axis.vertical,
child: Text('_________', style: TextStyle(color: Colors.blue, fontSize: 90) ),
feedback:Text('____',style: TextStyle(color: Colors.blue, fontSize: 90)) ,
childWhenDragging: Text(''),
),
SizedBox(height: 50.0,),
],
),
)
Run Code Online (Sandbox Code Playgroud)
问题是 1. 当一个元素被拖动时,该元素位置应该随着触摸而移动,当前拖动时,元素会移动几个像素。2. 元素位置没有转移到最终拖动位置,当我移除触摸元素时回到原始位置。
请帮我解决一下这个。