Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add transition/animation between conditional statement view switch

Tags:

flutter

I have a conditional statement to render two different views based on the state. However, when the state changes the view just blinks in with white flash, are there any ways to make it look nicer, like a slower tranistion or any other kind of animations?

   body: children: [
              context.watch<ItemProvider>().hasItem
                  ? MyView()
                  : MyOtherView(),
...
like image 642
Dave Avatar asked May 26 '26 10:05

Dave


1 Answers

AnimatedSwitcher is the best option for you. You can learn more from this medium article

like image 167
towhid Avatar answered May 28 '26 00:05

towhid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!