Duplicate Check
Describe the bug
Adding an image as an instance attribute in the init method of a custom Container will make the container be displayed as a grey rectangle even if the image is not added to the container's content.
Code sample
Code
import flet as ft
@ft.control
class ImageDemo(ft.Container):
def init(self):
self.image = ft.Image(src="https://flet.dev/img/logo.svg")
self.content = ft.Column(controls=[ft.Text("Foo")])
def main(page: ft.Page):
page.title = "Image container"
calc = ImageDemo()
page.add(calc)
ft.run(main)
To reproduce
Run the script either in as an app
Or as webapp
python run --web image_demo.py
Expected behavior
A label with the text "Foo" should be displayed in the window or web page.
Screenshots / Videos
Captures
[Upload media here]
Operating System
macOS
Operating system details
Tahoe 26.5.1
Flet version
0.85.3
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
> uv run flet run --web hello.py
http://127.0.0.1:65003
Additional details
If the image is directly created inside the controls argumment or is not created at all everything works as expected.
Duplicate Check
Describe the bug
Adding an image as an instance attribute in the init method of a custom Container will make the container be displayed as a grey rectangle even if the image is not added to the container's content.
Code sample
Code
To reproduce
Run the script either in as an app
Or as webapp
Expected behavior
A label with the text "Foo" should be displayed in the window or web page.
Screenshots / Videos
Captures
[Upload media here]
Operating System
macOS
Operating system details
Tahoe 26.5.1
Flet version
0.85.3
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
Additional details
If the image is directly created inside the controls argumment or is not created at all everything works as expected.