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

GlobalKey element offset #33

Closed
franskjv opened this issue Jun 12, 2020 · 5 comments · Fixed by #48
Closed

GlobalKey element offset #33

franskjv opened this issue Jun 12, 2020 · 5 comments · Fixed by #48

Comments

@franskjv
Copy link

Hi, I'm trying to use the package but every element I use a Global key,
the highlight appears below that element: (I wanted the highlight on the kebab bottom)

Screen Shot 2020-06-12 at 15 31 00

I'm using the Global Key in my PopupMenuButton and keyTarget on the plugin call.

keyTarget: key,

Any hint what am I doing wrong?

Thanks in advance.

@CalHoll
Copy link

CalHoll commented Nov 12, 2020

I'm encountering the same issue, for me it's also below the element I've assigned the global key to, @franskjv did you find a resolution?

Right now I've just been hard-coding positions but it get's complicated with some dynamically positioned widgets.

@RafaelBarbosatec
Copy link
Owner

RafaelBarbosatec commented Dec 10, 2020

Hi @franskjv !

this problem still continue? Doing some tests, I realized that you are focusing correctly

 return Scaffold(
      appBar: AppBar(
        actions: <Widget>[
          IconButton(
            // key: keyButton1,
            icon: Icon(Icons.add),
            onPressed: () {},
          ),
          PopupMenuButton(
            key: keyButton1,
            icon: Icon(Icons.view_list, color: Colors.white),
            itemBuilder: (context) => [
              PopupMenuItem(
                child: Text("Is this"),
              ),
              PopupMenuItem(
                child: Text("What"),
              ),
              PopupMenuItem(
                child: Text("You Want?"),
              ),
            ],
          )
        ],
      ),

Captura de Tela 2020-12-10 às 15 42 56

@ToniTornado
Copy link

When you open the tutorial in a page that is pushed to the stack with animation, the position from the referenced widget is not yet the final position after the navigation animation. The offset depends on the direction the page is pushed. You can delay execution of TutorialCoachMark(...).show() by a value that is higher than the page transition duration to make it work.

@CalHoll
Copy link

CalHoll commented Jan 27, 2021

Delaying didn't change anything for me. I'm currently working around it by setting a hard-coded height from the top of the screen but this is far from an ideal solution. I've had to use some creative math to figure out the placement of some elements.

@CalHoll
Copy link

CalHoll commented Jan 27, 2021

So after a little digging I was able to identify the cause of this offset. It's the use of SafeArea, I use it near the top of my widget tree, and if I remove it the offset issue goes away (but my layout gets messed up).

cwyu-Ivan added a commit to cwyu-Ivan/tutorial_coach_mark that referenced this issue Feb 1, 2021
@cwyu-Ivan cwyu-Ivan mentioned this issue Feb 1, 2021
RafaelBarbosatec added a commit that referenced this issue Feb 5, 2021
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

Successfully merging a pull request may close this issue.

4 participants