v0.0.5swipeable_card_stack
이것은 틴더와 유사한 스와이프 가능한 카드 패키지입니다. 스택에 사용자 정의 위젯을 추가하고 왼쪽, 오른쪽, 위, 아래의 모든 이벤트를 수신할 수 있습니다. 각 방향에 대해 사용자 고유의 비즈니스 로직을 정의할 수 있습니다.
106좋아요 67430일 다운로드115Pub 점수
AndroidiOSWebmacOSWindowsLinux
codetoart/cta-flutter-tinder-card-animation open-source repository details.
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
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.
DemoAdd swipeable_card_stack to your pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# added below
swipeable_card_stack: <latest version>
Use the SwipeableCardsSection widget provided by the package
@override
Widget build(BuildContext context) {
//create a SwipeableCardSectionController
SwipeableCardSectionController _cardController = SwipeableCardSectionController();
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SwipeableCardsSection(
cardController: _cardController,
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
_cardController.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,
),
//other children
)
}