Accessing the route's transition animation from a widget? - dart

I have two pages, both with their own Scaffold and a slightly different AppBar. I use Navigator.push to switch between them.
The second page is a popup which overlays the first page by having a transparent Scaffold with body of about 50% screen height. Here's how it looks:
In the first page, the red curtain ends just below the AppBar. When you open the second page, the curtain animates down to the screenshot above. I achieved this by starting the down animation in initState of the second screen.
Now, I want the opposite animation of the curtain rolling back up when you leave the second page. How would I do that? Is there a way to animate widgets (not just fade/slide whole pages) when you enter/leave the page?
Can I access the Route's transition animation (the same one that is passed to Route.buildTransitions) and use it to animate widgets inside the page itself?

Related

How to add stickyness to fullscreen ScrollableRow elements with Jetpack Compose?

I have a ScrollableRow with lets say 5 fullscreen composables.
ScrollableRow(
modifier = Modifier.fillMaxSize(),
scrollState = scrollState) {
myData.items.forEachIndexed{ index, pageItem ->
showPage(pageItem)
}
}
Everything is shown so far, but when I swipe left/right it stops exactly on the position, where I stopped swiping:
As you can see and imagne, almost everytime it stops between two of these full screen composables.
I'd rather have a kind of stickyness and show full pages for each single left/right swipe as pictured here:
So obviously, here in the second picture with third page showing:
when I swipe one time left, I want to see full screen page 4, only
when I swipe one time right, I want to see full screen page 2, only
I bet there is a mechanism for this?
HorizontalPager will suit you. Check Accompanist Pager layouts

Route to another widget while Drawer stays on the appbar

I have the following drawer. it works as it should as long as i only want to hop between the widgets of my main drawer items.
Navigation with drawer
but inside those widgets i want to route to a new one, with a button click for example, while the drawer stays in my corner. So basically is there any way to reproduce a sticky android drawer in flutter ?
Drawer is a Scaffold property.
So when you go to another page you will normally have another Scaffold widget with its own Drawerand the previous one will be disposed.
In the new page you need to create and display the Drawer for this Scaffold but you can't keep the previous one in the corner.
Since the two widgets are independent of each other, you cannot use the same exact Drawer in the second widget.
Either you can create the exact copy of that Drawer in second one and open it on initState method or if possible instead of switching to the second, you can make the second widget as a subview inside firstWidget.

Popup with overlay, popup fill window?

Would like to use a popup(jquery mobile) with content and make it fill the screen. Also with overlay.
Like this, scroll down to bottom, Overlay set to A button.
http://jquerymobile.com/branches/popup-widget/docs/pages/popup/index.html
But I want the popup to fill almost the entire screen. This should act as a new page but be filled with ajax content, I will fix this later...
How can I do this?
jQuery Mobile will not size a popup or dialog larger than needed to contain the rendered content. If you really want to fill the page, go with a new page. Consider transitioning to a new page with a pop transition instead.
http://jquerymobile.com/demos/1.2.0/docs/pages/page-transitions.html
You might also consider a dialog as it obscures the underlying page content
http://jquerymobile.com/demos/1.2.0/docs/pages/dialog/index.html

Animate only a part of an element

how can I animate only a part of an element?
I show/hide a div using jquery-ui's show method but I'd like to start/end the animation from/to a given height of the element.
My dev website can be seen here (link removed). When clicking on the 'Contact' button the contact page shows up or hides if it's already open. Since I couldn't find how to starts my animation from a given height I added a fixed button when it's closed, but when the contact button of the contact page overlaps the fixed button when it's closing...
Any help welcome!
looking for something like this??
http://jsfiddle.net/rlemon/F6Efp/8/
You can also add any fade or whatever effects. This is using a single button to animate both open and close. You could also attach a attribute to the button tag to define it's current state.

Jquery Mobile - Go to top of page on transition

In jquery mobile when you do transitions to different pages is there a way to have the page its transitioning to show the top of the page? If the current page has a long list and you scroll down, then click to go to another page with the slide transition, then click back to the previous page it shows the middle of the page where you last were. I would like it to actually go back to the top of the page when going back. Is this possible?
Try this on triggering the back button?
http://jquerymobile.com/demos/1.0b3/#/demos/1.0b3/docs/api/methods.html
//scroll to Y 100px
$.mobile.silentScroll(100);
Or on triggering the active page:
if ($("#myPage").is(".ui-page-active")) { ... }
I additionally think this is a feature which is nice, the back button takes you back to the place you have been. You don't have to re-orientate yourself because you get back to the point you were, I think its a nice usability feature.

Resources