[Question] Scrolling inside UserControl #2687
-
QuestionIs there a way in flet current version to scroll inside a UserControl object ? Code sampleimport flet as ft
class MyGrid(ft.UserControl):
def build(self):
self.grid = ft.GridView(
expand=True,
max_extent=150,
child_aspect_ratio=1,
auto_scroll=False,
)
for i in range(5000):
self.grid.controls.append(
ft.Container(
ft.Text(f"Item {i}"),
alignment=ft.alignment.center,
bgcolor=ft.colors.AMBER_100,
border=ft.border.all(1, ft.colors.AMBER_400),
border_radius=ft.border_radius.all(5),
)
)
return self.grid
def main(page: ft.Page):
page.add(MyGrid())
ft.app(target=main) Error messageNo response ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
ndonkoHenri
Feb 20, 2024
Replies: 2 comments 2 replies
-
I have made some modifications to your code, you can try it out |
Beta Was this translation helpful? Give feedback.
1 reply
-
You need to def __init__(self):
super().__init__(expand=True) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
arkham64
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to
expand
the Usercontrol too. Add the method below to the class: