Skip to content

feat: scrollable ExpansionPanelList#6294

Merged
FeodorFitsner merged 6 commits intomainfrom
expansionpanellist-scroll
Mar 17, 2026
Merged

feat: scrollable ExpansionPanelList#6294
FeodorFitsner merged 6 commits intomainfrom
expansionpanellist-scroll

Conversation

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Mar 10, 2026

Test code

import flet as ft


def main(page: ft.Page):
    page.add(
        ft.SafeArea(
            expand=True,
            content=ft.ExpansionPanelList(
                expand=True,
                scroll=ft.ScrollMode.ALWAYS,
                spacing=8,
                on_change=print,
                controls=[
                    ft.ExpansionPanel(
                        can_tap_header=True,
                        header=ft.ListTile(title=ft.Text(f"Panel {i}")),
                        content=ft.ListTile(
                            title=ft.Text(f"Details for panel {i}"),
                            subtitle=ft.Text(
                                "This content can be expanded or collapsed."
                            ),
                        ),
                    )
                    for i in range(1, 41)
                ],
            ),
        ),
    )


ft.run(main)

Summary by Sourcery

Add scrolling support and richer change events to ExpansionPanelList, and update associated docs and examples.

New Features:

  • Make ExpansionPanelList a scrollable control with configurable scroll behavior.
  • Introduce ExpansionPanelListChangeEvent to provide structured payloads for panel toggle events, including index and expanded state.

Enhancements:

  • Improve ExpansionPanel and ExpansionPanelList docstrings with clearer behavior descriptions and examples.
  • Wrap ExpansionPanelList in scroll notification handling when on_scroll is enabled.
  • Adjust ExpansionPanelList change event payload to include both index and expanded state instead of just raw index data.

Documentation:

  • Document ExpansionPanelList scrolling support and add a dedicated scrollable example snippet to the control docs.
  • Add API documentation page and navigation entry for ExpansionPanelListChangeEvent.

@ndonkoHenri ndonkoHenri moved this to 👀 In review in Flet Development Mar 10, 2026
@ndonkoHenri ndonkoHenri added the feature request Suggestion/Request for additional feature label Mar 10, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 10, 2026

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: fe32290
Status: ✅  Deploy successful!
Preview URL: https://f41b7c1c.flet-examples.pages.dev
Branch Preview URL: https://expansionpanellist-scroll.flet-examples.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class scrolling support to the Material ExpansionPanelList control (Python + Flutter runtime) and upgrades its on_change event to a typed payload so handlers can reliably access both the toggled panel index and its expanded/collapsed state.

Changes:

  • Make ExpansionPanelList scrollable by mixing in ScrollableControl (Python) and wrapping the Flutter widget with ScrollableControl/ScrollNotificationControl.
  • Introduce ExpansionPanelListChangeEvent and wire on_change to deliver {index, expanded} (while keeping data=index for backward compatibility).
  • Update docs and examples to describe and demonstrate scrollable ExpansionPanelList, and add the new event type page to the docs nav.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/python/packages/flet/src/flet/controls/material/expansion_panel.py Adds ExpansionPanelListChangeEvent, switches ExpansionPanelList to ScrollableControl, updates on_change typing/docstrings.
sdk/python/packages/flet/src/flet/init.py Exposes ExpansionPanelListChangeEvent at the top-level flet package.
sdk/python/packages/flet/mkdocs.yml Registers the new event type doc page in navigation.
sdk/python/packages/flet/docs/types/expansionpanellistchangeevent.md Adds generated docs page for the new event payload type.
sdk/python/packages/flet/docs/controls/expansionpanellist.md Documents scrolling support and links a new scrollable example.
sdk/python/examples/controls/expansion_panel_list/scrollable.py Adds runnable example demonstrating scroll=ScrollMode.ALWAYS.
packages/flet/lib/src/controls/expansion_panel.dart Wraps ExpansionPanelList in ScrollableControl and updates the change event payload to a dict including index and expanded.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 10, 2026

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: fe32290
Status: ✅  Deploy successful!
Preview URL: https://63a4344f.flet-docs.pages.dev
Branch Preview URL: https://expansionpanellist-scroll.flet-docs.pages.dev

View logs

@FeodorFitsner FeodorFitsner added this to the 0.83.0 milestone Mar 13, 2026
@github-project-automation github-project-automation bot moved this from 👀 In review to 🔖 Ready in Flet Development Mar 17, 2026
@FeodorFitsner FeodorFitsner merged commit ad869f5 into main Mar 17, 2026
76 of 105 checks passed
@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in Flet Development Mar 17, 2026
@FeodorFitsner FeodorFitsner deleted the expansionpanellist-scroll branch March 17, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Suggestion/Request for additional feature

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants