Skip to content

Height too short when no items are present #390

@refi64

Description

@refi64

Tested with 3.0.0-beta.22. I have a basic flutter create app, where I modified the Column in the default lib/main.dart to be:

// [snip]
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          spacing: 32,
          children: <Widget>[
            Container(
              margin: const EdgeInsets.all(16),
              decoration: BoxDecoration(border: Border.all()),
              child: DropdownButton2(isExpanded: true, items: []),
            ),
            Container(
              margin: const EdgeInsets.all(16),
              decoration: BoxDecoration(border: Border.all()),
              child: DropdownButton2(
                isExpanded: true,
                items: [DropdownItem(child: const Text('item!'))],
              ),
            ),
          ],
        ),
      ),

Essentially, I have two DropdownButton2 widgets, one which is empty and the other with a single item, both with an outline (for visualization purposes). The top one is far too short:

Image

In isolation this makes sense, but it's a bit weird: in my case, it's because the box is empty while loading, so I would get a visual of the smaller box before it expanded to the full size. This can be easily worked around via:

              buttonStyleData: ButtonStyleData(
                height: kMinInteractiveDimension,

which makes sense because kMinInteractiveDimension is the default height of a DropdownItem.

...but, if that's already the default height of the items, shouldn't an empty menu also default to the same height? That way the out-of-the-box behavior is a bit closer to what you might expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions