我遇到一个问题,当我使用堆栈并添加一个具有手势检测器的子项并将其放置在父窗口小部件之外时,使用定位它不再检测手势,如果有修复程序,请解释一下,谢谢。我针对该问题的代码:
...List<Widget>.generate(
images.length,
(index) {
return Stack(
clipBehavior: Clip.none,
children: [
Container(
height: deviceWidth / 3.5,
width: deviceWidth / 3.5,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10)),
child: GestureDetector(
onLongPressStart: (details) {},
onTap: () async {
var imageFile = await pickImage();
if (imageFile != null) {
images[index] = makeImage(
isPlaceholder: false,
imageData: await imageFile.readAsBytes());
setState(
() {},
);
}
},
child: images[index],
),
),
Positioned(
left: -10,
top: -15,
child: Container(
alignment: Alignment.center,
height: 30,
width: 30,
decoration: const ShapeDecoration(
shape: CircleBorder(), color: Colors.red),
child: InkWell(
splashColor: Colors.white,
onTap: () {
images.remove(images[index]);
setState(() {});
},
child: const IgnorePointer(
child: Icon(Icons.delete_forever)),
),
),
)
],
);
},
),