Skip to content

PAINTROID-729 Refactor Converters#160

Open
Amit-Matth wants to merge 1 commit into
Catrobat:developfrom
Amit-Matth:PAINTROID-729
Open

PAINTROID-729 Refactor Converters#160
Amit-Matth wants to merge 1 commit into
Catrobat:developfrom
Amit-Matth:PAINTROID-729

Conversation

@Amit-Matth
Copy link
Copy Markdown
Contributor

@Amit-Matth Amit-Matth commented May 13, 2026

This pull request refactors the path serialization logic to eliminate external converters and centralize JSON logic within the models themselves.

PAINTROID-729

New Features and Enhancements

  • Unified Path Serialization: Introduced a new PathModel that encapsulates both the native Flutter Path and its drawing action history.
  • Self-Serializing Models: Moved fromJson and toJson logic directly into the PathModel and PathAction classes using json_serializable.
  • Version Awareness: Implemented versioning for PathModel (consistent with CatrobatImage) to ensure robust project loading and future-proofing.

Refactorings and Bug Fixes

  • Converter Removal: Deleted the obsolete PathActionConverter and PathWithActionHistoryConverter classes.
  • Improved Maintainability: Simplified PathCommand and LineCommand by using explicitToJson: true, allowing for cleaner nested object serialization.
  • Backward Compatibility: Added a safety check in PathModel.fromJson to correctly handle and migrate legacy projects saved without a version number.
  • Test Suite Modernization: Updated over 40 unit and widget tests to align with the new model architecture.
  • Tool Refactoring: Updated BrushTool and LineTool to utilize the improved PathModel lifecycle.

Checklist

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Add the link to the ticket in Jira in the description of the PR: PAINTROID-729
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines (Wiki)
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Add new information to the Wiki

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.

1 participant