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

allow controller to reset with a new set of cards #13

Closed
sallypeters opened this issue Sep 2, 2020 · 4 comments
Closed

allow controller to reset with a new set of cards #13

sallypeters opened this issue Sep 2, 2020 · 4 comments
Assignees

Comments

@sallypeters
Copy link

@xrr2016 First of all - Very nice Tinder based Card plugin.

One quick point, Is there any way to reset the cards passed to TCard ? i.e assume you have 10 cards, the user like 4 and dislikes 6 - would therefore want to show only the 6 cards that the user dislikes ... basically there needs to be a way for reset() of the controller to take a parameter of new cards to use ...

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@sallypeters
Copy link
Author

I've made a change to the controller which appears to do what I require :

in TCardController

reset({List<Widget> newWidgets}) {
    _state._reset(newWidgets: newWidgets);
  }

In _cardState

void _reset({List<Widget> newWidgets}) {
    _cards.clear();

    _cards.addAll(newWidgets != null ? newWidgets : widget.cards);
    _swipInfoList.clear();
    _frontCardIndex = 0;
    _return();
  }

@xrr2016 xrr2016 closed this as completed Sep 3, 2020
@xrr2016 xrr2016 reopened this Sep 3, 2020
@xrr2016
Copy link
Collaborator

xrr2016 commented Sep 3, 2020

I've made a change to the controller which appears to do what I require :

in TCardController

reset({List<Widget> newWidgets}) {
    _state._reset(newWidgets: newWidgets);
  }

In _cardState

void _reset({List<Widget> newWidgets}) {
    _cards.clear();

    _cards.addAll(newWidgets != null ? newWidgets : widget.cards);
    _swipInfoList.clear();
    _frontCardIndex = 0;
    _return();
  }

Good idea,thanks you.

@xrr2016 xrr2016 self-assigned this Feb 22, 2021
@xrr2016
Copy link
Collaborator

xrr2016 commented Feb 23, 2021

I've made a change to the controller which appears to do what I require :

in TCardController

reset({List<Widget> newWidgets}) {
    _state._reset(newWidgets: newWidgets);
  }

In _cardState

void _reset({List<Widget> newWidgets}) {
    _cards.clear();

    _cards.addAll(newWidgets != null ? newWidgets : widget.cards);
    _swipInfoList.clear();
    _frontCardIndex = 0;
    _return();
  }

Updated, please install new version 🥺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants