Skip to content

Commit

Permalink
undo format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ltOgt committed Aug 17, 2024
1 parent c9914cc commit a419b4b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/src/widget/card_swiper_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
part of 'card_swiper.dart';

class _CardSwiperState<T extends Widget> extends State<CardSwiper> with SingleTickerProviderStateMixin {
class _CardSwiperState<T extends Widget> extends State<CardSwiper>
with SingleTickerProviderStateMixin {
late CardAnimation _cardAnimation;
late AnimationController _animationController;

Expand Down Expand Up @@ -59,7 +60,8 @@ class _CardSwiperState<T extends Widget> extends State<CardSwiper> with SingleTi
_detectedVerticalDirection = direction;
}

widget.onSwipeDirectionChange?.call(_detectedHorizontalDirection, _detectedVerticalDirection);
widget.onSwipeDirectionChange
?.call(_detectedHorizontalDirection, _detectedVerticalDirection);
}

@override
Expand Down Expand Up @@ -186,7 +188,8 @@ class _CardSwiperState<T extends Widget> extends State<CardSwiper> with SingleTi

Future<void> _handleCompleteSwipe() async {
final isLastCard = _currentIndex! == widget.cardsCount - 1;
final shouldCancelSwipe = await widget.onSwipe?.call(_currentIndex!, _nextIndex, _detectedDirection) == false;
final shouldCancelSwipe = await widget.onSwipe
?.call(_currentIndex!, _nextIndex, _detectedDirection) == false;

if (shouldCancelSwipe) {
return;
Expand Down Expand Up @@ -223,10 +226,14 @@ class _CardSwiperState<T extends Widget> extends State<CardSwiper> with SingleTi

CardSwiperDirection _getEndAnimationDirection() {
if (_cardAnimation.left.abs() > widget.threshold) {
return _cardAnimation.left.isNegative ? CardSwiperDirection.left : CardSwiperDirection.right;
return _cardAnimation.left.isNegative
? CardSwiperDirection.left
: CardSwiperDirection.right;
}
if (_cardAnimation.top.abs() > widget.threshold) {
return _cardAnimation.top.isNegative ? CardSwiperDirection.top : CardSwiperDirection.bottom;
return _cardAnimation.top.isNegative
? CardSwiperDirection.top
: CardSwiperDirection.bottom;
}
return CardSwiperDirection.none;
}
Expand Down

0 comments on commit a419b4b

Please sign in to comment.