GradientTileMode
Defines what happens at the edge of a gradient. More information about GradientTileMode here.
Inherits: Enum
Properties
-
CLAMP–Samples beyond the edge are clamped to the nearest color in the defined inner area.
-
DECAL–Samples beyond the edge are treated as transparent black.
-
MIRROR–Samples beyond the edge are mirrored back and forth across the defined area.
-
REPEATED–Samples beyond the edge are repeated from the far end of the defined area.
Examples#
Showcase#
import flet as ft
def showcase_card(mode: ft.GradientTileMode) -> ft.Container:
return ft.Container(
width=320,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(mode.name, weight=ft.FontWeight.BOLD),
ft.Container(
width=240,
height=120,
border=ft.Border.all(1, ft.Colors.OUTLINE),
border_radius=8,
gradient=ft.RadialGradient(
radius=0.22,
colors=[ft.Colors.PRIMARY, ft.Colors.AMBER_400],
tile_mode=mode,
),
),
],
),
)
def main(page: ft.Page):
page.theme_mode = ft.ThemeMode.DARK
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.appbar = ft.AppBar(title="GradientTileMode Showcase")
page.add(
ft.Text("Compare how gradients behave outside their defined paint region."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[showcase_card(mode) for mode in ft.GradientTileMode],
),
)
ft.run(main)
Properties#
CLAMP = 'clamp'
class-attribute
instance-attribute
#
Samples beyond the edge are clamped to the nearest color in the defined inner area. More information here.
DECAL = 'decal'
class-attribute
instance-attribute
#
Samples beyond the edge are treated as transparent black. More information here.