diff --git a/CHANGELOG.md b/CHANGELOG.md index 9653fd1..a1f84cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [5.1.0] + +- Adds AllowedSwipeDirection to allow card to be swiped in any combination of left, right, up or down directions. +- **DEPRECATION**: + - `isHorizontalSwipingEnabled` and `isVerticalSwipingEnabled` have been deprecated. Use `allowedSwipeDirection` instead. + ## [5.0.1] - Adds support for negative back card offset. @@ -75,7 +81,7 @@ ## [1.1.1] -- Dipose the CardSwiperController to avoid memory leaks +- Dispose the CardSwiperController to avoid memory leaks ## [1.1.0] diff --git a/README.md b/README.md index 8713e55..74e4be2 100644 --- a/README.md +++ b/README.md @@ -96,27 +96,28 @@ class Example extends StatelessWidget { #### Basic -| Parameter | Default | Description | Required | -| -------------------------- | :------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | -| cardBuilder | - | Widget builder for rendering cards | true | -| cardsCount | - | Number of cards | true | -| controller | - | Controller to trigger swipe actions | false | -| direction | right | Direction in which the card is swiped away when triggered from the controller | false | -| duration | 200 milliseconds | The duration that every animation should last | false | -| initialIndex | 0 | Index of the first card when the swiper is initialized | false | -| isDisabled | false | Set to `true` if swiping should be disabled, has no impact when triggered from the outside | false | -| isHorizontalSwipingEnabled | true | Set to `false` if you want your card to move only across the vertical axis when swiping | false | -| isLoop | true | Set to `true` if the stack should loop | false | -| isVerticalSwipingEnabled | true | Set to `false` if you want your card to move only across the horizontal axis when swiping | false | -| maxAngle | 30 | Maximum angle that the card can reach during swiping | false | -| numberOfCardsDisplayed | 2 | Number of cards displayed at the same time | false | -| onEnd | - | Callback when there are no more cards left to swipe | false | -| onSwipe | - | Callback when the user swipes a card. If the function returns `false`, the swipe action is canceled. If it returns `true`, the swipe action is performed as expected | false | -| onTapDisabled | - | Callback when a card is tapped and `isDisabled` is `true` | false | -| onUndo | - | Callback when the controller calls undo. If the function returns `false`, the undo action is canceled. If it returns `true`, the undo action is performed as expected | false | -| padding | EdgeInsets.symmetric(horizontal: 20, vertical: 25) | The padding around the swiper | false | -| scale | 0.9 | Scale of the card that is behind the front card | false | -| threshold | 50 | Threshold from which the card is swiped away | false | +| Parameter | Default | Description | Required | +|-------------------------------------------| :------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------| :------: | +| cardBuilder | - | Widget builder for rendering cards | true | +| cardsCount | - | Number of cards | true | +| controller | - | Controller to trigger swipe actions | false | +| direction | right | Direction in which the card is swiped away when triggered from the controller | false | +| duration | 200 milliseconds | The duration that every animation should last | false | +| initialIndex | 0 | Index of the first card when the swiper is initialized | false | +| isDisabled | false | Set to `true` if swiping should be disabled, has no impact when triggered from the outside | false | +| isHorizontalSwipingEnabled _(deprecated)_ | true | Set to `false` if you want your card to move only across the vertical axis when swiping. _(Deprecated: use allowedSwipeDirection instead)_ | false | +| isLoop | true | Set to `true` if the stack should loop | false | +| isVerticalSwipingEnabled _(deprecated)_ | true | Set to `false` if you want your card to move only across the horizontal axis when swiping. _(Deprecated: use allowedSwipeDirection instead)_ | false | +| maxAngle | 30 | Maximum angle that the card can reach during swiping | false | +| allowedSwipeDirection | AllowedSwipeDirection.all | Sets the direction in which the card can be swiped. It can be set to any combination of left, right up or down. | false | +| numberOfCardsDisplayed | 2 | Number of cards displayed at the same time | false | +| onEnd | - | Callback when there are no more cards left to swipe | false | +| onSwipe | - | Callback when the user swipes a card. If the function returns `false`, the swipe action is canceled. If it returns `true`, the swipe action is performed as expected | false | +| onTapDisabled | - | Callback when a card is tapped and `isDisabled` is `true` | false | +| onUndo | - | Callback when the controller calls undo. If the function returns `false`, the undo action is canceled. If it returns `true`, the undo action is performed as expected | false | +| padding | EdgeInsets.symmetric(horizontal: 20, vertical: 25) | The padding around the swiper | false | +| scale | 0.9 | Scale of the card that is behind the front card | false | +| threshold | 50 | Threshold from which the card is swiped away | false | #### Controller diff --git a/lib/flutter_card_swiper.dart b/lib/flutter_card_swiper.dart index 8071972..4795a85 100644 --- a/lib/flutter_card_swiper.dart +++ b/lib/flutter_card_swiper.dart @@ -3,7 +3,7 @@ /// animations supporting Android, iOS, Web & Desktop. library flutter_card_swiper; -export 'package:flutter_card_swiper/src/card_swipe_direction.dart'; +export 'package:flutter_card_swiper/src/allowed_swipe_direction.dart'; export 'package:flutter_card_swiper/src/card_swiper.dart'; export 'package:flutter_card_swiper/src/card_swiper_controller.dart'; export 'package:flutter_card_swiper/src/enums.dart'; diff --git a/lib/src/card_swipe_direction.dart b/lib/src/allowed_swipe_direction.dart similarity index 94% rename from lib/src/card_swipe_direction.dart rename to lib/src/allowed_swipe_direction.dart index 287fb7c..69486f3 100644 --- a/lib/src/card_swipe_direction.dart +++ b/lib/src/allowed_swipe_direction.dart @@ -48,7 +48,7 @@ class AllowedSwipeDirection { right: right, ); - /// Allow the card to be swiped in symmetrically in horizontal or vertical directions + /// Allow the card to be swiped symmetrically in horizontal or vertical directions factory AllowedSwipeDirection.symmetric({ horizontal = false, vertical = false, diff --git a/lib/src/card_swiper.dart b/lib/src/card_swiper.dart index 61fd5e2..3354067 100644 --- a/lib/src/card_swiper.dart +++ b/lib/src/card_swiper.dart @@ -3,7 +3,7 @@ import 'dart:math' as math; import 'package:flutter/widgets.dart'; import 'package:flutter_card_swiper/src/card_animation.dart'; -import 'package:flutter_card_swiper/src/card_swipe_direction.dart'; +import 'package:flutter_card_swiper/src/allowed_swipe_direction.dart'; import 'package:flutter_card_swiper/src/card_swiper_controller.dart'; import 'package:flutter_card_swiper/src/enums.dart'; import 'package:flutter_card_swiper/src/extensions.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 8d55b93..c07c58b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_card_swiper description: This is a Tinder-like card swiper package. It allows you to swipe left, right, up, and down and define your own business logic for each direction. homepage: https://github.com/ricardodalarme/flutter_card_swiper issue_tracker: https://github.com/ricardodalarme/flutter_card_swiper/issues -version: 5.0.1 +version: 5.1.0 environment: sdk: ">=2.12.0 <3.0.0"