Skip to content

bug: Tabs displays wrong in a Container if Container.alignment is set #5602

@Creeper19472

Description

@Creeper19472

Duplicate Check

Describe the bug

When ft.Tabs exist in a ft.Container, if ft.Container's alignment parameter is specified, then ft.Tabs will display abnormally.

Code sample

Code
# tabs_issue.py
import flet as ft


def main(page: ft.Page):
    page.navigation_bar = ft.NavigationBar(
        destinations=[ft.NavigationBarDestination("111", icon=ft.Icons.ABC)]
    )

    page.add(ft.Card(content=ft.Text("hi")))
    page.add(
        ft.Container(
            content=ft.Tabs(
                tabs=[
                    ft.Tab(
                        "Like", content=ft.Column(controls=[ft.Text("This is a test")])
                    )
                ]
            ),
            margin=10,
            padding=10,
            alignment=ft.alignment.bottom_left, # will cause wrong behavior, regardless of the type of ft.alignment used.
            visible=True,
        )
    )


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

To reproduce

Run the code and the error is displayed

Expected behavior

When running the code provided, I expect the elements to display normally, i.e. the text should be displayed at least under the tab. However, all elements are all crammed into the top left corner, which is a clear mistake.

Screenshots / Videos

Captures Image

Operating System

Windows

Operating system details

Windows 11 26100.4946

Flet version

0.28.3

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs
[None]

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions