0

In response to a reply given to another question the user parkorian asked:

what if you want to access to that scrollController from another page? Let's say, I am in pageTwo and when I press a button I want it to push pageOne and scroll down to a certain position –

There was no answer on that page sadly, So my question:

I want the UI to automatically scroll to the mapped Widget [from another page]. Just like we see that effect in websites. Let's say, I am in pageTwo and when I press a button I want it to push pageOne and scroll down to a certain position

How can I achieve this?

Adriaan
18.2k7 gold badges47 silver badges88 bronze badges
asked Feb 22, 2023 at 16:04

1 Answer 1

0

You can pass a CallBack Function from your Page1 to Page2 and in your Page2 you can call it like this:

callback.call();

In your callBack (which you define in Page1) you just say scrollController.jumpTo or scrollController.jumpToPage

answered Feb 22, 2023 at 16:18
Sign up to request clarification or add additional context in comments.

2 Comments

Which doesn't really mean anything to me, because I don't have a callBack, so I guess I will have to scroll through a whole lot of documentation to find out what that is. Most of what I see brings me back to "Page1," which I can do already. I have to go to a specific "row" or "child" in Page1, not the top, which is something I could do with a simple hash tag in html.
A callback is just a function which you define in page1. Write a function named scrollPage(), inside you call scrollController.jumpToPage(positionToJump). This function is passed inside Page2 as a variable, name it for example scrollCallback. You can define function as variables like this: Function myScrollCallBack. To call this function now from page2 to trigger the scroll on page1 you have use the variable with myScrollCallback.call();

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.