Skip to content

fix: clicking on CupertinoContextMenuAction doesn't close context menu #3948

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

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Sep 7, 2024

Summary by Sourcery

Fix the issue where clicking on a CupertinoContextMenuAction does not close the context menu by adding a pop action. Improve the error message in CupertinoContextMenu for better clarity and remove an unnecessary debug print statement from PopupMenuButtonControl. Correct the return type of get_input_devices_async in audio_recorder.py to return a dictionary instead of a boolean.

Bug Fixes:

  • Ensure that clicking on a CupertinoContextMenuAction closes the context menu by adding a call to Navigator.of(context).pop() in the onPressed callback.

Enhancements:

  • Correct the error message in CupertinoContextMenu to improve clarity by fixing a grammatical error.

Chores:

  • Remove a debug print statement from PopupMenuButtonControl to clean up the code.

Copy link
Contributor

sourcery-ai bot commented Sep 7, 2024

Reviewer's Guide by Sourcery

This pull request addresses an issue with the CupertinoContextMenuAction not closing the context menu when clicked. It also includes minor improvements to error messages, type annotations, and removes debug printing.

File-Level Changes

Change Details Files
Fix CupertinoContextMenuAction to close the context menu when clicked
  • Remove unnecessary DefaultTextStyle widget
  • Add Navigator.of(context).pop() to close the menu on click
  • Simplify child widget creation
packages/flet/lib/src/controls/cupertino_context_menu_action.dart
Improve error message in CupertinoContextMenu
  • Fix typo in error message for CupertinoContextMenu.actions
packages/flet/lib/src/controls/cupertino_context_menu.dart
Correct return type annotation in AudioRecorder
  • Change return type of get_input_devices_async from bool to dict
sdk/python/packages/flet-core/src/flet_core/audio_recorder.py
Remove debug print statement in PopupMenuButton
  • Delete debugPrint line for showing tooltip
packages/flet/lib/src/controls/popup_menu_button.dart

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ndonkoHenri - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining the reason for calling Navigator.of(context).pop() in the CupertinoContextMenuAction's onPressed callback.
  • Verify that removing the DefaultTextStyle wrapper in CupertinoContextMenuAction doesn't negatively impact text styling. If it's intentional, consider adding a comment explaining the change.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@FeodorFitsner FeodorFitsner merged commit 8fa4706 into main Oct 29, 2024
2 checks passed
@FeodorFitsner FeodorFitsner deleted the cupertino-context-menu-pop-view branch October 29, 2024 17:58
pengwon added a commit to pengwon/flet that referenced this pull request Oct 30, 2024
* main: (31 commits)
  Migrate `colors` and `icons` variables to Enums (flet-dev#4180)
  feat: expose more properties in Controls (flet-dev#4105)
  feat!: Refactor `Badge` Control to a Dataclass; create new `Control.badge` property (flet-dev#4077)
  fix: clicking on `CupertinoContextMenuAction` doesn't close context menu (flet-dev#3948)
  fix dropdown `max_menu_height` (flet-dev#3974)
  Fix undefined name "Future" --> asyncio.Future (flet-dev#4230)
  wrap ListTile in material widget (flet-dev#4206)
  Update CONTRIBUTING.md (flet-dev#4208)
  TextField: suffix_icon, prefix_icon and icon can be Control or str (flet-dev#4173)
  feat!: enhance `Map` control (flet-dev#3994)
  skip running flutter doctor on windows if no_rich_output is True (flet-dev#4108)
  add --pyinstaller-build-args to pack cli command (flet-dev#4187)
  fix/feat: make `SearchBar`'s view height adjustable; add new properties (flet-dev#4039)
  fix: prevent button `style` from being modified in `before_update()` (flet-dev#4181)
  fix: disabling filled buttons is not visually respected (flet-dev#4090)
  when `label` is set, use `MainAxisSize.min` for the `Row` (flet-dev#3998)
  fix: `NavigationBarDestination.disabled` has no visual effect (flet-dev#4073)
  fix autofill in CupertinoTextField (flet-dev#4103)
  Linechart: jsonDecode tooltip before displaying (flet-dev#4069)
  fixed bgcolor, color and elevation (flet-dev#4126)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants