Skip to content

content_padding not working properly with updated Dropdown in 0.27.0 #4964

Open
@jnsh

Description

@jnsh

Duplicate Check

Describe the bug

In flet <0.27 it was possible to reduce the size of the Dropdown "button" by setting dense=True and adjusting content_padding. With the new implementation in 0.27.0 this does not work properly anymore, even though neither options are marked deprecated in the changelog.

It seems that the padding is now only changed on the left edge, but on top and bottom there seems to be a treshold where the padding can not be reduced further.

Increasing the content_padding still works vertically as it used to.

Also, content_padding does not seem to have any effect any more on the right edge in relation to the down-arrow.

Code sample

Code
import flet as ft

OPTIONS = [
    "Option 1",
    "Option 2",
    "Option 3",
    "Option 4",
    "Option 5",
]

def main(page: ft.Page):
    dropdown = ft.Dropdown(
        label="Label",
        dense=True,
        content_padding=ft.padding.all(8),
        width=float("inf"),
    )
    for status in OPTIONS:
        dropdown.options.append(ft.dropdown.Option(status))

    page.add(
        dropdown
    )

ft.app(main)

To reproduce

  1. Create Dropdown with dense=True and reduce content_padding (e.g. content_padding=ft.padding.all(8)).

The Dropdown vertical size remains the same

Expected behavior

The Dropdown button padding changes as it did with the old Dropdown implementation

Screenshots / Videos

Captures

Flet 0.26.0:
with content_padding=ft.padding.all(8):
Image

with content_padding=ft.padding.all(0):
Image

with content_padding=ft.padding.all(30):
Image

Flet 0.27.0:
with content_padding=ft.padding.all(8):
Image

with content_padding=ft.padding.all(0):
Image

with content_padding=ft.padding.all(30):
Image

Operating System

Linux

Operating system details

Rocky Linux 9.3

Flet version

0.27.1

Regression

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

Suggestions

No response

Logs

No response

Additional details

Regression from 0.26

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontrolshas-upstreamThis issue depends on an upstream issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions