feat: Editable Canvas using pro_image_editor package#31
feat: Editable Canvas using pro_image_editor package#31mariobehling merged 4 commits intofossasia:mainfrom
Conversation
Reviewer's GuideThis pull request implements an editable canvas feature by integrating the File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @Vishveshwara - I've reviewed your changes - here's some feedback:
- Consider refactoring the editor integration by extracting only essential functionalities from the example files rather than incorporating them wholesale, to tailor it better to the app's needs.
- Abstract hardcoded values (e.g., canvas dimensions like 240x416, asset paths like 'assets/canvas/...') found within
movable_background_image.dartto improve configurability and maintainability.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| TextButton( | ||
| onPressed: () async { | ||
| final canvasBytes = await Navigator.of(context).push<Uint8List>( | ||
| MaterialPageRoute( | ||
| builder: (context) => const MovableBackgroundImageExample(), | ||
| ), | ||
| ); | ||
| imgLoader.updateImage( | ||
| bytes: canvasBytes!, | ||
| width: epd.width, |
There was a problem hiding this comment.
issue: Guard against null return from Navigator.push before force unwrapping.
Check for null canvasBytes before calling updateImage instead of force-unwrapping it.
| final decoded = img.decodeImage(bytes); | ||
| if (decoded != null) { | ||
| final resized = img.copyResize(decoded, width: width, height: height); | ||
| image = resized; | ||
| notifyListeners(); | ||
| } |
There was a problem hiding this comment.
suggestion: Add error handling for image decoding failures.
Log a warning or provide a fallback when decoding returns null to help diagnose failures.
| final decoded = img.decodeImage(bytes); | |
| if (decoded != null) { | |
| final resized = img.copyResize(decoded, width: width, height: height); | |
| image = resized; | |
| notifyListeners(); | |
| } | |
| final decoded = img.decodeImage(bytes); | |
| if (decoded != null) { | |
| final resized = img.copyResize(decoded, width: width, height: height); | |
| image = resized; | |
| notifyListeners(); | |
| } else { | |
| debugPrint("Warning: Failed to decode image from bytes."); | |
| } |
|
@AsCress @kienvo can you please give your opinions on using the pro_image_editor package You can open this link below to find more features we can possibly use. |
fixes #27
Changes
Recording
https://github.com/user-attachments/assets/b2710232-bdb1-4b9a-98ba-0e70db34fa79
Summary by Sourcery
Implement an editable canvas feature using the pro_image_editor package, enabling users to create and manipulate images with multiple editing capabilities
New Features:
Enhancements: