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 # Add file picker to page overlay
page.overlay.append(self.file_picker) page.overlay.append(self.file_picker)
# Update the page.add call to include the container instead of table directly # Create a scrollable column for the main content
page.add( main_content = ft.Column(
ft.Row([self.source_dropdown, self.target_dropdown, self.settings_button]), [
ft.Divider(), ft.Row([self.source_dropdown, self.target_dropdown, self.settings_button]),
ft.Text("Input Text", size=16, weight=ft.FontWeight.BOLD), ft.Divider(),
self.input_text, ft.Text("Input Text", size=16, weight=ft.FontWeight.BOLD),
self.process_button, self.input_text,
ft.Divider(), self.process_button,
ft.Text("Flashcard Information", size=16, weight=ft.FontWeight.BOLD), ft.Divider(),
self.stack_name, ft.Text("Flashcard Information", size=16, weight=ft.FontWeight.BOLD),
self.stack_description, self.stack_name,
ft.Divider(), self.stack_description,
ft.Text("Generated Flashcards", size=16, weight=ft.FontWeight.BOLD), ft.Divider(),
flashcard_table_container, # Use the container instead of direct table ft.Text("Generated Flashcards", size=16, weight=ft.FontWeight.BOLD),
ft.Row( flashcard_table_container,
[ ft.Row(
self.add_to_anki_button, [
self.export_yaml_button, self.add_to_anki_button,
self.export_csv_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): def on_source_language_change(self, e):
self.source_language = e.control.value self.source_language = e.control.value