Dropdown(expand=True) silently breaks rendering of entire widget subtree on Android (Flutter mobile)
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
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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của flet-dev/flet
-
bug controls
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: Interactive Viewer renders grey text when passed alignmentCó thể đã có người làm @ndonkoHenri đã nhận 5 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
flet-dev/flet#6744 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
feature: Dropdown on_click eventĐang mởfeature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của flet-dev/flet
Issue tương tự
-
Claiming namespace `apoint`Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
EclipseFdn/open-vsx.org#13573 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
collective/icalendar#1854 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rancher/rancher-ai-agent#412 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TUDelftGeodesy/DePSI#134 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HenriquesLab/rxiv-maker#335 ·