-
Notifications
You must be signed in to change notification settings - Fork 444
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
textfield for log view #4249
Comments
What do you mean you "cannot control the scrollbar". I ran your code and was not able to detect any problem with scrolling. import time
import flet as ft
from datetime import datetime
def get_now_time():
current_time = datetime.now()
formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S')
return formatted_time
def main(page: ft.Page):
page.window.center()
page.window.width = 480
page.window.height = 360
page.window.resizable = False
def btn_click(e):
print(e)
for i in range(200):
column_field.content.controls.append(ft.Text(f"{get_now_time()}......{i + 1}"))
time.sleep(0.1)
page.update()
def jump_click(e):
print(e)
for i in range(200):
column_field.content.scroll_to(delta=50)
column_label = ft.Row(
controls=[ft.Text("write log example")]
)
column_field = ft.Container(
border=ft.border.all(5, ft.colors.GREY),
border_radius=10,
content=ft.Column(
[ft.Text('--------------------------Log-------------------------')],
scroll=ft.ScrollMode.ALWAYS,
expand=True,
spacing=10,
height=200,
width=float("inf"),
)
)
page.add(column_label, column_field)
start_button = ft.ElevatedButton(text='start', color='#499c54', on_click=btn_click)
to_end_button = ft.ElevatedButton(text='jump scroll', color='#499c54', on_click=jump_click)
row = ft.Row(
controls=[
ft.Text(),
to_end_button,
start_button],
alignment=ft.MainAxisAlignment.END
)
page.add(row)
page.update()
if __name__ == '__main__':
ft.app(target=main) |
Set |
aha, How can I modify my code based on it?I think textField should also need a similar attribute,such as auto_scroll or scroll_to_end |
Seems like this issue doesn't have a proper fix in flutter yet. I found some SO threads, but nothing concrete honestly. Let us know if you find a solution which could be implemented. (You could alternatively make use of |
Look forward to your good news |
Duplicate Check
Describe the requested feature
I want to use textfield to create a log window for recording logs, but after recording a lot of logs, I cannot control the scrollbar of textfield. I want to know how to control it. I think there should be methods such as scoll_to-end
Suggest a solution
maybe add a func scoll_to_end
Screenshots
No response
Additional details
No response
The text was updated successfully, but these errors were encountered: