change: remove deprecated methods
This commit is contained in:
parent
44faeebb08
commit
5b1a3f80c7
|
|
@ -1,3 +1,8 @@
|
||||||
|
## NEXT
|
||||||
|
|
||||||
|
- **BREAKING CHANGE**:
|
||||||
|
- `isHorizontalSwipingEnabled` and `isVerticalSwipingEnabled` have been removed. Use `allowedSwipeDirection` instead.
|
||||||
|
|
||||||
## [5.1.0]
|
## [5.1.0]
|
||||||
|
|
||||||
- Adds AllowedSwipeDirection to allow card to be swiped in any combination of left, right, up or down directions.
|
- Adds AllowedSwipeDirection to allow card to be swiped in any combination of left, right, up or down directions.
|
||||||
|
|
|
||||||
|
|
@ -105,9 +105,7 @@ class Example extends StatelessWidget {
|
||||||
| duration | 200 milliseconds | The duration that every animation should last | 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| numberOfCardsDisplayed | 2 | Number of cards displayed at the same time | false |
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,6 @@ class CardAnimation {
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(double dx, double dy, bool inverseAngle) {
|
void update(double dx, double dy, bool inverseAngle) {
|
||||||
//TODO: remove [isHorizontalSwipingEnabled] checks in the next major release
|
|
||||||
if (isHorizontalSwipingEnabled) {
|
|
||||||
if (allowedSwipeDirection.right && allowedSwipeDirection.left) {
|
if (allowedSwipeDirection.right && allowedSwipeDirection.left) {
|
||||||
left += dx;
|
left += dx;
|
||||||
} else if (allowedSwipeDirection.right) {
|
} else if (allowedSwipeDirection.right) {
|
||||||
|
|
@ -64,10 +62,7 @@ class CardAnimation {
|
||||||
} else if (allowedSwipeDirection.left) {
|
} else if (allowedSwipeDirection.left) {
|
||||||
if (left <= 0) left += dx;
|
if (left <= 0) left += dx;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: remove [isHorizontalSwipingEnabled] checks in the next major release
|
|
||||||
if (isVerticalSwipingEnabled) {
|
|
||||||
if (allowedSwipeDirection.up && allowedSwipeDirection.down) {
|
if (allowedSwipeDirection.up && allowedSwipeDirection.down) {
|
||||||
top += dy;
|
top += dy;
|
||||||
} else if (allowedSwipeDirection.up) {
|
} else if (allowedSwipeDirection.up) {
|
||||||
|
|
@ -75,7 +70,6 @@ class CardAnimation {
|
||||||
} else if (allowedSwipeDirection.down) {
|
} else if (allowedSwipeDirection.down) {
|
||||||
if (top >= 0) top += dy;
|
if (top >= 0) top += dy;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
total = left + top;
|
total = left + top;
|
||||||
updateAngle(inverseAngle);
|
updateAngle(inverseAngle);
|
||||||
|
|
|
||||||
|
|
@ -92,18 +92,6 @@ class CardSwiper extends StatefulWidget {
|
||||||
/// Defaults to [CardSwiperDirection.right].
|
/// Defaults to [CardSwiperDirection.right].
|
||||||
final CardSwiperDirection direction;
|
final CardSwiperDirection direction;
|
||||||
|
|
||||||
/// A boolean value that determines whether the card can be swiped horizontally. The default value is true.
|
|
||||||
@Deprecated(
|
|
||||||
'Will be deprecated in the next major release. Use [AllowedSwipeDirection] instead',
|
|
||||||
)
|
|
||||||
final bool isHorizontalSwipingEnabled;
|
|
||||||
|
|
||||||
/// A boolean value that determines whether the card can be swiped vertically. The default value is true.
|
|
||||||
@Deprecated(
|
|
||||||
'Will be deprecated in the next major release. Use [AllowedSwipeDirection] instead',
|
|
||||||
)
|
|
||||||
final bool isVerticalSwipingEnabled;
|
|
||||||
|
|
||||||
/// Defined the directions in which the card is allowed to be swiped.
|
/// Defined the directions in which the card is allowed to be swiped.
|
||||||
/// Defaults to [AllowedSwipeDirection.all]
|
/// Defaults to [AllowedSwipeDirection.all]
|
||||||
final AllowedSwipeDirection allowedSwipeDirection;
|
final AllowedSwipeDirection allowedSwipeDirection;
|
||||||
|
|
@ -149,10 +137,6 @@ class CardSwiper extends StatefulWidget {
|
||||||
this.onSwipe,
|
this.onSwipe,
|
||||||
this.onEnd,
|
this.onEnd,
|
||||||
this.direction = CardSwiperDirection.right,
|
this.direction = CardSwiperDirection.right,
|
||||||
@Deprecated('Will be deprecated in the next major release. Use [allowedSwipeDirection] instead')
|
|
||||||
this.isHorizontalSwipingEnabled = true,
|
|
||||||
@Deprecated('Will be deprecated in the next major release. Use [allowedSwipeDirection] instead')
|
|
||||||
this.isVerticalSwipingEnabled = true,
|
|
||||||
this.allowedSwipeDirection = const AllowedSwipeDirection.all(),
|
this.allowedSwipeDirection = const AllowedSwipeDirection.all(),
|
||||||
this.isLoop = true,
|
this.isLoop = true,
|
||||||
this.numberOfCardsDisplayed = 2,
|
this.numberOfCardsDisplayed = 2,
|
||||||
|
|
@ -225,10 +209,6 @@ class _CardSwiperState<T extends Widget> extends State<CardSwiper>
|
||||||
animationController: _animationController,
|
animationController: _animationController,
|
||||||
maxAngle: widget.maxAngle,
|
maxAngle: widget.maxAngle,
|
||||||
initialScale: widget.scale,
|
initialScale: widget.scale,
|
||||||
// ignore: deprecated_member_use_from_same_package
|
|
||||||
isVerticalSwipingEnabled: widget.isVerticalSwipingEnabled,
|
|
||||||
// ignore: deprecated_member_use_from_same_package
|
|
||||||
isHorizontalSwipingEnabled: widget.isHorizontalSwipingEnabled,
|
|
||||||
allowedSwipeDirection: widget.allowedSwipeDirection,
|
allowedSwipeDirection: widget.allowedSwipeDirection,
|
||||||
initialOffset: widget.backCardOffset,
|
initialOffset: widget.backCardOffset,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue