Skip to content

page.width and page.height not working on apk #4679

Open
@Jorch98

Description

@Jorch98

Duplicate Check

Describe the bug

page.width and page.height return 0 when the app is build as an apk and run on an android device. Meanwhile on Windows the app runs fine.

Code sample

Code
import flet as ft


def main(page: ft.Page):
    dimensions_text = ft.Container(ft.Text(f"Dimensions: {page.width} : {page.height}", text_align="center"), height= 200, width = 200, alignment=ft.alignment.center)
    page.add(dimensions_text)
    page.update()


ft.app(main)

To reproduce

Run the code on Windows and it will work. Build the apk with flet 0.25.2 and it will fail at displaying the page width and height correctly. The command I am using to build the apk is just flet build apk <app_name>. Am I missing something or is it just a bug?

Expected behavior

No response

Screenshots / Videos

Captures

Android

WhatsApp.Video.2025-01-09.at.17.23.14.mp4

Windows

image

Operating System

Windows

Operating system details

Windows 11 and Android 14

Flet version

0.25.2

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions