Skip to content

v1: Canvas.capture() and GestureDetector right-click pan updates. #5444

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Jul 14, 2025

Close #5434

Summary by Sourcery

Enable canvas capture and image shape support, add right-click pan events to GestureDetector, integrate custom Msgpack encoder, and apply various utility and housekeeping improvements

New Features:

  • Implement Canvas.capture, get_capture, and clear_capture methods with image rendering support
  • Add Image shape to Canvas with asynchronous image loading and hashing
  • Introduce on_right_pan_start, on_right_pan_update, and on_right_pan_end events for right-click panning in GestureDetector
  • Integrate custom FletMsgpackEncoder for extended Msgpack serialization in JS and WebSocket backends
  • Expose capture and clear_capture methods in Python Canvas control and add Python Canvas Image shape class

Enhancements:

  • Remove unused imports and parameters in Markdown and Image controls and adjust buildImage signature
  • Fix case-sensitive control type matching for Container and Image in size constraints
  • Update default pageUrl scheme to http in client main.dart and reorder flet_charts import
  • Add fnv1aHash utility for image hashing

Other canvas changes:
- canvas drawing is clipped
- canvas size is stretched to maximum if `expand` is set
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.

We've reviewed this pull request using the Sourcery rules engine

Copy link

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 15af0f9
Status:🚫  Build failed.

View logs

Comment on lines +303 to +304
Event handler argument is of type
[`PointerEvent`](https://flet.dev/docs/reference/types/PointerEvent).
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't need to be specified anymore, as discussed.

@@ -50,6 +50,7 @@ class PageMediaData:
padding: Padding
Copy link
Contributor

Choose a reason for hiding this comment

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

While at it, can you please document the properties here directly?

paint: Optional[Paint] = None
"""
A paint to composite the image into canvas. The value of this property
is the instance of [`Paint`](https://flet.dev/docs/reference/types/paint) class.
Copy link
Contributor

Choose a reason for hiding this comment

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

The type and default values of properties shouldnt be specified in the docstring, as discussed.

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.

v1: Canvas buffered shapes (recording), Image shape
2 participants