Waqar144 / quran_memorization_helper

An app to help huffaz revise Quran
MIT License
11 stars 1 forks source link

Remember scroll position in para & surah list #15

Closed thecodrr closed 1 month ago

thecodrr commented 2 months ago

The current behavior of always jumping to the selected surah/para can be quite visually jarring. Since the lists have relatively few items, manually scrolling to see the selected Para/Surah won't be too annoying.

Furthermore, once the Surah & Para indicators are added inside each page, it'll automatically fix that.

Preserving visual state of elements is good UX as it gives a feeling of continuity instead of resetting everything each time you open something.

thecodrr commented 2 months ago

@Waqar144 Now the scroll position is only preserved as long as the para/surah doesn't change. Whenever the para/surah changes, the scroll position is reset to that exact item.

I stored the variables in global as anything else did not work (using a Stateful widget didn't work because the State kept getting reset every time the drawer was opened). If there's a better way to store the variables, let me know.

Waqar144 commented 2 months ago

@Waqar144 Now the scroll position is only preserved as long as the para/surah doesn't change. Whenever the para/surah changes, the scroll position is reset to that exact item.

I stored the variables in global as anything else did not work (using a Stateful widget didn't work because the State kept getting reset every time the drawer was opened). If there's a better way to store the variables, let me know.

The variables an be stored in home page, and will be passed in everytime the listviews are created.

thecodrr commented 2 months ago

The variables an be stored in home page, and will be passed in everytime the listviews are created.

That will work but the variables are specific to the widget. Should we really move them up to the parent? Another option would be to use PageStorage.

thecodrr commented 1 month ago

@Waqar144 any update on this?