From 2b92e3577d8677e13018ff2fccf5a48f9fdf18a3 Mon Sep 17 00:00:00 2001 From: Ricardo Dalarme Date: Thu, 12 Jan 2023 21:24:25 -0300 Subject: [PATCH] chore(project): rename the project to `swipeable_cards_stack` --- CHANGELOG.md | 32 +++++-------------- README.md | 14 ++++---- example/lib/main.dart | 6 ++-- example/pubspec.lock | 2 +- example/pubspec.yaml | 2 +- ..._cards.dart => swipeable_cards_stack.dart} | 16 +++++----- ... => swipeable_cards_stack_controller.dart} | 2 +- pubspec.yaml | 2 +- ...k_test.dart => swipeable_cards_stack.dart} | 0 9 files changed, 30 insertions(+), 46 deletions(-) rename lib/{stacked_cards.dart => swipeable_cards_stack.dart} (96%) rename lib/{swipe_controller.dart => swipeable_cards_stack_controller.dart} (95%) rename test/{swipeable_card_stack_test.dart => swipeable_cards_stack.dart} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 578d8fa..4e880d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,12 @@ -## [0.0.5] - October 11, 2021 +## [1.0.0] -- Update Readme.md - -## [0.0.4] - September 30, 2021 - -- Performance improvement - -## [0.0.3] - September 24, 2021 - -- Null safety - -## [0.0.2] - March 1, 2021 - -- Changed README.md demo gif - -## [0.0.1] - February 19, 2021 - -- Added `SwipeableCardsSection` - - Can add custom widgets to SwipeableCardsSection +- Added `SwipeableCardsStack` + - Can add custom widgets to SwipeableCardsStack - Cards can be swiped horizontally and vertically - Can receive swipe events -- Added `CardController` to automatically swipe cards: - - `_cardController.triggerSwipeLeft()` - - `_cardController.triggerSwipeRight()` - - `_cardController.triggerSwipeUp()` - - `_cardController.triggerSwipeDown()` +- Added `SwipeableCardsStackController` to automatically swipe cards: + - `_SwipeableCardsStackController.triggerSwipeLeft()` + - `_SwipeableCardsStackController.triggerSwipeRight()` + - `_SwipeableCardsStackController.triggerSwipeUp()` + - `_SwipeableCardsStackController.triggerSwipeDown()` - Added example (see `examples/` folder) diff --git a/README.md b/README.md index a3d52e9..08e1616 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# stacked_cards +# 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.** @@ -7,7 +7,7 @@ ## Documentation ### Installation -Add `stacked_cards` to your `pubspec.yaml`: +Add `swipeable_cards_stack` to your `pubspec.yaml`: ``` dependencies: @@ -15,16 +15,16 @@ dependencies: sdk: flutter # added below - stacked_cards: + swipeable_cards_stack: ``` ### Adding to app -Use the `SwipeableCardsSection` widget provided by the package +Use the `SwipeableCardsStack` widget provided by the package ``` @override Widget build(BuildContext context) { - //create a SwipeableCardSectionController - SwipeableCardSectionController _cardController = SwipeableCardSectionController(); + //create a SwipeableCardsStackController + SwipeableCardsStackController _cardController = SwipeableCardsStackController(); return Scaffold( appBar: AppBar( @@ -33,7 +33,7 @@ Use the `SwipeableCardsSection` widget provided by the package body: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SwipeableCardsSection( + SwipeableCardsStack( cardController: _cardController, context: context, //add the first 3 cards (widgets) diff --git a/example/lib/main.dart b/example/lib/main.dart index 5385a61..c4d162d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,6 +1,6 @@ import 'package:example/card_view.dart'; import 'package:flutter/material.dart'; -import 'package:stacked_cards/stacked_cards.dart'; +import 'package:swipeable_cards_stack/swipeable_cards_stack.dart'; void main() { runApp(const MyApp()); @@ -31,7 +31,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { int counter = 4; - final cardController = SwipeableCardSectionController(); + final cardController = SwipeableCardsStackController(); @override Widget build(BuildContext context) { @@ -42,7 +42,7 @@ class _MyHomePageState extends State { body: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SwipeableCardsSection( + SwipeableCardsStack( cardController: cardController, context: context, //add the first 3 cards diff --git a/example/pubspec.lock b/example/pubspec.lock index 6fb825d..15cbc81 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -39,7 +39,7 @@ packages: description: flutter source: sdk version: "0.0.99" - stacked_cards: + swipeable_cards_stack: dependency: "direct main" description: path: ".." diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 860aa4b..23e79c7 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: flutter: sdk: flutter - stacked_cards: + swipeable_cards_stack: path: ../ flutter: diff --git a/lib/stacked_cards.dart b/lib/swipeable_cards_stack.dart similarity index 96% rename from lib/stacked_cards.dart rename to lib/swipeable_cards_stack.dart index a6c9519..82cc1e5 100644 --- a/lib/stacked_cards.dart +++ b/lib/swipeable_cards_stack.dart @@ -1,11 +1,11 @@ -library stacked_cards; +library swipeable_cards_stack; import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:stacked_cards/swipe_controller.dart'; +import 'package:swipeable_cards_stack/swipeable_cards_stack_controller.dart'; -export './swipe_controller.dart'; +export 'swipeable_cards_stack_controller.dart'; const List cardsAlign = [ Alignment(0.0, 1.0), @@ -14,8 +14,8 @@ const List cardsAlign = [ ]; final List cardsSize = List.filled(3, const Size(1, 1)); -class SwipeableCardsSection extends StatefulWidget { - final SwipeableCardSectionController? cardController; +class SwipeableCardsStack extends StatefulWidget { + final SwipeableCardsStackController? cardController; //First 3 widgets final List items; @@ -30,7 +30,7 @@ class SwipeableCardsSection extends StatefulWidget { final bool enableSwipeUp; final bool enableSwipeDown; - SwipeableCardsSection({ + SwipeableCardsStack({ Key? key, this.cardController, required BuildContext context, @@ -61,10 +61,10 @@ class SwipeableCardsSection extends StatefulWidget { } @override - State createState() => _CardsSectionState(); + State createState() => _SwipeableCardsStackState(); } -class _CardsSectionState extends State +class _SwipeableCardsStackState extends State with SingleTickerProviderStateMixin { int cardsCounter = 0; int index = 0; diff --git a/lib/swipe_controller.dart b/lib/swipeable_cards_stack_controller.dart similarity index 95% rename from lib/swipe_controller.dart rename to lib/swipeable_cards_stack_controller.dart index 0542250..8d27f50 100644 --- a/lib/swipe_controller.dart +++ b/lib/swipeable_cards_stack_controller.dart @@ -4,7 +4,7 @@ typedef TriggerListener = void Function(Direction dir); typedef AppendItem = void Function(Widget item); typedef EnableSwipe = void Function(bool dir); -class SwipeableCardSectionController { +class SwipeableCardsStackController { late TriggerListener listener; late AppendItem addItem; late EnableSwipe enableSwipeListener; diff --git a/pubspec.yaml b/pubspec.yaml index cb36ad6..09616c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: stacked_cards +name: swipeable_cards_stack description: 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. version: 1.0.0 homepage: https://github.com/ricardodalarme/stacked-cards diff --git a/test/swipeable_card_stack_test.dart b/test/swipeable_cards_stack.dart similarity index 100% rename from test/swipeable_card_stack_test.dart rename to test/swipeable_cards_stack.dart