chore(docs): update readme
This commit is contained in:
parent
2b92e3577d
commit
e70b6e77bc
61
README.md
61
README.md
|
|
@ -1,42 +1,41 @@
|
||||||
# swipeable_cards_stack
|
# 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.**
|
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.
|
||||||
|
|
||||||
<img alt="Demo" src="images/swipe-card.gif" height="500">
|
<img alt="Demo" src="images/swipe-card.gif" height="500">
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
Add `swipeable_cards_stack` to your `pubspec.yaml`:
|
Add `swipeable_cards_stack` to your `pubspec.yaml`:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
|
||||||
sdk: flutter
|
|
||||||
|
|
||||||
# added below
|
|
||||||
swipeable_cards_stack: <latest version>
|
swipeable_cards_stack: <latest version>
|
||||||
```
|
```
|
||||||
### Adding to app
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
Use the `SwipeableCardsStack` widget provided by the package
|
Use the `SwipeableCardsStack` widget provided by the package
|
||||||
|
|
||||||
```
|
```dart
|
||||||
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//create a SwipeableCardsStackController
|
return SwipeableCardsStack(
|
||||||
SwipeableCardsStackController _cardController = SwipeableCardsStackController();
|
cardController: _cardsController,
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(widget.title),
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
SwipeableCardsStack(
|
|
||||||
cardController: _cardController,
|
|
||||||
context: context,
|
context: context,
|
||||||
//add the first 3 cards (widgets)
|
// Add the first 3 cards (widgets)
|
||||||
items: [
|
items: [
|
||||||
CardView(text: "First card"),
|
CardView(text: "First card"),
|
||||||
CardView(text: "Second card"),
|
CardView(text: "Second card"),
|
||||||
|
|
@ -45,23 +44,23 @@ Use the `SwipeableCardsStack` widget provided by the package
|
||||||
// Get card swipe event callbacks
|
// Get card swipe event callbacks
|
||||||
onCardSwiped: (dir, index, widget) {
|
onCardSwiped: (dir, index, widget) {
|
||||||
// Add the next card using _cardController
|
// Add the next card using _cardController
|
||||||
_cardController.addItem(CardView(text: "Next card"));
|
_cardsController.addItem(CardView(text: "Next card"));
|
||||||
|
|
||||||
// Take action on the swiped widget based on the direction of swipe
|
// Take action on the swiped widget based on the direction of swipe
|
||||||
// Return false to not animate cards
|
// Return false to not animate cards
|
||||||
},
|
},
|
||||||
//
|
|
||||||
enableSwipeUp: true,
|
enableSwipeUp: true,
|
||||||
enableSwipeDown: false,
|
enableSwipeDown: false,
|
||||||
),
|
);
|
||||||
//other children
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Author
|
### Contributing
|
||||||
[**CodeToArt Technology**](https://github.com/codetoart)
|
|
||||||
|
|
||||||
- Follow us on **Twitter**: [**@codetoart**](https://twitter.com/codetoart)
|
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.
|
||||||
- Contact us on **Website**: [**codetoart**](http://www.codetoart.com)
|
|
||||||
|
### Credits
|
||||||
|
|
||||||
|
- **Ricardo Dalarme** (Package maintainer)
|
||||||
|
- [**CodeToArt Technology**](https://github.com/codetoart) (Original project creator)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue