Skip to content

[Question] How do I set the background of my View to an image without container #2775

Discussion options

You must be logged in to vote

I figured it out if anyone is facing the same problem that I am. The only part of my code that changed was the following:

self.bg_image = ft.Row( expand=True, controls=[ft.ShaderMask( ft.Image(src="images/bg_image.jpg", fit=ft.ImageFit.FILL, height=1155), blend_mode=ft.BlendMode.DST_IN, expand=True, shader=ft.LinearGradient( begin=ft.alignment.top_center, end=ft.alignment.bottom_center, colors=[ft.colors.BLACK, ft.colors.TRANSPARENT], stops=[0.5, 1.0], ), )], )
Wrapping the content in a Row instead of a container made it magically work. Went through the flet documentation and figured out that the only controls whose children can actually expand are the row and column controls. However, em…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ndonkoHenri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
1 participant