How could I animate to another screen by using a Material-like circle expanding effect with Flutter? - flutter

Here is an example from a mockup I made of what I am trying to achieve.
Right now in code, these are 2 separate screens, but they are simply using a regular built-in animation between screens. Where would I even start to begin achieving an animation like the mockup example? Could I use a Stack that has a circle as a background with a hero tag, and then change its radius? How could I guarantee it would fill the size of any screen?
Thank you!

It's quite simple, you can do it in 1 page, follow this:
Layer a full page popup menu widget (let's say the widgets on pink)
on the page 1 with Stack, hide it at initial.
Scale animation to the top left circle when pressing it
Show the hidden menu widget after scale animation
Hide and reverse the scale animation when pressing closing or back button

Related

Flutter custom page transition animation

I want to have a custom page transition for my splash page described below:
I want the page to be split in half horizontally and the top half to move up and the bottom half to move down and leave the frame.
How can I achieve this? any help or hint is appreciated.

Flutter: Partially overlapping buttons that can switch overlapping on tap

I am trying to create a layout of two elevated buttons as below screen shots. One button is partially overlapping other button on the right side. When button on the right is tapped then it will partially overlap the button on left.
I can do it using stack but that will require a lot playing around with the positions.
I am wondering if someone could point me to the right direction on how to achieve this layout.
Regards,
Jamal

Animate card widget on button click Tinder like swipe

Hello all I am building Tinder like swipe in Flutter. So far so good I have made the stack of cards together with the gesture detector when the user swipes left/right. However my issue come when I try to animate on click of a button. Under the stack of cards there are 2 buttons which you can like or dislike on button click. I would like to get an advice how I can approach the animation when the user clicks on either button. Below is my code for displaying the stack. Best wishes
There are several options to animate the card off screen. Since you're already using a Stack, AnimatedPosition is probably the best option.
You could also use Transform.translate to set the transform property of an AnimatedContainer. Or, if you want more control over the animation you could use a SlideTransition.
For a good overview of how to decide which animations you need, see this video from two days ago: https://www.youtube.com/watch?v=GXIJJkq_H8g
There's also https://pub.dev/packages/animations for more pre-packed options.

How to animate fullscreen photo transition on swipe, like in Telegram?

When you swipe vertically, image is dragged towards the swipe, with fading out animation of black background.
And after release, it smoothly returns to it's previous position on the screen, like Hero animation does.
How is it possible to recreate such an effect using Flutter? The same scenario, in fullscreen photo view.
photo_view package is desired for fullscreen, so it shouldn't interfere with zooming.
What you need is actually an out-of-the-box widget, and it's surprisingly easy to use. It's called Hero. Basically, you wrap the widget you want to animate like that in a Hero widget, with a specific tag string, and, when you navigate to another screen, you wrap the destination widget in another Hero with the same tag. An effect like the one you shared can be achieved by wrapping two widgets with the same photo with Heroes in different PageRoutes.
Check out this Flutter widget of the week video to get you started, and this Flutter.dev article for a more detailed explanation on Hero widgets.
Edit: I see you are looking for a more specific image-viewer behavior. Then, I suggest you use the photo_view package, which includes many functionalities to visualize images, including the hero transition with swipe-dow-to-dismiss behaviors, pinching to zoom, etc.
I found the solution.
To create such an animation, you should use extended_image package, which has SlideOutPage widget for creation of such transitions.

How to implement stories progress view in flutter

I want to know to the best way in order to develop a widget/view which can work as instagram, snapchat stories which illustrated in image below. There are many depndencies for android, but can't find any for flutter.
I'm thinking to use carousal/viewpager to move between stories of different users, but I'm unable to get how to move backward and forward in between stories of single user(either image or video) with progress bar on top of it which will move automatically to next when progress bar completes.
Try to create a custom ViewPager perhaps using Stack + Transform and use GestureDetector to switch between pages/stories.
I know this question has been asked for a long time, but for those who still ask the same question, you can use this library: https://pub.dev/packages/story_view or look at it's source to implement the same thing.
Not sure if you also want to give the user a chance to manually switch to the next image.
Here are some basic ingredients you want to use for an animated "story":
AnimationController with duration depending on the number of images in the story. Start the animation to go through the images and to animate the progress bar. The animation controller usually has a range from 0.0 to 1.0. Let's say you have 5 images. You would display the first image from 0.0 to 0.2, the second image from 0.2 to 0.4...
AnimatedBuilder that listens to the animation controller. The content inside the animation builder will be rebuilt every frame while the animation runs. Inside of the builder, calculate which image must be shown.
CustomPaint to manually draw a progress bar with sections for the single image. Pass the current animation value and the number of images to your CustomPainter.
Image widget to draw the image.