ariedov / flutter_snaplist

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

How to get pop up effect using snaplist #11

Open saltpetre opened 5 years ago

saltpetre commented 5 years ago

@ariedov Hi,

how did you get the pop effect of the card in the vertical scroll list. I am referring to the screenshot you have with list of diff movies.

I am able to get the scroll but can't figure out the pop of effect of the card when it comes to the center.

Thanks

ariedov commented 5 years ago

Hey! Sorry for the late response.

You could provide a custom sizeProvider to the list and calculate the height using the params it provides. The progress param is quite crucial for that.

I can't share the code that is used in the gif on README.md, because it is used in a closed project.

phattranky commented 5 years ago

Hi @ariedov,

I implement your suggestion. But seem it's only working with Next navigate

sizeProvider: (index, data) {
              if (data.center == index - 1) {
                final height = cardSize.height + data.progress;
                return Size(cardSize.width, height);
              }

              return cardSize;
            },

screencast 2019-05-28 06-42-21

When I debug, Look the Index, Center value not correct when I navigate back like this issue https://github.com/ariedov/flutter_snaplist/issues/15. What was wrong?

phattranky commented 5 years ago

Hi @saltpetreca, Do you resolve this issue?

saltpetre commented 5 years ago

Hey Phat, sorry couldn’t solve it.

Let me know how you did.

On May 27, 2019, at 7:46 PM, Phat Tran Ky notifications@github.com wrote:

Hi @saltpetreca, Do you resolve this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

phattranky commented 5 years ago

Hi @saltpetreca ,

I can solve the popup effect issue with my code mentioned above. But about the index still not yet

arndt-s commented 4 years ago

I've came up with the following workaround:

if (data.progress == 0 && data.center == index) {
  return cardSize;
} else if (data.next < data.center && data.next == index) {
  return cardSize;
} else if (data.next >= data.center && data.center == index - 1) {
  return cardSize;
} else {
  return cardSizeSmall;
}