-
-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: add TVGCanvas params (fit, filterQuality, alignment) and introduce PlayState #28
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the ThorVG library to improve code clarity and flexibility by replacing boolean state flags with an enum and exposing previously hardcoded canvas parameters.
- Introduced
PlayStateenum to replace multiple boolean flags for better state management - Exposed
fit,filterQuality, andalignmentas constructor parameters inTVGCanvas - Updated all state checks to use the new enum values instead of boolean flags
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/src/thorvg.dart | Replaced boolean state flags with PlayState enum and updated all state validation logic |
| lib/src/lottie.dart | Added constructor parameters for canvas rendering options and updated repaint logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
tinyjin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Please check comments
lib/src/thorvg.dart
Outdated
| final ThorVGFlutterBindings tvg = ThorVGFlutterBindings(_dylib); | ||
|
|
||
| /* ThorVG Play State */ | ||
| enum PlayState { stopped, playing, deleted } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also wondering if we need paused state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pause/Resume functions are quite general, essential functions as a player.
If we select either Paused vs Frozen -> Paused win.
Eventually, we might need these enough status definition.
Uninitialized //any file is not loaded yet.
Loading (optional) //this needs only player supports async loading
Ready
Playing
Paused
Frozen
Stopped
Error
Destroyed //Hmm... Is it possible to query this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The player needs to support user event listening for activation and deactivation events (such as for Frozen).
b8d4351 to
878beb1
Compare
f53f9b7 to
d1a85e8
Compare
|
@TaeBbong |
d1a85e8 to
1f1f66d
Compare
1f1f66d to
9037d43
Compare
- simply aligned with existing web player
9037d43 to
248f93e
Compare


Summary
NOTES/FIXME.Changes
TVGCanvas
fit,filterQuality,alignmentas constructor params (were hardcoded defaults).Thorvg play state
PlayStateenum for readability and state safety.Before → After
Play state
Update flow