bug: Interactive Viewer renders grey text when passed alignment
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
ft.InteractiveViewer fails to render its content when its alignment property is set to an ft.Alignment value.
The page or containing surface remains blank. Removing only the alignment argument makes the same child render correctly.
This affects images and simple controls such as ft.Text, so it is not related to image loading, paths, sizing, constrained, or boundary margins.
Code sample
Codeimport flet as ft
def main(page: ft.Page):
page.add(
ft.InteractiveViewer(
content=ft.Text(
"InteractiveViewer child",
size=40,
color=ft.Colors.RED,
),
width=900,
height=650,
alignment=ft.Alignment(0, 0),
)
)
ft.run(main)To reproduce
- Run the sample.
- Observe that the InteractiveViewer is blank and the red text is not rendered.
- Remove this line:
alignment=ft.Alignment(0, 0),
- Run the sample again.
- The red text now renders correctly.
The same behavior occurs with an ft.Image child.
Expected behavior
Setting InteractiveViewer.alignment should position the child using the supplied alignment without preventing the control from rendering.
Screenshots / Videos
CapturesOperating System
Linux
Operating system details
Arch Linux, kernel 7.1.5-arch1-2, x86_64
Flet version
Flet 0.86.4 (Python 3.11.15)
Regression
No, it isn't
Suggestions
import '../extensions/control.dart'; +import '../utils/alignment.dart';
...
- alignment: widget.control.get("alignment"),
- alignment: widget.control.getAlignment("alignment"),
Serialize alignment with getAlignment function before passing into the interactive viewer.
Logs
Logs No Python-side exception is reported. The control simply fails to render in the Flutter client.Additional details
The issue was isolated by testing the properties independently:
- Plain ft.Image: renders.
- InteractiveViewer without alignment: renders.
- InteractiveViewer with constrained=True: renders.
- InteractiveViewer with constrained=False: renders.
- Adding alignment=ft.Alignment(0, 0): child disappears.
- Removing only alignment: child renders again.
Source: flet-dev/flet