Replies: 1 comment
-
same. Here a quick example: import flet as ft
def main(page: ft.Page):
def page_resize(e):
pw.value = f"{page.width} px"
pw.update()
def gen_container():
container = []
for i in range(10):
dummy = ft.Container(
ft.Text(f"Column {i}", style=ft.TextThemeStyle.HEADLINE_LARGE),
padding=5,
bgcolor=ft.colors.RED,
col={"sm": 6, "md": 4, "xl": 2},
)
container.append(dummy)
return container
pw = ft.Text(bottom=50, right=50, style="displaySmall")
rail = ft.NavigationRail(
selected_index=0,
label_type="all",
# extended=True,
min_width=100,
min_extended_width=400,
leading=ft.FloatingActionButton(icon=ft.icons.CREATE, text="Add"),
group_alignment=-0.9,
destinations=[
ft.NavigationRailDestination(
icon=ft.icons.FAVORITE_BORDER, selected_icon=ft.icons.FAVORITE, label="First"
),
ft.NavigationRailDestination(
icon_content=ft.Icon(ft.icons.BOOKMARK_BORDER),
selected_icon_content=ft.Icon(ft.icons.BOOKMARK),
label="Second",
),
ft.NavigationRailDestination(
icon=ft.icons.SETTINGS_OUTLINED,
selected_icon_content=ft.Icon(ft.icons.SETTINGS),
label_content=ft.Text("Settings"),
),
],
on_change=lambda e: print("Selected destination:", e.control.selected_index),
)
def check_item_clicked(e):
e.control.checked = not e.control.checked
page.update()
many_containers = gen_container()
page.title = "AppBar Example"
page.on_resize = page_resize
page.overlay.append(pw)
page.appbar = ft.AppBar(
leading=ft.Icon(ft.icons.PALETTE),
leading_width=40,
title=ft.Text("AppBar Example"),
center_title=False,
bgcolor=ft.colors.SURFACE_VARIANT,
actions=[
ft.IconButton(ft.icons.WB_SUNNY_OUTLINED),
ft.IconButton(ft.icons.FILTER_3),
ft.PopupMenuButton(
items=[
ft.PopupMenuItem(text="Item 1"),
ft.PopupMenuItem(), # divider
ft.PopupMenuItem(
text="Checked item", checked=False, on_click=check_item_clicked
),
]
),
],
)
page.add(
ft.Row(
[
rail,
ft.VerticalDivider(width=1),
ft.Column(
[
ft.Text("Body!"),
ft.ResponsiveRow(many_containers),
],
alignment="start",
expand=True,
scroll = ft.ScrollMode.ALWAYS,
),
],
expand=True,
)
)
ft.flet.app(target=main) It breaks if the scrolling is not necessary. The moment you want scrolling the position of the rows isn't centered any more! You can see that when generating 100 containers, instead of 10. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
when i assing a non default value for scroll property of my Column container,
the main axis alignment changes from Start to Center
Flet version (
0.4.2
):Operating system:
Edge Browser on Windows 10
app(... view=WEB_BROWSER)
Beta Was this translation helpful? Give feedback.
All reactions