Closed stuartrapop closed 5 months ago
Hey @stuartrapop , could you please explain the issue a little bit? or maybe share your code snippet?
Hello,
Thanks for asking and sorry for not being able to give more concrete information which can help find the error - which may not be inside the AppinioSwiper code but rather a poor implementation. Could I be using the animation controller incorrectly from within the SwipeButtons widget?
Here are snippets where I instantiate the AppinioSwiper:
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
),
child: Column(
children: [
Center(
child: SizedBox(
height: cardHeight,
child: AppinioSwiper(
// isDisabled: widget.isDisabled,
duration: const Duration(milliseconds: 800),
swipeOptions: SwipeOptions.only(
left: true, right: !widget.isDisabled),
backgroundCardCount: 1,
controller: controller,
maxAngle: 20,
onCardPositionChanged: (
SwiperPosition position,
) {
// debugPrint('${position.offset.toAxisDirection()}, '
// '${position.offset}, '
// '${position.angle}');
},
onSwipeBegin: (previousIndex, targetIndex, activity) => {
print("swipe begin"),
print(
"${activity.begin!.distance} begin${activity.end!.distance}"),
if (activity.begin!.distance == 0.0 &&
activity.end!.distance == 0.0 &&
widget.isDisabled)
{
showMyDialog(
context: context,
maxLikes: maxLikes,
returnPath: "/cards",
),
}
},
onSwipeEnd: swipeEnd,
onEnd: _onEnd,
cardCount: widget.names.length,
cardBuilder: (BuildContext context, int index) {
if (widget.names.isEmpty) {
return Center(
child: Container(
color: Colors.white,
child: const Text("No cards to show")),
);
}
return NameCard(
key: UniqueKey(),
controller: controller,
name: widget.names[index],
index: index,
swipeLeft: swipeLeft,
swipeRight: swipeRight,
isDisabled: widget.isDisabled,
);
},
),
),
),
SwipeButtons(
mounted: mounted,
swipeLeft: swipeLeft,
swipeRight: swipeRight,
isSwiping: isSwiping,
controller: controller,
hasRecentLike: widget.hasRecentLike,
getRecentLike: widget.getRecentLike,
shakeCard: shakeCard,
isDisabled: widget.isDisabled,
),
],
),
),
],
);
}
and my dispose method.
@override
void dispose() {
print("disposing Car dDeck");
controller.swipeActivity?.animation.reset();
controller.dispose();
super.dispose();
}
Hey @stuartrapop , I tried this code and I am unable to reproduce it. In the upcoming version we have made multiple bug fixes. Maybe you can try that next week when its available and if the issue persist just reopen this ticket.
BTW, your implementation is good.
@khanmujeeb687 Thank you for the feedback !
Hello,
I am still getting this error in Crashylitics with the latest version for quite a few users. Does a fatal exception necessarily mean that the app crashes for the user ?
Fatal Exception: FlutterError
Null check operator used on a null value
Fatal Exception: FlutterError
0 App 0xa4a9f AnimationController.dispose + 838 (animation_controller.dart:838)
1 App 0x6ecb0b AppinioSwiperState._startActivity.
When I try my app Nameby https://apps.apple.com/gb/app/nameby-baby-name-finder/id6473181574 on an ios device I am not able to see the error either. This makes debugging especially difficult.
Thanks for your help,
Stuart
Plugin name Appinio Swiper
Describe the bug Null check operator used on a null value
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Screenshots I can't reproduce the error, but am getting consistent reports
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Maybe I am doing something wrong ????
Report from Firebase - DM for more info. Fatal Exception: FlutterError 0 App 0xd35b3 AnimationController.dispose + 838 (animation_controller.dart:838) 1 App 0x72acef AppinioSwiperState._startActivity. + 266 (appinio_swiper.dart:266)
2 App 0x28ae3 RootZone.runUnary + 1661 (zone.dart:1661)
3 App 0x9c1a2b AppinioSwiperState._startActivity + 276 (appinio_swiper.dart:276)
4 App 0x9c16bb AppinioSwiperState._onSwipe + 194 (appinio_swiper.dart:194)
5 App 0x9d0cff AppinioSwiperController.swipeLeft + 609 (appinio_swiper.dart:609)