flutter card swiper fork, with my modifications
Go to file
Ricardo Dalarme a7dc0596df chore(docs): adjust the sample image 2023-01-12 22:25:51 -03:00
example chore(docs): adjust the sample image 2023-01-12 22:25:51 -03:00
images change(readme): rename the readme images folder to `images` 2023-01-12 21:16:52 -03:00
lib change: replace own `Direction` to native `AxisDirection` 2023-01-12 22:25:51 -03:00
test chore(project): rename the project to `swipeable_cards_stack` 2023-01-12 21:37:51 -03:00
.gitignore chore: fork project from `cta-flutter-tinder-card-animation` 2023-01-12 20:38:20 -03:00
.metadata chore: fork project from `cta-flutter-tinder-card-animation` 2023-01-12 20:38:20 -03:00
.pubignore chore(pub): ignore the example when publishing the package 2023-01-12 22:25:51 -03:00
CHANGELOG.md chore(docs): adjust the sample image 2023-01-12 22:25:51 -03:00
LICENSE chore(project): update license 2023-01-12 21:18:45 -03:00
README.md chore(docs): adjust the sample image 2023-01-12 22:25:51 -03:00
analysis_options.yaml chore(lint): add flutter_lints 2023-01-12 20:45:42 -03:00
pubspec.lock chore(lint): add flutter_lints 2023-01-12 20:45:42 -03:00
pubspec.yaml chore(docs): adjust the sample image 2023-01-12 22:25:51 -03:00

README.md

swipeable_cards_stack

This is Tinder like swipeable cards package. You can add your own widgets to the stack, receive all four events, left, right, up and down. You can define your own business logic for each direction.

Demo

Documentation

Installation

Add swipeable_cards_stack to your pubspec.yaml:

dependencies:
  swipeable_cards_stack: <latest version>

Usage

Use the SwipeableCardsStack widget provided by the package

import 'package:swipeable_cards_stack/swipeable_cards_stack.dart';

class MyWidget extends StatefulWidget {
  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  final _cardsController = SwipeableCardsStackController();

  @override
  Widget build(BuildContext context) {
    return SwipeableCardsStack(
      cardController: _cardsController,
      context: context,
      // Add the first 3 cards (widgets)
      items: [
        CardView(text: "First card"),
        CardView(text: "Second card"),
        CardView(text: "Third card"),
      ],
      // Get card swipe event callbacks
      onCardSwiped: (dir, index, widget) {
        // Add the next card using _cardController
        _cardsController.addItem(CardView(text: "Next card"));

        // Take action on the swiped widget based on the direction of swipe
        // Return false to not animate cards
      },
      enableSwipeUp: true,
      enableSwipeDown: false,
    );
  }
}

Contributing

If you want to contribute to this project, you may easily create issues and send PRs. Please take note that your code contributions will be applicable under MIT license unless specified otherwise.

Credits