Issue
How can I create Instagram like auto changing gradient background color in flutter
Solution
I do not know exactly what you mean by "Instagram-like auto changing gradient" but I am guessing you mean a smooth color transition in a container. For that, there are two main approaches.
The simplest one: use an Animated Container and assign its color property to a local variable that you can change later on using
setState()
.AnimatedContainer
will interpolate the values between the initial and the final color in the states, creating the effect.Use an Animated Builder to create a
Tween
that interpolates colors and control when and how it should change with anAnimationController
. In this Medium article you can find more information on this approach.
Answered By - drogel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.