Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scroll_to with zero duration does nothing #1659

Closed
suncore opened this issue Aug 1, 2023 · 2 comments
Closed

scroll_to with zero duration does nothing #1659

suncore opened this issue Aug 1, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@suncore
Copy link

suncore commented Aug 1, 2023

Calling the .scroll_to() method (on e.g. a listview) with a duration unset or zero does not scroll the listview at all. It seems to work poorly on duration values smaller than 500.
I have listviews with 2000 lines and it seems to "need" at least 500ms to scroll it properly. My graphics are a bit slow since it is over vnc, but that should not be a factor in this.

@FeodorFitsner
Copy link
Contributor

Indeed, it doesn't do anything with duration=0, but it works just fine with duration=1:

import flet as ft


def main(page: ft.Page):
    lv = ft.ListView(spacing=10, padding=20, height=200, width=200)
    for i in range(0, 1000):
        lv.controls.append(ft.Text(f"Line {i}"))

    page.add(
        ft.Container(lv, border=ft.border.all(1)),
        ft.ElevatedButton(
            "Scroll!", on_click=lambda _: lv.scroll_to(offset=-1, duration=1)
        ),
    )


ft.app(target=main)
Screen.Recording.2023-09-14.at.9.50.21.AM.mov

@FeodorFitsner
Copy link
Contributor

I think it makes sense to default duration to 1 if 0 specified by a user.

@FeodorFitsner FeodorFitsner added the bug Something isn't working label Sep 14, 2023
FeodorFitsner added a commit that referenced this issue Nov 6, 2023
zrr1999 pushed a commit to zrr1999/flet that referenced this issue Jul 17, 2024
* AlertDialog uses global state

* DatePicker uses global state

* State on the control level

* Control-level state

Fix flet-dev#2025, Fix flet-dev#1807, Fix flet-dev#1236, Fix flet-dev#1772

* Fix control tests

* Bump fl_chart to 0.64.0

* Fix `scroll_to` with 0 animation duration

Fix flet-dev#1659

* Fix page.width/.height on session start

Fix flet-dev#1960

* Fix Flet version retrieval on non-English environments

Fix flet-dev#1997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants