Create beautiful gradients for your Flutter and Android applications. Customize colors, directions, and more.
Flutter provides several types of gradients that you can use to create beautiful color transitions in your applications:
Linear gradients transition colors along a line defined by begin and end points.
LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.blue, Colors.red],
)
Radial gradients transition colors from a central point outward in a circular shape.
RadialGradient(
center: Alignment.center,
radius: 0.5,
colors: [Colors.blue, Colors.red],
)
Sweep gradients (also known as conic gradients) transition colors around a center point.
SweepGradient(
center: Alignment.center,
startAngle: 0.0,
endAngle: 2 * pi,
colors: [Colors.blue, Colors.red],
)
You can use gradients with various widgets by applying them to a BoxDecoration:
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.red],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: YourWidget(),
)