Start a Project

LinearGradient in flutter

In this blog we are going to discuss the Implementation of LinearGradient in flutter.

LinearGradient class is used for presenting the linear gradient. We add the list of colours inside the LinearGradient class inside the colors attribute.

In linear gradient we define two anchor points begin and end. Begin point to the starting point of the gradient and end refers to the point where our gradient will be finished.

You may also check our flutter app development services page to read more about Flutter app development from mobikul.

Implementation:

Create the gradient by using the LinearGradient class inside the box decoration.

We have added the list of colors which will draw the linear gradient with respect to our start and end point.

For begin we are using Alignment.topRight which will start drawing gradient from the right side and top of the screen.

For end we are using Alignment.bottomLeft to end our gradient at left bottom of the screen.

We have used stateful widget for crating the container with linear gradient for our app.

Result

The above linear gradient will looks like:

Conclusion:

For more information regarding the Implementation of LinearGradient in flutter follow link.

In this blog, we have learned Implementation of LinearGradient on flutter to make the interactive UI experience in your app.

Thanks for reading this blog. You can also check other blogs from here.

Exit mobile version