Skip to content

How to apply linear gradient on a container. #937

Answered by ndonkoHenri
Haadi-A asked this question in Q&A
Discussion options

You must be logged in to vote

bgcolor takes only strings. You have to use the gradient property of the container. See docs here: https://flet.dev/docs/controls/container#gradient
So, modify your code as follows:

ft.Container(
    height=610, width=700,
    border_radius=100,
    gradient=ft.LinearGradient(
        colors=[ft.colors.BLUE, ft.colors.CYAN],
        stops=[100.5, 100.00]
    )
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ndonkoHenri
Comment options

Answer selected by Haadi-A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants