Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#6,705 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
android, flutter, python
Ambito
frontend, mobile

Direzione di ricerca

Inizia con la riproduzione ft.app fornita e verifica il sottoalbero ad altezza zero su Android, quindi confrontalo con il comportamento su desktop. Traccia come viene gestito Dropdown(expand=True) attraverso la catena di layout mobile di Flutter, soprattutto all’interno di ListView e Column. Il lavoro è completato quando Card e il relativo Dropdown vengono renderizzati all’altezza intrinseca su Android senza compromettere il sottoalbero circostante, mentre il comportamento del workaround rimane intatto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

When ft.Dropdown(expand=True) is placed inside a layout chain of Column → Card → ListView(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 Card → ListView.

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.

Lingua principale
Python
Stelle
17.1k
Fork
708
Merge medio
1g 17h
PR unite (30g)
46

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flet-dev/flet

Tutte le issue di flet-dev/flet

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.