flet icon indicating copy to clipboard operation
flet copied to clipboard

Scrolling in a tab isn't smooth in Windows

Open YouCantCMe opened this issue 1 year ago • 4 comments

Using the latest pre release of Flet in Windows 10, scrolling with your middle mouse isn't smooth in a tab. Video below:

https://github.com/flet-dev/flet/assets/73901163/508ae350-8100-4ce6-b364-19c2ca941ee2

Example code:


def main(page: ft.Page):
    page.window_resizable = False
    page.window_width = 400
    page.window_height = 300
    text = ft.Text("Hello, world!")
    container = ft.Container(
        ft.Text("Container"),
        alignment=ft.alignment.top_left,
        col=ft.colors.BLACK,
        height=400,
        key="C",
    )
    text2 = ft.Text("Hello, world!")

    col_content = ft.Column(controls=[text,container,text2], scroll=True)

    tabs = ft.Tabs(
        expand=1,
        tabs=[
            ft.Tab(
                text="Example",
                content=ft.Container(
                    content=col_content,
                ),
            ),
        ],
    )

    page.add(tabs)

ft.app(target=main)

YouCantCMe avatar Mar 09 '24 17:03 YouCantCMe

To achieve smooth scrolling, the documentation suggests using ft.ListView https://flet.dev/docs/controls/listview/

7576457 avatar Mar 09 '24 20:03 7576457

@YouCantCMe

It was tested on Windows and Linux and it works fine. There is not enough data inside to scroll. Try it like this:

import flet as ft

def main(page: ft.Page):
    page.window_resizable = False
    page.window_width = 400
    page.window_height = 300
    text = ft.Text("Hello, world!")
    container = ft.Container(
        ft.Text("Container"),
        alignment=ft.alignment.top_left,
        bgcolor=ft.colors.BLACK38,
        height=400,
        key="C",
    )
    text2 = ft.Text("Hello, world!")

    col_content = ft.Column(
        controls=[
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            text,
            container,
            text2],
        scroll=ft.ScrollMode.ALWAYS
    )

    tabs = ft.Tabs(
        expand=1,
        tabs=[
            ft.Tab(
                text="Example",
                content=ft.Container(
                    content=col_content,
                ),
            ),
        ],
    )

    page.add(tabs)

ft.app(target=main)

burhansvural avatar Mar 10 '24 07:03 burhansvural

To achieve smooth scrolling, the documentation suggests using ft.ListView https://flet.dev/docs/controls/listview/

It still doesn't scroll smoothly using the middle mouse wheel with the provided example.

YouCantCMe avatar Mar 11 '24 18:03 YouCantCMe

Hey, was anyone able to solve it? For me the scrolling is not smooth using the touch pad on my laptop (mouse), the normal mouse wheel works fine.

anamite avatar Apr 09 '24 16:04 anamite