How to set the height of a Container to expand to the window size? #3823
-
When the structure of layout controls is:
To make Sub-column 2 scrollable, a solution was to set the height value for the Container. In the example below, removing Code sampleimport flet as ft
itemList = [ft.Text(f"item {x}") for x in range(50)]
def main(page: ft.Page):
page.controls.append(
# Can this be adjusted to the window height?
ft.Container(
height=500,
padding=20,
content=ft.Column(
controls=[
# Sub-column 1 (should not scroll)
ft.Column(
controls=[ft.Text("Upper part - shouldn't scroll")],
),
# Sub-column 2 (should scroll)
ft.Column(
expand=True,
scroll=ft.ScrollMode.AUTO,
controls=[
ft.Text("Lower part - should scroll"),
ft.ExpansionTile(
title=ft.Text("ExpansionTile"),
controls=[
ft.ListView(
controls=itemList
)
]
)
]
),
]
)
),
)
page.update()
ft.app(main) Error messageNo response ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
ndonkoHenri
Aug 17, 2024
Replies: 1 comment 2 replies
-
Set the |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ndonkoHenri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the
expand
property of theContainer
toTrue
, to make it fill the page.