Skip to content
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

Show only last frame when widget is created #59

Open
jaumard opened this issue Mar 22, 2019 · 7 comments
Open

Show only last frame when widget is created #59

jaumard opened this issue Mar 22, 2019 · 7 comments

Comments

@jaumard
Copy link

jaumard commented Mar 22, 2019

I'm checking this https://github.com/2d-inc/Flare-Flutter/blob/master/example/favorite/lib/buttons_row.dart#L51 and I did the same on my flare_checkbox but for a checkbox you may don't want to animate the state when the widget is show for the first time. For example if state is false, playing the off animation when the widget is shown looks weird. So I'm searching a way to only show the last frame when the widget is shown, and on click play the right animation depending on the state.

Any idea how can I implement this ?

@luigi-rosso
Copy link
Contributor

That's interesting, and a good point! A heavy way to do this right now is using a custom controller.

For ease of use, I think we might be able to introduce an optional isAnimated (defaults to true) argument that might help. When it is false, the last frame of the current animation(s) is directly applied.

@luigi-rosso
Copy link
Contributor

I pushed a branch with an example, it's called snap_to_end: https://github.com/2d-inc/Flare-Flutter/tree/snap_to_end

It includes an example that implements this (note it doesn't animate when you open the settings page):
ezgif-1-c0e8e2a09115

Try it out and let me know if it fits your use case. If it does, we can publish an updated package!

@jaumard
Copy link
Author

jaumard commented Mar 25, 2019

Hi @luigi-rosso thanks for this ! from the GIF look like it does the job great ! let me try this !

@jaumard
Copy link
Author

jaumard commented Mar 25, 2019

Ok just tested in this branch https://github.com/jaumard/flare_checkbox/tree/bug/noOn look like it work !!! but on hot reload I have a glitch, first it show the first frame, and them jump to the last one. Not a big deal if it's just during hot reload but I wanted to report it anyway :)

Thanks ! let me know when it's released ! I'll update my package for my #FlutterCreate ^^

@luigi-rosso
Copy link
Contributor

I published this as 1.3.5, I did see the reload issue but that'll require some more fundamental reworking of FlareActor (which I do want to do) such that it applies changes on the current frame, but that'll take a little more time.

@jaumard
Copy link
Author

jaumard commented Mar 26, 2019

Thanks! I let you decide if you want to close the issue or keep it open for this reworking ;)

@jaumard
Copy link
Author

jaumard commented Mar 26, 2019

flare_checkbox 1.0.1 include snapToEnd now 👌

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

No branches or pull requests

2 participants