ariedov / flutter_snaplist

A small library for creating snapping lists.
MIT License
454 stars 53 forks source link

Hot reload issues #7

Closed ariedov closed 6 years ago

ariedov commented 6 years ago

When changing a parameter on the Snaplist itself the app has to be restarted to apply changes.

raacker commented 6 years ago

What was the issue?

ariedov commented 6 years ago

Updated the description.

For instance: the axis change is not applied until the app restart. Does not work by hot reload.

raacker commented 6 years ago

Figured out and fixed. But want to ask first, Bloc is currently initialize at SnapList creation (initState) using final fields including sizeProvider, separatorProviders, etc. But if we want to support runtime build and changes to get hot-reload advantage, we should shrink them into fields. Would it be okay to you?

ariedov commented 6 years ago

Yes, it will be totally ok. Thank you!

ariedov commented 6 years ago

Just don't forget to update on didUpdateWidget.

raacker commented 6 years ago

Yup :)

raacker commented 6 years ago

@ariedov hmm... seems I got a problem with keeping start position. So, when we do hot reload the app, the center position is still on previous center. But that leads to make all center positions to off from center since it's not correctly calculated. Why don't we reset the progress when it does reload? I was keep testing on make it to move proper position but I think just resetting all stuffs would be safe and stable in any situations :)

ariedov commented 6 years ago

I am not sure what do you mean by

reset the progress when it does reload

Do you mean that you want to reset the progress and position on reassemble? If yes - then I am ok with it.

raacker commented 6 years ago

never mind. It should not move the position when axis didn't change. Then could you tell me how to move to specific position by force?

ariedov commented 6 years ago

There is no way to move to a specific position. For now, at least ;)

raacker commented 6 years ago

@ariedov oh well..... screenshot_20181031-204531

this is the bug that I have now :) when we change axis, it's off

raacker commented 6 years ago

after scrolling a few times, it gets back to normal

ariedov commented 6 years ago

There might be a few reasons for it.

  1. The scroll offset was calculated for the vertical axis, but after we've changed it the calculation is wrong due to card size differences.
  2. The progress is off, which I doubt.
ariedov commented 6 years ago

If everything else works, I mean if we can change card sizes, orientation and separator sizes by hot reload - I would appreciate a pull request. This issue can be fixed later.

raacker commented 6 years ago

@ariedov let me try a bit more! I'll just make PR if I can't resolve the issue

ariedov commented 6 years ago

Ok, no problem. Thank you very much, I really appreciate your help.

ariedov commented 6 years ago

Done with that. I'll create a new issue for position storing.