You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the opened issues and there are no duplicates
Describe the bug
if slider number value is greater than last visible element order number or less than first visible element order number (the absolute delta depends on window size)
Code sample
Code
importfletcontent= ['Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum']
defmain(page: flet.Page):
lv_items=flet.ListView(expand=1, spacing=0, padding=flet.padding.all(0.0), auto_scroll=False)
page.add(lv_items)
defbs_scroll_to_show(e):
scroll_to_slider.max=100scroll_to_slider.divisions=100bs_scroll_to.open=Truebs_scroll_to.update()
defupdate_scroll_to_val(e):
scroll_to_value.value=round(scroll_to_slider.value)
scroll_to_value.update()
defbs_scroll_to_dismiss(e):
bs_scroll_to.open=Falsebs_scroll_to.update()
deftest_scroll_to(e):
print(round(scroll_to_slider.value))
# bs_scroll_to_dismiss(e)lv_items.scroll_to(key=str(round(scroll_to_slider.value)), duration=500)
defscroll_to_start(e):
lv_items.scroll_to(offset=0, duration=250)
defscroll_to_end(e):
lv_items.scroll_to(offset=-1, duration=250)
foriinrange(100):
lv_items.controls.append(
flet.ListTile(
leading=flet.Text(f'{str(i+1)}'.rjust(3, ' '), italic=True, no_wrap=False, text_align=flet.TextAlign.START, color=flet.colors.RED),
title=flet.Text(content[i%2], no_wrap=False, overflow=flet.TextOverflow.VISIBLE, font_family='verse_text', text_align=flet.TextAlign.LEFT),
dense=True,
visual_density=flet.VisualDensity.COMPACT,
key=str(i+1),
on_click=bs_scroll_to_show
)
)
lv_items.update()
scroll_to_value=flet.Text('1', size=24)
scroll_to_slider=flet.Slider(min=1, max=1, value=1, divisions=100, on_change_end=test_scroll_to, on_change=update_scroll_to_val)
bs_scroll_to=flet.BottomSheet(
content=flet.Container(
content=flet.Column(
[
scroll_to_value,
scroll_to_slider,
flet.ElevatedButton("to start", on_click=scroll_to_start),
flet.ElevatedButton("to end", on_click=scroll_to_end),
],
spacing=10,
tight=True,
horizontal_alignment=flet.CrossAxisAlignment.CENTER,
scroll=None
), padding=10
),
on_dismiss=bs_scroll_to_dismiss
)
page.overlay.append(bs_scroll_to)
page.update()
flet.app(target=main, view=flet.AppView.FLET_APP)
To reproduce
run code
click on item to show bottom menu
use slider to set number bigger or smaller than last or first visible item order number
Expected behavior
to scroll to specific key (order number in this example is the same as key value)
Screenshots / Videos
Captures
[Upload media here]
scroll_to_test.mp4
Operating System
Windows
Operating system details
Windows 10 Pro
Flet version
flet-0.24.0 flet-core-0.24.0 flet-runtime-0.24.0
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
The text was updated successfully, but these errors were encountered:
ndonkoHenri
changed the title
scroll_to method doesn't scroll to specific key of ListView layout component if specific item is not visible and ...
Optional on-demand creation of ListView.controlsNov 27, 2024
Duplicate Check
Describe the bug
if slider number value is greater than last visible element order number or less than first visible element order number (the absolute delta depends on window size)
Code sample
Code
To reproduce
Expected behavior
to scroll to specific key (order number in this example is the same as key value)
Screenshots / Videos
Captures
[Upload media here]
scroll_to_test.mp4
Operating System
Windows
Operating system details
Windows 10 Pro
Flet version
flet-0.24.0 flet-core-0.24.0 flet-runtime-0.24.0
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]
Additional details
No response
The text was updated successfully, but these errors were encountered: