diff --git a/CHANGELOG.md b/CHANGELOG.md index 4662434..e17ba27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## NEXT + +- **BREAKING CHANGE**: + - `CardSwiperController` is no longer disposed by `CardSwiper`, but who created it must dispose it. + ## [4.1.3] - Fix Swiping when `isDisabled` is `true` and triggered by the `controller`. diff --git a/example/lib/main.dart b/example/lib/main.dart index 8458741..3eab3de 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -26,6 +26,12 @@ class _ExamplePageState extends State { final cards = candidates.map((candidate) => ExampleCard(candidate)).toList(); + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/src/card_swiper.dart b/lib/src/card_swiper.dart index 4ec72de..6eed711 100644 --- a/lib/src/card_swiper.dart +++ b/lib/src/card_swiper.dart @@ -201,7 +201,7 @@ class _CardSwiperState extends State void dispose() { super.dispose(); _animationController.dispose(); - widget.controller?.dispose(); + widget.controller?.removeListener(_controllerListener); } @override