Skip to content

Dropdown(expand=True) silently breaks rendering of entire widget subtree on Android (Flutter mobile) #6705

Description

@Twilight0

Describe the bug

When ft.Dropdown(expand=True) is placed inside a layout chain of ColumnCardListView(expand=True) (which in turn sits inside an AnimatedSwitcher(expand=True) or similar expanding ancestor), the entire widget subtree fails to render on Android. On desktop (Flets own engine / Linux/Windows) it works fine — the Dropdown clamps to its intrinsic height and the rest of the tree renders normally.

No error or exception is raised in Python — the page.update() succeeds silently. The Flutter layout pass simply collapses the whole subtree to zero height.

To Reproduce

import flet as ft

def main(page: ft.Page):
    page.add(
        ft.SafeArea(
            expand=True,
            content=ft.Column([
                ft.Text("Top bar"),
                ft.Container(
                    expand=True,
                    content=ft.ListView(
                        expand=True,
                        controls=[
                            ft.Card(
                                content=ft.Container(
                                    padding=15,
                                    content=ft.Column([
                                        ft.Text("Card title", size=18, weight=ft.FontWeight.BOLD),
                                        ft.Dropdown(
                                            expand=True,  # ← THIS LINE CAUSES THE BUG
                                            options=[
                                                ft.dropdown.Option("a", "Option A"),
                                                ft.dropdown.Option("b", "Option B"),
                                            ],
                                        ),
                                    ])
                                )
                            )
                        ]
                    )
                )
            ], spacing=0)
        )
    )

ft.app(target=main)

Result on Android: The screen shows only "Top bar" — the entire Container/ListView/Card below it is invisible (zero-height).
Expected: The Card should render with the Dropdown at its intrinsic height, same as on desktop.

Workaround

Remove expand=True from the Dropdown (or any nested Dropdown inside an expanding scrollable):

ft.Dropdown(  # no expand=True
    options=[...]
)

Environment

  • Flet version: 0.86.1 (also affects 0.28+ — likely all versions)
  • Platform: Android (Flutter mobile engine)
  • Desktop: works correctly on Linux, Windows, macOS

Root Cause (educated guess)

On desktop, Flutters layout engine clamps unbounded expand requests from a Dropdown to its intrinsic height. On mobile (Android Flutter), the same unconstrained height propagates upward and causes the layout to resolve the entire branch to zero height — effectively a silent layout failure with no error surface shown to the user or the developer.

This is related to how Flutter handles double.infinity constraints inside a Column when a child requests expand=True without an intrinsic size limit. Dropdown is a FormFieldControl whose intrinsic height is finite, but the expand=True flag may bypass that and push infinite height to the parent Column, which cascades up through CardListView.

Suggested Fix

Dropdown(expand=True) should clamp to its intrinsic height rather than propagating unconstrained height, or the Flet framework should warn at the Python level when Dropdown (or similar intrinsic-sized controls) is given expand=True inside a scrollable parent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions