Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to use this plugin if you set negative transforms? #4

Open
NickKoroloff opened this issue Feb 8, 2022 · 2 comments
Open

Comments

@NickKoroloff
Copy link

Container(
      transform: Matrix4.translationValues(-150, -150, 0.0),
)
@esDotDev
Copy link
Contributor

Have you tried?

@rivella50
Copy link

rivella50 commented Jun 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants