flutter-defer-pointer
flutter-defer-pointer copied to clipboard
is it possible to use this plugin if you set negative transforms?
Container(
transform: Matrix4.translationValues(-150, -150, 0.0),
)
Have you tried?
I just tried with a translated and rotated TextButton and unfortunately it doesn't seem to work:
@override
Widget build(BuildContext context) {
return DeferredPointerHandler(
child: Stack(
children: [
_buildButton(math64.Vector3(20, 20, 0), rotateY: pi/2),
],
),
);
}
Transform _buildButton(math64.Vector3 translate, {double rotateX = 0.0, double rotateY = 0.0}) {
return Transform(
transform: math64.Matrix4.identity()
..rotateX(rotateX)
..rotateY(rotateY)
..translate(translate),
alignment: Alignment.topLeft,
child: DeferPointer(
child: TextButton(
onPressed: () => print('clicked'),
child: Text('Click', style: TextStyle(color: Colors.white),),
),
),
);
}
Is this package supposed to work with transformed items at all, and if yes, how does the code have to be adjusted? If not, do you guys have an idea how the click area for a widget (or defined with GestureDetection as parent) can be transformed as well in order that click events still work even after the transformation?
EDIT: I have to correct myself, it actually works fine, i just had to insert DeferredPointerHandler
some more levels higher in the hierarchy.