Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 740
berkipekoglu Avatar asked Oct 23 '25 08:10

berkipekoglu


1 Answers

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.

like image 171
Jasper Avatar answered Oct 25 '25 00:10

Jasper