Skip to content

bug: page.vertical_alignment = CENTER stops vertically centering content when page.scroll is enabled #6446

@ndonkoHenri

Description

@ndonkoHenri

When page.scroll is set, even to ft.ScrollMode.HIDDEN, page.vertical_alignment = ft.MainAxisAlignment.CENTER no longer centers page content vertically. The content remains horizontally centered, but it is positioned near the top of the page.

Originally reported on Discord.

Repro

import flet as ft


def main(page: ft.Page):
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
    page.vertical_alignment = ft.MainAxisAlignment.CENTER
    page.scroll = ft.ScrollMode.HIDDEN

    page.add(ft.Text("Center"))


if __name__ == "__main__":
    ft.run(main)

Expected behavior

The text should be centered both horizontally and vertically, matching behavior when page.scroll is not set.

Image

Actual behavior

The text is centered horizontally, but appears near the top vertically.

Image

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

👀 In review

Relationships

None yet

Development

No branches or pull requests

Issue actions