{"id":17184269,"url":"https://github.com/anupkumarpanwar/swipe_cards","last_synced_at":"2025-07-24T10:04:06.103Z","repository":{"id":42439226,"uuid":"339172985","full_name":"AnupKumarPanwar/swipe_cards","owner":"AnupKumarPanwar","description":"Tinder like swipe cards for flutter.","archived":false,"fork":false,"pushed_at":"2023-09-05T11:56:41.000Z","size":1194,"stargazers_count":51,"open_issues_count":29,"forks_count":46,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-21T07:07:50.937Z","etag":null,"topics":["dart","flutter","pubdev","swipe-cards","tinder"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/swipe_cards","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnupKumarPanwar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-15T18:41:40.000Z","updated_at":"2024-10-12T02:53:39.000Z","dependencies_parsed_at":"2024-06-19T05:29:36.996Z","dependency_job_id":null,"html_url":"https://github.com/AnupKumarPanwar/swipe_cards","commit_stats":{"total_commits":29,"total_committers":6,"mean_commits":4.833333333333333,"dds":0.4482758620689655,"last_synced_commit":"e778b121f163e66ca42eabe02148216ec4292bf2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnupKumarPanwar/swipe_cards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnupKumarPanwar%2Fswipe_cards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnupKumarPanwar%2Fswipe_cards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnupKumarPanwar%2Fswipe_cards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnupKumarPanwar%2Fswipe_cards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnupKumarPanwar","download_url":"https://codeload.github.com/AnupKumarPanwar/swipe_cards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnupKumarPanwar%2Fswipe_cards/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266823230,"owners_count":23989956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","pubdev","swipe-cards","tinder"],"created_at":"2024-10-15T00:42:51.898Z","updated_at":"2025-07-24T10:04:06.049Z","avatar_url":"https://github.com/AnupKumarPanwar.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swipe_cards [![pub package](https://img.shields.io/pub/v/swipe_cards.svg)](https://pub.dartlang.org/packages/swipe_cards)\n\nA Flutter widget for Tinder like swipe cards. The card can be swiped right, left and up for different responses. Currently it supports the following responses:\n- Right swipe for like\n- Left swipe for nope\n- Up swipe for superlike\n\n## Install\nTo install the package, add the following dependency to your `pubspec.yaml`\n```\ndependencies:\n  swipe_cards: ^2.0.0+1\n```\n\n## Usage\n\n### Basic\n\n```\nimport 'package:swipe_cards/swipe_cards.dart';\n\nSwipeCards(\n            matchEngine: \u003cMatchEngine\u003e,\n            itemBuilder: (BuildContext context, int index) {},\n            onStackFinished: () {},\n            itemChanged: (SwipeItem item, int index) {},\n            upSwipeAllowed: \u003cbool\u003e,\n            fillSpace: \u003cbool\u003e,\n);\n```\n\n### Attributes of SwipeCards\n\n| Key                | Description                                                    |\n|---------------------|-------------------------------------------------------------------|\n| `matchEngine`       |  An instance of `MatchEngine` that acts as controller for trigerring swipes manually.    |\n| `itemBuilder`       |  A function that returns the view inside a swipe card.                    |\n| `likeTag`           |  Widget appears in like/right area during swipe.                    |\n| `nopeTag`           |  Widget appears in nope/left area during swipe.                    |\n| `superLikeTag`      |  Widget appears in super-like/up area during swipe.                    |\n| `onStackFinished`   |  A function that is triggered as soon as all the cards have been swiped.    |\n| `itemChanged`       |  A function that is triggered when item in the stack changes (moves to next card).    |\n| `leftSwipeAllowed`  |  To enable/disable left swipe. (Default: true)    |\n| `rightSwipeAllowed` |  To enable/disable right swipe. (Default: true)    |\n| `upSwipeAllowed`    |  To enable/disable up swipe. (Default: false)    |\n| `fillSpace`         |  Config weather to fill up the space or not. (Default: true)    |\n\n### MatchEngine\n\n`MatchEngine` is the controller for the swipe cards. It takes `swipeItems` as an argument and is\nused to trigger the swipes manually, for example on button press. The data type of `swipeItems`\nis `List\u003cSwipeItem\u003e`.\n\n```\nMatchEngine _matchEngine = MatchEngine(swipeItems: List\u003cSwipeItem\u003e);\n```\n\n### Functions in MatchEngine\n\n| Key                | Description                                                    |\n|-------------------|-------------------------------------------------------------------|\n| `_matchEngine.currentItem.like();`    | To trigger right swipe manually.    |\n| `_matchEngine.currentItem.nope();`     |  To trigger left swipe manually.                    |\n| `_matchEngine.currentItem.superLike();` |  To trigger up swipe manually.    |\n\n### SwipeItem\n\n`SwipeItem` contains the actual data that can be rendered in the swipe card. Actually it is a\nwrapper over any dynamic object and just adds the functionality of like, nope and superlike to that\nobject.\n\n```\nSwipeItem(\n            content: \"Anup Kumar Panwar\",\n            likeAction: () {\n                log(\"Like\");\n            },\n            nopeAction: () {\n                log(\"Nope\");\n            },\n            superlikeAction: () {\n                log(\"Superlike\");\n            },\n            onSlideUpdate: (SlideRegion? region){\n                log(\"Region $region\");\n            }\n);\n```\n\n### Attributes of SwipeItem\n\n| Key                | Description                                                    |\n|-------------------|-------------------------------------------------------------------|\n| `content`    | An object that contains the actual data to be rendered in the swipe card.    |\n| `likeAction`     |  A function that is triggered when the card is liked.                    |\n| `nopeAction` |  A function that is triggered when the card is not liked / swiped left.    |\n| `superlikeAction` |  A function that is triggered when the card is superliked.    |\n| `onSlideUpdate` |  A function that is triggered when the card is being dragged and tells about the current region of the card.    |\n\n### Example\n\n```\nList\u003cSwipeItem\u003e _swipeItems = List\u003cSwipeItem\u003e();\n  MatchEngine _matchEngine;\n  GlobalKey\u003cScaffoldState\u003e _scaffoldKey = GlobalKey();\n  List\u003cString\u003e _names = [\"Red\", \"Blue\", \"Green\", \"Yellow\", \"Orange\"];\n  List\u003cColor\u003e _colors = [\n    Colors.red,\n    Colors.blue,\n    Colors.green,\n    Colors.yellow,\n    Colors.orange\n  ];\n\n  @override\n  void initState() {\n    for (int i = 0; i \u003c _names.length; i++) {\n      _swipeItems.add(SwipeItem(\n          content: Content(text: _names[i], color: _colors[i]),\n          likeAction: () {\n            ScaffoldMessenger.of(context).showSnackBar(SnackBar(\n              content: Text(\"Liked ${_names[i]}\"),\n              duration: Duration(milliseconds: 500),\n            ));\n          },\n          nopeAction: () {\n            ScaffoldMessenger.of(context).showSnackBar(SnackBar(\n              content: Text(\"Nope ${_names[i]}\"),\n              duration: Duration(milliseconds: 500),\n            ));\n          },\n          superlikeAction: () {\n            ScaffoldMessenger.of(context).showSnackBar(SnackBar(\n              content: Text(\"Superliked ${_names[i]}\"),\n              duration: Duration(milliseconds: 500),\n            ));\n          },\n          onSlideUpdate: (SlideRegion? region) async {\n            print(\"Region $region\");\n          }));\n    }\n\n    _matchEngine = MatchEngine(swipeItems: _swipeItems);\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n        key: _scaffoldKey,\n        appBar: AppBar(\n          title: Text(widget.title),\n        ),\n        body: Container(\n            child: Column(children: [\n          Container(\n            height: 550,\n            child: SwipeCards(\n              matchEngine: _matchEngine,\n              itemBuilder: (BuildContext context, int index) {\n                return Container(\n                  alignment: Alignment.center,\n                  color: _swipeItems[index].content.color,\n                  child: Text(\n                    _swipeItems[index].content.text,\n                    style: TextStyle(fontSize: 100),\n                  ),\n                );\n                  },\n                  onStackFinished: () {\n                    ScaffoldMessenger.of(context).showSnackBar(SnackBar(\n                      content: Text(\"Stack Finished\"),\n                      duration: Duration(milliseconds: 500),\n                    ));\n                  },\n                  itemChanged: (SwipeItem item, int index) {\n                    print(\"item: ${item.content.text}, index: $index\");\n                  },\n                  upSwipeAllowed: true,\n                  fillSpace: true,\n                ),\n              ),\n              Row(\n                mainAxisAlignment: MainAxisAlignment.spaceEvenly,\n                children: [\n                  RaisedButton(\n                      onPressed: () {\n                        _matchEngine.currentItem.nope();\n                      },\n                      child: Text(\"Nope\")),\n                  RaisedButton(\n                      onPressed: () {\n                        _matchEngine.currentItem.superLike();\n                      },\n                      child: Text(\"Superlike\")),\n                  RaisedButton(\n                      onPressed: () {\n                        _matchEngine.currentItem.like();\n                      },\n                      child: Text(\"Like\"))\n                ],\n              )\n            ])));\n  }\n```\n```\n  class Content {\n    final String text;\n    final Color color;\n\n    Content({this.text, this.color});\n  }\n```\n\n## Screenshot\n![Screenshot](./example/screenshot.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupkumarpanwar%2Fswipe_cards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanupkumarpanwar%2Fswipe_cards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupkumarpanwar%2Fswipe_cards/lists"}