How can I generate random blurred gradient color background with different random starting points on Flutter?

642

When using any widget that accepts a BoxDecoration, like a container, you can use LinearGradient. Inside this gradient you can specify which colours you want, and where these colours should be positioned. To randomize this, you could have a big list of possible colours, and then get a certain amount of integers using the Random class to select a few colours out of this list. You can also position these colours randomly using the stops property in the LinearGradient in combination with again that same Random class.

If a linear gradient is not what you want, there are also others, like RadialGradient.

Share:
642
berkipekoglu
Author by

berkipekoglu

Junior Full Stack Developer

Updated on December 27, 2022

Comments

  • berkipekoglu
    berkipekoglu over 1 year

    How can I generate random blur color on Flutter? I don't know how to search. How can I do that?

    I want to create a blurred gradient color background with different random starting points. enter image description here