feat: make main window scrollable with auto-scroll column

This commit is contained in:
Yandrik (aider) 2025-03-19 23:19:43 +01:00
parent 28492688a5
commit 73ed02eac8

49
main.py
View File

@ -156,29 +156,36 @@ class FlashcardCreator:
# Add file picker to page overlay
page.overlay.append(self.file_picker)
# Update the page.add call to include the container instead of table directly
page.add(
ft.Row([self.source_dropdown, self.target_dropdown, self.settings_button]),
ft.Divider(),
ft.Text("Input Text", size=16, weight=ft.FontWeight.BOLD),
self.input_text,
self.process_button,
ft.Divider(),
ft.Text("Flashcard Information", size=16, weight=ft.FontWeight.BOLD),
self.stack_name,
self.stack_description,
ft.Divider(),
ft.Text("Generated Flashcards", size=16, weight=ft.FontWeight.BOLD),
flashcard_table_container, # Use the container instead of direct table
ft.Row(
[
self.add_to_anki_button,
self.export_yaml_button,
self.export_csv_button,
]
),
# Create a scrollable column for the main content
main_content = ft.Column(
[
ft.Row([self.source_dropdown, self.target_dropdown, self.settings_button]),
ft.Divider(),
ft.Text("Input Text", size=16, weight=ft.FontWeight.BOLD),
self.input_text,
self.process_button,
ft.Divider(),
ft.Text("Flashcard Information", size=16, weight=ft.FontWeight.BOLD),
self.stack_name,
self.stack_description,
ft.Divider(),
ft.Text("Generated Flashcards", size=16, weight=ft.FontWeight.BOLD),
flashcard_table_container,
ft.Row(
[
self.add_to_anki_button,
self.export_yaml_button,
self.export_csv_button,
]
),
],
scroll=ft.ScrollMode.AUTO,
expand=True,
)
# Add the scrollable content to the page
page.add(main_content)
def on_source_language_change(self, e):
self.source_language = e.control.value