flet icon indicating copy to clipboard operation
flet copied to clipboard

Scrolling inertia is lost when executing the example on the `Large lists` page with `FLET_APP` option.

Open knttnk opened this issue 2 years ago • 4 comments

Description

Inertia of scrolling is lost when executing the example on the Large lists page.

Code example to reproduce the issue:

For example,

import flet as ft

def main(page: ft.Page):
    lv = ft.ListView(expand=True, spacing=10)
    for i in range(5000):
        lv.controls.append(ft.Text(f"Line {i}"))
    page.add(lv)

ft.app(target=main, view=ft.AppView.FLET_APP)

Note that WEB_BROWSER in the last line is replaced with FLET_APP.

This is the second example in Large lists, but all examples result in the same problem.

Describe the results you received:

With the touchpad on my Windows 11 laptop, I scroll quickly and release it, and it immediately stops. Shown in the left side in this video.

https://github.com/flet-dev/flet/assets/61683744/84b16724-4e4f-4be6-9925-c92b8015bd49

Describe the results you expected:

Keeps scrolling even I released my finger. Shown in the right side in the above video. I could view 100 items in few seconds.

Additional information you deem important (e.g. issue happens only occasionally):

The right side of the above video is with view=ft.AppView.WEB_BROWSER. So this is the problem about FLET_APP.

I think #1353 is related, but I think it's not resolved and I provided more specific information.

Flet version (pip show flet): pip show flet

Name: flet
orm apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: C:\Users\[username]\miniconda3\envs\flet-test\Lib\site-packages
Requires: cookiecutter, flet-runtime, packaging, qrcode, watchdog, websocket-client, websockets
Required-by:

pip list

Package               Version
--------------------- ------------
anyio                 4.0.0
arrow                 1.3.0
autopep8              1.6.0
binaryornot           0.4.4
certifi               2023.11.17
chardet               5.2.0
charset-normalizer    3.3.2
click                 8.1.7
colorama              0.4.6
cookiecutter          2.4.0
flet                  0.12.2
flet-core             0.12.2
flet-runtime          0.12.2
h11                   0.14.0
httpcore              0.17.3
httpx                 0.24.1
idna                  3.4
Jinja2                3.1.2
markdown-it-py        3.0.0
MarkupSafe            2.1.3
mdurl                 0.1.2
mypy                  1.5.1
mypy-extensions       1.0.0
oauthlib              3.2.2
packaging             23.2
pip                   23.3
psutil                5.9.0
pycodestyle           2.10.0
Pygments              2.16.1
pypng                 0.20220715.0
python-dateutil       2.8.2
python-slugify        8.0.1
PyYAML                6.0.1
qrcode                7.4.2
repath                0.9.0
requests              2.31.0
rich                  13.7.0
setuptools            68.0.0
six                   1.16.0
sniffio               1.3.0
text-unidecode        1.3
toml                  0.10.2
types-python-dateutil 2.8.19.14
typing_extensions     4.7.1
urllib3               2.1.0
watchdog              3.0.0
websocket-client      1.6.4
websockets            11.0.3
wheel                 0.41.2

Operating system: Windows 11 Pro 23H2

knttnk avatar Nov 18 '23 14:11 knttnk

https://github.com/flet-dev/flet/blob/4ff25a07f7f8a11668534b87bc06311014f6392d/package/lib/src/controls/scrollable_control.dart#L48-L50 https://github.com/flet-dev/flet/blob/4ff25a07f7f8a11668534b87bc06311014f6392d/package/lib/src/widgets/adjustable_scroll_controller.dart#L6-L17

I think these lines are related. What does AdjustableScrollController do?

knttnk avatar Nov 18 '23 23:11 knttnk

What does AdjustableScrollController do?

It "speeds up" scrolling with a mouse on Windows; otherwise it's dead slow.

FeodorFitsner avatar Nov 19 '23 18:11 FeodorFitsner

I have noticed that I do not have this scrolling problem when using TextField.

import flet as ft

def main(page: ft.Page):
    tb1 = ft.TextField(
        label="Scrollable",
        value="\n".join([f"very ({i})" for i in range(1000)]) + "\nlong text",
        multiline=True,
        min_lines=10,
        max_lines=10,
    )
    page.add(tb1)
    page.update()

ft.app(target=main)

And, I have never experienced slow scrolling with Flutter on Windows so far. Is it possible that the scrolling problem was solved a long time ago and AdjustableScrollController is no longer needed?

knttnk avatar Nov 20 '23 06:11 knttnk

I also have this issue on the windows desktop app only when using a trackpad. Seems to scroll only by that fixed amount 80. Using a mouse wheel works fine.

baebranch avatar Jul 02 '24 00:07 baebranch

I think https://github.com/flet-dev/flet/pull/4145 has fixed this.

knttnk avatar Aug 25 '25 13:08 knttnk