Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update popup_menu.dart #145816

Closed
wants to merge 4 commits into from
Closed

Conversation

YiQiuYes
Copy link

Fixed the issue that the position of the pop-up menu was offset incorrectly, and the horizontal to the right offset was directly on the right when it was greater than 0.

I can't offset 100 pixels horizontally as I thought before fixing:

schedule.1.mp4

Code Blocks:

  Widget _getLanguageSetting(BuildContext context) {
    return MyPopupMenuButton(
      tooltip: "切换语言",
      initialValue: "简体中文",
      position: PopupMenuPosition.under,
      offset: Offset(100, 0),
      itemBuilder: (context) {
        return [
          PopupMenuItem(
            value: "简体中文",
            child: Text("简体中文"),
          ),
          PopupMenuItem(
            value: "English",
            child: Text("English"),
          ),
        ];
      },
      child: ListTile(
        contentPadding: EdgeInsets.only(
          left: ScreenAdaptor().getLengthByOrientation(
            vertical: 35.w,
            horizon: 20.w,
          ),
        ),
        leading: const Icon(Icons.language_rounded),
        title: Text(S.of(context).settingViewGroupLanguage),
        subtitle: Text("简体中文"),
      ),
    );
  }

After the repair:

schedule.2.mp4

Fixed the issue that the position of the pop-up menu was offset incorrectly, and the horizontal to the right offset was directly on the right when it was greater than 0.
Copy link

google-cla bot commented Mar 27, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Mar 27, 2024
@goderbauer
Copy link
Member

Hello @YiQiuYes, it looks like this is failing some existing tests. Can you take a look at those? Also, this contribution is missing a test (see message from the testing bot above). Could you please add one? Thanks!

@YiQiuYes YiQiuYes closed this Mar 30, 2024
@YiQiuYes YiQiuYes deleted the fix_popup_menu_offset branch March 30, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants