Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

swiping_card_deck

a widget for swiping through a deck of cards with gestures or buttons.

this package was inspired when i was trying to develop a tinder-like app
that involved swiping options to the left or right. i assumed that a package
existed for such a popular functionality, but i searched the internet and could
only find bits and pieces of different implementations that were confusing,
complicated, and down right bad. this package aims to be an easy-to-use and
customizable way to implement that functionality, and will hopefully save you
a great amount of time!

swipingcarddeck demonstration

features

the swipingcarddeck widget offers a variety of unique features:

  • swipe through cards by dragging or using buttons to hook into the public
    swipeleft and swiperight functions.
  • provide custom callback functions for when the deck is empty and for each
    swiping direction, which also pass in the original card object.
  • use custom cards of any shape, size, or content.
  • optimized performance by rendering top two cards at a time, allowing for large
    decks with no decrease in user experience.
  • a variety of exposed properties allow for a swiping experience that can be
    designed for any need.
  • great for any tinder-like decision making application.

the current limitations of the package:

  • only accepts a list of card widgets.
  • only supports horizontal swiping, not vertical.

usage

constructing a swipingcarddeck with two cards and two buttons that can be used
for swiping. callback functions print out debugging information. the parameters
minimumvelocity, rotationfactor, and swipethreshold are all optional, but are set
to the default values which work well for most use cases.

swipingcarddeck(
    carddeck: <card>[
        card(
            color: colors.red,
            child: const sizedbox(height: 300, width: 200,)
        ),
        card(
            color: colors.green,
            child: const sizedbox(height: 300, width: 200,)
        ),
    ],
    ondeckempty: () => debugprint("card deck empty"),
    onleftswipe: (card card) => debugprint("swiped left!"),
    onrightswipe: (card card) => debugprint("swiped right!"),
    swipethreshold: mediaquery.of(context).size.width / 4,
    minimumvelocity: 1000,
    cardwidth: 200,
    rotationfactor: 0.8 / 3.14;
);

additional information

issues and suggestions

this package is being actively maintained and developed. to submit ideas,
issues, or suggestions, create an issue in the
github repository.

contributing

thank you for your interest in contributing! to get started, read through
the documentation in contributing.
there are always new issues coming so be sure to check back often, and if there’s
something you want to work on but there’s no issue, just open one yourself!


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.