Tencent / Tencent/tdesign-flutter

DropdownMenu 展开后宽度只能整屏宽吗,可否支持宽度自定义

Open
#882 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
1.2k
Forks
182
Avg merge
2d 2h
Merged PRs (30d)
88

Description

TDDropdownMenu`(
        direction: TDDropdownMenuDirection.down,
        width: MediaQuery.of(context).size.width - 24.w,
        items: [
          TDDropdownItem(
            label: '距离',
            options: [
              TDDropdownItemOption(
                label: '500米',
                value: '500',
                selected: selectedDistance == '500',
              ),
              TDDropdownItemOption(
                label: '1 公里',
                value: '1000',
                selected: selectedDistance == '1000',
              ),
              TDDropdownItemOption(
                label: '2 公里',
                value: '2000',
                selected: selectedDistance == '2000',
              ),
              TDDropdownItemOption(
                label: '5 公里',
                value: '5000',
                selected: selectedDistance == '5000',
              ),
              TDDropdownItemOption(
                label: '10 公里',
                value: '10000',
                selected: selectedDistance == '10000',
              ),
            ],
            onChange: (value) {
              print('距离下拉选择器选中值: $value');
              final val = value[0];
              selectedDistance = val as String?;
            },
          )
        ],
        onMenuOpened: (value) {
          print('打开机构类型菜单');
        },
        onMenuClosed: (value) {
          print('关闭机构类型菜单');
        },
      )

Image

给TDDropdownMenu设置宽度后,展开的菜单仍然为全屏宽度,是否可以支持设置展开后菜单宽度,或者展开后菜单跟随TDDropdownMenu宽度,保证两者样式统一

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TDDropdownMenu API and reproduce the example showing that the expanded menu remains full width despite the configured width. Trace how the menu width is determined; done means the expanded menu follows TDDropdownMenu's width or provides a separate explicit width option, with matching styling.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.