LinearGradient
LinearGradient class has the following properties:
begin- An instance ofAlignmentclass. The offset at which stop 0.0 of the gradient is placed.end- An instance ofAlignmentclass. The offset at which stop 1.0 of the gradient is placed.colors- Thecolorsthe gradient should obtain at each of the stops. If stops is non-null, this list must have the same length as stops. This list must have at least two colors in it (otherwise, it's not a gradient!).stops- A list of values from 0.0 to 1.0 that denote fractions along the gradient. If non-null, this list must have the same length ascolors. If the first value is not 0.0, then a stop with position 0.0 and a color equal to the first color incolorsis implied. If the last value is not 1.0, then a stop with position 1.0 and a color equal to the last color incolorsis implied.tile_mode- How this gradient should tile the plane beyond in the region beforebeginand afterend. The value isGradientTileModeenum with supported values:CLAMP(default),DECAL,MIRROR,REPEATED. More info here.rotation- rotation for the gradient, in radians, around the center-point of its bounding box.
More information:
- Linear gradient in Flutter documentation.
- Radian measuring unit on Wikipedia.
Example of usage
Container(
gradient=ft.LinearGradient(
begin=ft.alignment.top_center,
end=ft.alignment.bottom_center,
colors=[ft.colors.BLUE, ft.colors.YELLOW],
),
width=150,
height=150,
border_radius=5,
)