Skip to content

Conversation

ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Jul 6, 2024

Fixes #3546

Tried another approach, but the issue is still present.

AI's opinion on the cause of the issue:

When you run your Flutter application on the web, the Dart compiler minifies the code to reduce the size of the JavaScript output. This process often includes renaming classes and variables to shorter names (e.g., aj_) to optimize the code for performance and load times. As a result, PointerHoverEvent might be minified to something like aj_, making it harder to understand directly from the debug output.

What I found strange is the fact that, when testing on web using flutter run -d chrome it works (shows the right types).

Summary by Sourcery

This pull request addresses the issue with PieChartEvent.type on web by mapping Flutter event types to readable event names. It also enhances the event data by adding local position information and introduces an enum for event types in the Python SDK.

  • Bug Fixes:
    • Fixed the issue with PieChartEvent.type on web by mapping Flutter event types to readable event names.
  • Enhancements:
    • Added localPosition to PieChartEventData to capture the local position of events.
    • Introduced PieChartEventType enum in Python to standardize event type values.

Copy link
Contributor

sourcery-ai bot commented Jul 6, 2024

Reviewer's Guide by Sourcery

This pull request addresses issue #3546 by improving the event handling in the PieChart component for web. It introduces a mapping for Flutter event types to string representations and includes local position data in the event payload. Additionally, minor adjustments were made to the Theme and ScrollableControl classes for better type handling and code cleanup.

File-Level Changes

Files Changes
packages/flet/lib/src/controls/piechart.dart
sdk/python/packages/flet-core/src/flet_core/charts/pie_chart.py
Enhanced event handling in PieChart by mapping Flutter event types to string representations and including local position data.
sdk/python/packages/flet-core/src/flet_core/theme.py
sdk/python/packages/flet-core/src/flet_core/scrollable_control.py
Minor adjustments to Theme and ScrollableControl classes for better type handling and code cleanup.

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 and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🟢 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.

Comment on lines +18 to +27
const eventMap = {
"FlPointerEnterEvent": "pointerEnter",
"FlPointerExitEvent": "pointerExit",
"FlPointerHoverEvent": "pointerHover",
"FlPanCancelEvent": "panCancel",
"FlPanDownEvent": "panDown",
"FlPanEndEvent": "panEnd",
"FlPanStartEvent": "panStart",
"FlPanUpdateEvent": "panUpdate",
"FlLongPressEnd": "longPressEnd",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Consider making eventMap private

If eventMap is only used within this file, consider prefixing it with an underscore to indicate that it is private and should not be accessed from outside this module.

@FeodorFitsner
Copy link
Contributor

Can you resolve conflict here please?

# Conflicts:
#	sdk/python/packages/flet-core/src/flet_core/charts/pie_chart.py
#	sdk/python/packages/flet-core/src/flet_core/scrollable_control.py
@FeodorFitsner FeodorFitsner merged commit 7408913 into main Jul 23, 2024
@FeodorFitsner FeodorFitsner deleted the piechart-event-type branch August 5, 2024 18:08
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.

Web event type names differ from app event type names
2 participants