Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#6,705 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
android, flutter, python
Lĩnh vực
frontend, mobile

Hướng nghiên cứu

Bắt đầu với bản tái hiện ft.app được cung cấp và xác minh cây con có chiều cao bằng 0 trên Android, sau đó so sánh với hành vi trên desktop. Theo dõi cách Dropdown(expand=True) được xử lý qua chuỗi layout di động của Flutter, đặc biệt bên trong ListView và Column. Được xem là hoàn tất khi Card và Dropdown của nó được render ở chiều cao nội tại trên Android mà không làm hỏng cây con xung quanh, đồng thời hành vi của workaround vẫn được giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
17.1k
Fork
708
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flet-dev/flet

Tất cả issue của flet-dev/flet

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.