AnupKumarPanwar / swipe_cards

Tinder like swipe cards for flutter.
https://pub.dev/packages/swipe_cards
BSD 3-Clause "New" or "Revised" License
52 stars 47 forks source link

how can we store the value of cards(false or true) in list to store it on firebase #20

Open Hani961 opened 2 years ago

Hani961 commented 2 years ago

please guide me through this I'm stuck with this

perniklas commented 1 year ago

If you mean whether a swipe is like or not like, this is handled using the likeAction / nopeAction callback functions when you create the SwipeItems

iUngerTime commented 5 months ago

Yeah just follow the example provided.

for (int i = 0; i < _names.length; i++) {
      _swipeItems.add(SwipeItem(
          content: Content(text: _names[i], color: _colors[i]),
          likeAction: () {
            ScaffoldMessenger.of(context).showSnackBar(SnackBar(
              content: Text("Liked ${_names[i]}"),
              duration: Duration(milliseconds: 500),
            ));
          },
          nopeAction: () {
            ScaffoldMessenger.of(context).showSnackBar(SnackBar(
              content: Text("Nope ${_names[i]}"),
              duration: Duration(milliseconds: 500),
            ));
          },
          superlikeAction: () {
            ScaffoldMessenger.of(context).showSnackBar(SnackBar(
              content: Text("Superliked ${_names[i]}"),
              duration: Duration(milliseconds: 500),
            ));
          },
          onSlideUpdate: (SlideRegion? region) async {
            print("Region $region");
          }));
    }

    _matchEngine = MatchEngine(swipeItems: _swipeItems);
    super.initState();
  }