Skip to content

Support full-screen cards#65

Open
nalbion wants to merge 3 commits into
ShaunRain:masterfrom
nalbion:master
Open

Support full-screen cards#65
nalbion wants to merge 3 commits into
ShaunRain:masterfrom
nalbion:master

Conversation

@nalbion

@nalbion nalbion commented Mar 1, 2021

Copy link
Copy Markdown

The main purpose of this PR is to allow cards to be full-screen without the odd behaviour mentioned in #55.

In order to achieve this I've had to make a number of changes:

  • Transform is used to translate and scale the card instead of Align and SizedBox
  • Switching from SizedBox means that text on the card is resized instead of moved to different lines when the card size animates.
  • Cards behind the front card are scaled in perspective, so you can have unlimited cards in your stack without cards at the back suddenly becoming larger
  • Instead of specifying a minimum height/width, you can specify a scaling factor.
  • card[0] is the front card - it removes a lot of complexity from the code
  • the rotation angle depends on whether you started dragging the top or bottom half of the card. The card stays pinned under your finger and the far end drags behind.


if (widget.swipeCompleteCallback != null) {
widget.swipeCompleteCallback(orientation, index);
widget.swipeCompleteCallback(orientation);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any Reason why we are not sending the current card Index being swiped in the call back?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, because index = 0 is now the front card. You don't need to track _currentFront - the code becomes a lot simpler.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but on the client-side how do we track which card was swiped?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's always card[0]

@maheshj01 maheshj01 Mar 29, 2021

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So how do we handle a case e.g ,
I have a set of 5 cards and I would like to show some text associated with each card.
so basically there will be a

List<String> ['A','B','C','D','E'];

so in order to show a appropriate text with each card we will need the index of the card being swiped.

Let me know If I am wrong or missing anything :)

@nalbion nalbion Mar 29, 2021

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have left the index argument in, but it would be 0 every single time.

@maheshj01 maheshj01 Mar 29, 2021

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is it like if I have List mapped to cards.on each swipe complete callback I should remove the first element of this list.
And then the first element of the resulting list will be associated with the current card?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for asking too many questions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the top/first card gets special treatment - it's the only one that can be swiped, and then it's removed from the list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation

@xxJeevesxx

Copy link
Copy Markdown

Do we know if this will get reviewed and closed?

@maheshj01

Copy link
Copy Markdown

cc: @ShaunRain

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

Successfully merging this pull request may close these issues.

3 participants