Skip to content

Why does scroll & expand behaves differently in a UserControl #2115

Answered by ndonkoHenri
hplehn asked this question in Q&A
Discussion options

You must be logged in to vote

You need to expand the Usercontrol too. The below example works as expected:

import flet as ft


class FletApp(ft.UserControl):
    def __init__(self, expand=None):
        super().__init__(expand=expand)

    def build(self):
        self.cl = ft.Column(
            spacing=10,
            height=200,
            width=400,
            scroll=ft.ScrollMode.ALWAYS,
        )

        for i in range(0, 50):
            self.cl.controls.append(ft.Text(f"Text line {i}", key=str(i)))

        return ft.Container(
            ft.Column(
                controls=[
                    ft.Text("Title", size=20),
                    ft.Container(self.cl, border=ft.border.all(1), expand=True),
    …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hplehn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants