Skip to content

bug: [Flet 0.80.1] How can i expand a dropdown to all horizontal available space ? #6044

@NiTRoeSE

Description

@NiTRoeSE

Duplicate Check

Describe the bug

Hello,

in flet 0.28.3 my dropdowns are correct expanded to all available space using expand=True.
Unfortunately this doesnt work anymore in flet 0.80.1.

Its possible to set a width, but at this point i cant access page.width in my app, the other problem with setting a specific width is that even menu_width key is set the menu goes over the whole page.

I tried also to place the dropdown in a ft.ResponsiveRow and gave col={"sm":12} but that also didnt work.
I think expand=True should work and its maybe a bug that it do nothing on dropdown, i dont know..

Is there any way to let a dropdown use all available space in a page / column / row / container without using the width key ?

Thanks in advanced

Code sample

Code
import flet as ft

def main(page: ft.Page):
    page.spacing = 20
    page.padding = 20

    severity_dropdown =  ft.Dropdown(
                    
                        label="Severity",
                        leading_icon=ft.Icons.WARNING_ROUNDED, 
                        border_color=ft.Colors.ON_TERTIARY_CONTAINER,
                        fill_color=ft.Colors.ON_TERTIARY,
                        filled=True,
                        menu_height=400,
                        menu_width=400,
                        options = [
                            ft.DropdownOption(
                                key="warn",
                                content=ft.Text(
                                    value="Warning (Orange)",
                                    color=ft.Colors.AMBER_400
                                ),
                                
                            ),
                            ft.DropdownOption(
                                key="success",
                                content=ft.Text(
                                    value="Success (Green)",
                                    color=ft.Colors.GREEN_400
                                ),
                                
                            ),
                            ft.DropdownOption(
                                key="info",
                                text="Information (White)"
                            ),
                            ft.DropdownOption(
                                key="danger",
                                content=ft.Text(
                                    value="Danger (Red)",
                                    color=ft.Colors.RED_400
                                ),
                               
                            ),

                        ],
                        expand=True,
                        hover_color=ft.Colors.TRANSPARENT,
                        
                        
        )

    page.add(severity_dropdown)

ft.run(main)

To reproduce

Run code with 0.28.3 --> Works
Run code with 0.80.1 --> Didnt work

Expected behavior

Dropdown should respect expand=True

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

26.0.1

Flet version

0.80.1

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions