Tester32
Tester32

Reputation: 31

How to produce screenshot animation in flutter?

Somebody please suggest me the best package or any way to provide a screenshot taken effect in flutter. Please don't downvote.If I did anything wrong

Upvotes: 3

Views: 711

Answers (1)

drogel
drogel

Reputation: 2717

One way to achieve the effect you are looking for is having your page in a Stack. One entry of the Stack will be your Scaffold page, and the other one will be a white Container that fills the screen space. Something like this in your page's build method:

@override
Widget build(BuildContext context) => Stack(
    children: [
        Container(color: Colors.white),
        Scaffold(
            // The rest of your page
        ),
    ],
);

Then, you can wrap your white Container in an AnimatedOpacity widget (check out this Flutter.dev article on how to animate fading widgets), and define an animation such that the white Container fades in and then fades out very quickly, achieving a flash-like effect. In the article I mentioned they also explain how to trigger such an animation programatically.

Upvotes: 1

Related Questions