It displays text with a colorful gradient and optional animation of the gradient.
pip install flet_gradient_text
text
(str): The text content to displaytext_size
(optional): defaulttext_size=20
, Font size of the texttext_weight
: optional, Font weight (e.g., ft.FontWeight.BOLD)text_style
(optional): property of typeft.TextStyle
animate
(bool): defaultanimate=False
,True
to Enable animationduration
(float or int): defaultduration=0.5
, Controls the speed of the animationgradient
: (optional) Custom gradient to apply over the text, defaultLinearGradient
on_click
(optional): Event handler when the text is clickedon_hover
(optional): Event handler when hovering over the text
import flet as ft
from flet_gradient_text import GradientText
def main(page: ft.Page):
page.add(
GradientText(
text="Hello Gradient!",
text_size=40,
text_weight=ft.FontWeight.BOLD,
animate=True,
duration=1,
)
)
ft.app(target=main)