chore(package): rename the package to `flutter_card_swiper`
This commit is contained in:
parent
04b2346ad2
commit
ead2b3f8b5
22
README.md
22
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
```appinio_swiper``` is a Flutter package for a Tinder Card Swiper. ✨
|
```card_swiper``` is a Flutter package for a Tinder Card Swiper. ✨
|
||||||
|
|
||||||
It allows swiping in all directions with any Custom Widget (Stateless or Statefull).
|
It allows swiping in all directions with any Custom Widget (Stateless or Statefull).
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ We build this package because we wanted to:
|
||||||
## ❗NEW Features ❗
|
## ❗NEW Features ❗
|
||||||
|
|
||||||
### Trigger swipe left and swipe right through controller
|
### Trigger swipe left and swipe right through controller
|
||||||
You can now trigger swipe left and swipe right with our ```AppinioSwiperController``` regardless of the chosen ```AppinioSwipeDirection``` (which is still used when ```swipe``` is called through the controller). Just like the unswipe and swipe call, you can call ```swipeLeft``` or ```swipeRight``` through the controller anywhere you want.
|
You can now trigger swipe left and swipe right with our ```CardSwiperController``` regardless of the chosen ```AppinioSwipeDirection``` (which is still used when ```swipe``` is called through the controller). Just like the unswipe and swipe call, you can call ```swipeLeft``` or ```swipeRight``` through the controller anywhere you want.
|
||||||
|
|
||||||
### Unswipe all cards
|
### Unswipe all cards
|
||||||
You can now unswipe as many cards as possible. If you set the parameter ```unlimitedUnswipe```to ```true``` (default value: ```false```) the limit of 1 card is extended to the number of cards that have been swiped away. The way to call ```unswipe``` hasn't changed.
|
You can now unswipe as many cards as possible. If you set the parameter ```unlimitedUnswipe```to ```true``` (default value: ```false```) the limit of 1 card is extended to the number of cards that have been swiped away. The way to call ```unswipe``` hasn't changed.
|
||||||
|
|
@ -32,7 +32,7 @@ We've added the direction in which the card was swiped away to the function ```o
|
||||||
We've added the function ```unswipe``` that now gets returned with the boolean ```true``` when the last card is unswiped and with boolean ```false``` when there is no last card to unswipe.
|
We've added the function ```unswipe``` that now gets returned with the boolean ```true``` when the last card is unswiped and with boolean ```false``` when there is no last card to unswipe.
|
||||||
|
|
||||||
### Trigger swipe through controller
|
### Trigger swipe through controller
|
||||||
You can now trigger the swipe with our ```AppinioSwiperController```. Just like the unswipe call, you can call the ```swipe``` trough the controller anywhere you want. Just make sure to pass the controller to the parameter ```controller``` from our ```AppinioSwiper```.
|
You can now trigger the swipe with our ```CardSwiperController```. Just like the unswipe call, you can call the ```swipe``` trough the controller anywhere you want. Just make sure to pass the controller to the parameter ```controller``` from our ```CardSwiper```.
|
||||||
|
|
||||||
## Show Cases
|
## Show Cases
|
||||||
|
|
||||||
|
|
@ -62,14 +62,14 @@ flutter create MyApp
|
||||||
```
|
```
|
||||||
Add
|
Add
|
||||||
```yaml
|
```yaml
|
||||||
appinio_swiper: ...
|
card_swiper: ...
|
||||||
```
|
```
|
||||||
to your `pubspec.yaml` of your flutter project.
|
to your `pubspec.yaml` of your flutter project.
|
||||||
**OR**
|
**OR**
|
||||||
run
|
run
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
flutter pub add appinio_swiper
|
flutter pub add card_swiper
|
||||||
```
|
```
|
||||||
in your project's root directory.
|
in your project's root directory.
|
||||||
|
|
||||||
|
|
@ -77,16 +77,16 @@ in your project's root directory.
|
||||||
In your library add the following import:
|
In your library add the following import:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:appinio_swiper/appinio_swiper.dart';
|
card_swiperimport 'package:flutter_card_swiper/card_swiper.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
For help getting started with Flutter, view the online [documentation](https://flutter.io/).
|
For help getting started with Flutter, view the online [documentation](https://flutter.io/).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
You can place your `AppinioSwiper` inside of a `Scaffold` or `CupertinoPageScaffold` like we did here. Optional parameters can be defined to enable different features. See the following example..
|
You can place your `CardSwiper` inside of a `Scaffold` or `CupertinoPageScaffold` like we did here. Optional parameters can be defined to enable different features. See the following example..
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:appinio_swiper/appinio_swiper.dart';
|
card_swiperimport 'package:flutter_card_swiper/card_swiper.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class Example extends StatelessWidget {
|
class Example extends StatelessWidget {
|
||||||
|
|
@ -113,7 +113,7 @@ class Example extends StatelessWidget {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: AppinioSwiper(
|
child: CardSwiper(
|
||||||
cards: cards,
|
cards: cards,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -145,7 +145,7 @@ class Example extends StatelessWidget {
|
||||||
|
|
||||||
#### Controller
|
#### Controller
|
||||||
|
|
||||||
The ```Controller``` is used to control the ```swipe```, ```swipeLeft```, ```swipeRight``` or ```unswipe``` function of the swiper from outside of the widget. You can create a controller called ```AppinioSwiperController``` and save the instance for further usage. Please have a closer look to our Example for the usage.
|
The ```Controller``` is used to control the ```swipe```, ```swipeLeft```, ```swipeRight``` or ```unswipe``` function of the swiper from outside of the widget. You can create a controller called ```CardSwiperController``` and save the instance for further usage. Please have a closer look to our Example for the usage.
|
||||||
|
|
||||||
| Method | Description
|
| Method | Description
|
||||||
| ------------- |:-------------
|
| ------------- |:-------------
|
||||||
|
|
@ -156,4 +156,4 @@ The ```Controller``` is used to control the ```swipe```, ```swipeLeft```, ```swi
|
||||||
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
Made with ❤ by Flutter team at <a href="https://appinio.com">Appinio GmbH</a>
|
Made with ❤ by Flutter team at <a href="https://appinio.com">Appinio GmbH</a>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
|
import 'package:flutter_card_swiper/card_swiper.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:appinio_swiper/appinio_swiper.dart';
|
|
||||||
|
|
||||||
class ExampleButton extends StatelessWidget {
|
class ExampleButton extends StatelessWidget {
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
@ -23,7 +22,7 @@ class ExampleButton extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
//swipe card to the right side
|
//swipe card to the right side
|
||||||
Widget swipeRightButton(AppinioSwiperController controller) {
|
Widget swipeRightButton(CardSwiperController controller) {
|
||||||
return ExampleButton(
|
return ExampleButton(
|
||||||
onTap: () => controller.swipeRight(),
|
onTap: () => controller.swipeRight(),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
@ -52,7 +51,7 @@ Widget swipeRightButton(AppinioSwiperController controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//swipe card to the left side
|
//swipe card to the left side
|
||||||
Widget swipeLeftButton(AppinioSwiperController controller) {
|
Widget swipeLeftButton(CardSwiperController controller) {
|
||||||
return ExampleButton(
|
return ExampleButton(
|
||||||
onTap: () => controller.swipeLeft(),
|
onTap: () => controller.swipeLeft(),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
@ -81,7 +80,7 @@ Widget swipeLeftButton(AppinioSwiperController controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//unswipe card
|
//unswipe card
|
||||||
Widget unswipeButton(AppinioSwiperController controller) {
|
Widget unswipeButton(CardSwiperController controller) {
|
||||||
return ExampleButton(
|
return ExampleButton(
|
||||||
onTap: () => controller.unswipe(),
|
onTap: () => controller.unswipe(),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
|
|
||||||
import 'package:appinio_swiper/appinio_swiper.dart';
|
import 'package:flutter_card_swiper/card_swiper.dart';
|
||||||
import 'package:example/example_candidate_model.dart';
|
import 'package:example/example_candidate_model.dart';
|
||||||
import 'package:example/example_card.dart';
|
import 'package:example/example_card.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
import 'example_buttons.dart';
|
import 'example_buttons.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
@ -34,7 +35,7 @@ class Example extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ExamplePageState extends State<Example> {
|
class _ExamplePageState extends State<Example> {
|
||||||
final AppinioSwiperController controller = AppinioSwiperController();
|
final CardSwiperController controller = CardSwiperController();
|
||||||
|
|
||||||
List<ExampleCard> cards = [];
|
List<ExampleCard> cards = [];
|
||||||
|
|
||||||
|
|
@ -64,7 +65,7 @@ class _ExamplePageState extends State<Example> {
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: AppinioSwiper(
|
child: CardSwiper(
|
||||||
unlimitedUnswipe: true,
|
unlimitedUnswipe: true,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
unswipe: _unswipe,
|
unswipe: _unswipe,
|
||||||
|
|
@ -100,7 +101,7 @@ class _ExamplePageState extends State<Example> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _swipe(int index, AppinioSwiperDirection direction) {
|
void _swipe(int index, CardSwiperDirection direction) {
|
||||||
log("the card was swiped to the: " + direction.name);
|
log("the card was swiped to the: " + direction.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,6 @@
|
||||||
# Generated by pub
|
# Generated by pub
|
||||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||||
packages:
|
packages:
|
||||||
appinio_swiper:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
path: ".."
|
|
||||||
relative: true
|
|
||||||
source: path
|
|
||||||
version: "1.1.1"
|
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -27,6 +20,13 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_card_swiper:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: ".."
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "2.0.0"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
appinio_swiper:
|
flutter_card_swiper:
|
||||||
path: ../
|
path: ../
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AppinioSwiper extends StatefulWidget {
|
class CardSwiper extends StatefulWidget {
|
||||||
/// list of widgets for the swiper
|
/// list of widgets for the swiper
|
||||||
final List<Widget?>? cards;
|
final List<Widget?>? cards;
|
||||||
|
|
||||||
/// controller to trigger unswipe action
|
/// controller to trigger unswipe action
|
||||||
final AppinioSwiperController? controller;
|
final CardSwiperController? controller;
|
||||||
|
|
||||||
/// duration of every animation
|
/// duration of every animation
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
|
|
@ -43,9 +43,9 @@ class AppinioSwiper extends StatefulWidget {
|
||||||
final Function unswipe;
|
final Function unswipe;
|
||||||
|
|
||||||
/// direction in which the card gets swiped when triggered by controller, default set to right
|
/// direction in which the card gets swiped when triggered by controller, default set to right
|
||||||
final AppinioSwiperDirection direction;
|
final CardSwiperDirection direction;
|
||||||
|
|
||||||
const AppinioSwiper({
|
const CardSwiper({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.cards,
|
required this.cards,
|
||||||
this.controller,
|
this.controller,
|
||||||
|
|
@ -60,17 +60,17 @@ class AppinioSwiper extends StatefulWidget {
|
||||||
this.onSwipe = emptyFunctionIndex,
|
this.onSwipe = emptyFunctionIndex,
|
||||||
this.onEnd = emptyFunction,
|
this.onEnd = emptyFunction,
|
||||||
this.unswipe = emptyFunctionBool,
|
this.unswipe = emptyFunctionBool,
|
||||||
this.direction = AppinioSwiperDirection.right,
|
this.direction = CardSwiperDirection.right,
|
||||||
}) : assert(maxAngle >= 0 && maxAngle <= 360),
|
}) : assert(maxAngle >= 0 && maxAngle <= 360),
|
||||||
assert(threshold >= 1 && threshold <= 100),
|
assert(threshold >= 1 && threshold <= 100),
|
||||||
assert(direction != AppinioSwiperDirection.none),
|
assert(direction != CardSwiperDirection.none),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State createState() => _AppinioSwiperState();
|
State createState() => _CardSwiperState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppinioSwiperState extends State<AppinioSwiper>
|
class _CardSwiperState extends State<CardSwiper>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
double _left = 0;
|
double _left = 0;
|
||||||
double _top = 0;
|
double _top = 0;
|
||||||
|
|
@ -100,7 +100,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
AppinioUnswipeCard? _lastCard;
|
AppinioUnswipeCard? _lastCard;
|
||||||
// ignore: prefer_final_fields
|
// ignore: prefer_final_fields
|
||||||
List<AppinioUnswipeCard?> _lastCards = [];
|
List<AppinioUnswipeCard?> _lastCards = [];
|
||||||
AppinioSwiperDirection detectedDirection = AppinioSwiperDirection.none;
|
CardSwiperDirection detectedDirection = CardSwiperDirection.none;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -110,22 +110,22 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
widget.controller!
|
widget.controller!
|
||||||
//swipe widget from the outside
|
//swipe widget from the outside
|
||||||
..addListener(() {
|
..addListener(() {
|
||||||
if (widget.controller!.state == AppinioSwiperState.swipe) {
|
if (widget.controller!.state == CardSwiperState.swipe) {
|
||||||
if (widget.cards!.isNotEmpty) {
|
if (widget.cards!.isNotEmpty) {
|
||||||
switch (widget.direction) {
|
switch (widget.direction) {
|
||||||
case AppinioSwiperDirection.right:
|
case CardSwiperDirection.right:
|
||||||
_swipeHorizontal(context);
|
_swipeHorizontal(context);
|
||||||
break;
|
break;
|
||||||
case AppinioSwiperDirection.left:
|
case CardSwiperDirection.left:
|
||||||
_swipeHorizontal(context);
|
_swipeHorizontal(context);
|
||||||
break;
|
break;
|
||||||
case AppinioSwiperDirection.top:
|
case CardSwiperDirection.top:
|
||||||
_swipeVertical(context);
|
_swipeVertical(context);
|
||||||
break;
|
break;
|
||||||
case AppinioSwiperDirection.bottom:
|
case CardSwiperDirection.bottom:
|
||||||
_swipeVertical(context);
|
_swipeVertical(context);
|
||||||
break;
|
break;
|
||||||
case AppinioSwiperDirection.none:
|
case CardSwiperDirection.none:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_animationController.forward();
|
_animationController.forward();
|
||||||
|
|
@ -134,7 +134,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
})
|
})
|
||||||
//swipe widget left from the outside
|
//swipe widget left from the outside
|
||||||
..addListener(() {
|
..addListener(() {
|
||||||
if (widget.controller!.state == AppinioSwiperState.swipeLeft) {
|
if (widget.controller!.state == CardSwiperState.swipeLeft) {
|
||||||
if (widget.cards!.isNotEmpty) {
|
if (widget.cards!.isNotEmpty) {
|
||||||
_left = -1;
|
_left = -1;
|
||||||
_swipeHorizontal(context);
|
_swipeHorizontal(context);
|
||||||
|
|
@ -144,7 +144,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
})
|
})
|
||||||
//swipe widget right from the outside
|
//swipe widget right from the outside
|
||||||
..addListener(() {
|
..addListener(() {
|
||||||
if (widget.controller!.state == AppinioSwiperState.swipeRight) {
|
if (widget.controller!.state == CardSwiperState.swipeRight) {
|
||||||
if (widget.cards!.isNotEmpty) {
|
if (widget.cards!.isNotEmpty) {
|
||||||
_left = widget.threshold + 1;
|
_left = widget.threshold + 1;
|
||||||
_swipeHorizontal(context);
|
_swipeHorizontal(context);
|
||||||
|
|
@ -154,7 +154,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
})
|
})
|
||||||
//unswipe widget from the outside
|
//unswipe widget from the outside
|
||||||
..addListener(() {
|
..addListener(() {
|
||||||
if (widget.controller!.state == AppinioSwiperState.unswipe) {
|
if (widget.controller!.state == CardSwiperState.unswipe) {
|
||||||
if (widget.allowUnswipe) {
|
if (widget.allowUnswipe) {
|
||||||
if (!_isUnswiping) {
|
if (!_isUnswiping) {
|
||||||
if (_lastCard != null || _lastCards.isNotEmpty) {
|
if (_lastCard != null || _lastCards.isNotEmpty) {
|
||||||
|
|
@ -393,7 +393,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
_leftAnimation = Tween<double>(
|
_leftAnimation = Tween<double>(
|
||||||
begin: _left,
|
begin: _left,
|
||||||
end: (_left == 0)
|
end: (_left == 0)
|
||||||
? (widget.direction == AppinioSwiperDirection.right)
|
? (widget.direction == CardSwiperDirection.right)
|
||||||
? MediaQuery.of(context).size.width
|
? MediaQuery.of(context).size.width
|
||||||
: -MediaQuery.of(context).size.width
|
: -MediaQuery.of(context).size.width
|
||||||
: (_left > widget.threshold)
|
: (_left > widget.threshold)
|
||||||
|
|
@ -414,12 +414,12 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
).animate(_animationController);
|
).animate(_animationController);
|
||||||
});
|
});
|
||||||
if (_left > widget.threshold ||
|
if (_left > widget.threshold ||
|
||||||
_left == 0 && widget.direction == AppinioSwiperDirection.right) {
|
_left == 0 && widget.direction == CardSwiperDirection.right) {
|
||||||
_swipedDirectionHorizontal = 1;
|
_swipedDirectionHorizontal = 1;
|
||||||
detectedDirection = AppinioSwiperDirection.right;
|
detectedDirection = CardSwiperDirection.right;
|
||||||
} else {
|
} else {
|
||||||
_swipedDirectionHorizontal = -1;
|
_swipedDirectionHorizontal = -1;
|
||||||
detectedDirection = AppinioSwiperDirection.left;
|
detectedDirection = CardSwiperDirection.left;
|
||||||
}
|
}
|
||||||
(_top <= 0) ? _swipedDirectionVertical = 1 : _swipedDirectionVertical = -1;
|
(_top <= 0) ? _swipedDirectionVertical = 1 : _swipedDirectionVertical = -1;
|
||||||
_horizontal = true;
|
_horizontal = true;
|
||||||
|
|
@ -436,7 +436,7 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
_topAnimation = Tween<double>(
|
_topAnimation = Tween<double>(
|
||||||
begin: _top,
|
begin: _top,
|
||||||
end: (_top == 0)
|
end: (_top == 0)
|
||||||
? (widget.direction == AppinioSwiperDirection.bottom)
|
? (widget.direction == CardSwiperDirection.bottom)
|
||||||
? MediaQuery.of(context).size.height
|
? MediaQuery.of(context).size.height
|
||||||
: -MediaQuery.of(context).size.height
|
: -MediaQuery.of(context).size.height
|
||||||
: (_top > widget.threshold)
|
: (_top > widget.threshold)
|
||||||
|
|
@ -453,12 +453,12 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
).animate(_animationController);
|
).animate(_animationController);
|
||||||
});
|
});
|
||||||
if (_top > widget.threshold ||
|
if (_top > widget.threshold ||
|
||||||
_top == 0 && widget.direction == AppinioSwiperDirection.bottom) {
|
_top == 0 && widget.direction == CardSwiperDirection.bottom) {
|
||||||
_swipedDirectionVertical = -1;
|
_swipedDirectionVertical = -1;
|
||||||
detectedDirection = AppinioSwiperDirection.bottom;
|
detectedDirection = CardSwiperDirection.bottom;
|
||||||
} else {
|
} else {
|
||||||
_swipedDirectionVertical = 1;
|
_swipedDirectionVertical = 1;
|
||||||
detectedDirection = AppinioSwiperDirection.top;
|
detectedDirection = CardSwiperDirection.top;
|
||||||
}
|
}
|
||||||
(_left >= 0)
|
(_left >= 0)
|
||||||
? _swipedDirectionHorizontal = 1
|
? _swipedDirectionHorizontal = 1
|
||||||
|
|
@ -547,34 +547,34 @@ class _AppinioSwiperState extends State<AppinioSwiper>
|
||||||
|
|
||||||
//for null safety
|
//for null safety
|
||||||
void emptyFunction() {}
|
void emptyFunction() {}
|
||||||
void emptyFunctionIndex(int index, AppinioSwiperDirection direction) {}
|
void emptyFunctionIndex(int index, CardSwiperDirection direction) {}
|
||||||
void emptyFunctionBool(bool unswiped) {}
|
void emptyFunctionBool(bool unswiped) {}
|
||||||
|
|
||||||
//to call the swipe or unswipe function from outside of the appinio swiper
|
//to call the swipe or unswipe function from outside of the appinio swiper
|
||||||
class AppinioSwiperController extends ChangeNotifier {
|
class CardSwiperController extends ChangeNotifier {
|
||||||
AppinioSwiperState? state;
|
CardSwiperState? state;
|
||||||
|
|
||||||
//swipe the card by changing the status of the controller
|
//swipe the card by changing the status of the controller
|
||||||
void swipe() {
|
void swipe() {
|
||||||
state = AppinioSwiperState.swipe;
|
state = CardSwiperState.swipe;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
//swipe the card to the left side by changing the status of the controller
|
//swipe the card to the left side by changing the status of the controller
|
||||||
void swipeLeft() {
|
void swipeLeft() {
|
||||||
state = AppinioSwiperState.swipeLeft;
|
state = CardSwiperState.swipeLeft;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
//swipe the card to the right side by changing the status of the controller
|
//swipe the card to the right side by changing the status of the controller
|
||||||
void swipeRight() {
|
void swipeRight() {
|
||||||
state = AppinioSwiperState.swipeRight;
|
state = CardSwiperState.swipeRight;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
//calls unswipe the card by changing the status of the controller
|
//calls unswipe the card by changing the status of the controller
|
||||||
void unswipe() {
|
void unswipe() {
|
||||||
state = AppinioSwiperState.unswipe;
|
state = CardSwiperState.unswipe;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -595,6 +595,6 @@ class AppinioUnswipeCard {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AppinioSwiperState { swipe, swipeLeft, swipeRight, unswipe }
|
enum CardSwiperState { swipe, swipeLeft, swipeRight, unswipe }
|
||||||
|
|
||||||
enum AppinioSwiperDirection { none, left, right, top, bottom }
|
enum CardSwiperDirection { none, left, right, top, bottom }
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
name: swipeable_cards_stack
|
name: flutter_card_swiper
|
||||||
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.
|
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.
|
||||||
homepage: https://github.com/ricardodalarme/swipeable-cards-stack
|
homepage: https://github.com/ricardodalarme/swipeable-cards-stack
|
||||||
issue_tracker: https://github.com/ricardodalarme/swipeable-cards-stack/issues
|
issue_tracker: https://github.com/ricardodalarme/swipeable-cards-stack/issues
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue