refactor: add TVGCanvas params (fit, filterQuality, alignment) and introduce PlayState#28
refactor: add TVGCanvas params (fit, filterQuality, alignment) and introduce PlayState#28TaeBbong wants to merge 3 commits intothorvg:mainfrom
Conversation
There was a problem hiding this comment.
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.
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.
Also wondering if we need paused state
There was a problem hiding this comment.
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.
- 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