flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.19k stars 431 forks source link

control resize not consistent when resizing window horizontally or vertically #3846

Open ch3ng666 opened 2 months ago

ch3ng666 commented 2 months ago

Duplicate Check

Describe the bug

When I resize the window, the image shrinks only if I resize horizontally. If I add expand=True, the image shrinks also when I resize the window vertically. This happens with every control I've tried. Adding page.vertical_alignment = ft.MainAxisAlignment.CENTER centers the image an make it move when I resize, but still crops the image.

https://github.com/user-attachments/assets/cbcf4f22-5bcc-49a2-ad22-4888a3603e8c

Code sample

Code ```python import flet as ft def main(page: ft.Page): page.window.height = 500 page.window.width = 500 a = ft.Image( src='assets/img/x.png', width=200, height=200, ) page.add(a) ft.app(main, assets_dir='assets') ```

To reproduce

Try the code, then try the same adding expand=true, see the difference

Expected behavior

To resize the image when I resize the window vertically without expand. Or to NOT resize the image when I resize the windows horizontally without expand. So I expect to be consistent

Screenshots / Videos

Captures [Upload media here]

Operating System

Windows

Operating system details

Windows 11

Flet version

0.23.2

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

No response

OwenMcDonnell commented 11 hours ago

Have you tried this on a newer flet release?

ch3ng666 commented 10 hours ago

Still happens in flet v0.24.1