fix: remove controller dispose and add removeListener (#16)
This commit is contained in:
parent
3644453742
commit
852480fb57
|
|
@ -1,3 +1,8 @@
|
||||||
|
## NEXT
|
||||||
|
|
||||||
|
- **BREAKING CHANGE**:
|
||||||
|
- `CardSwiperController` is no longer disposed by `CardSwiper`, but who created it must dispose it.
|
||||||
|
|
||||||
## [4.1.3]
|
## [4.1.3]
|
||||||
|
|
||||||
- Fix Swiping when `isDisabled` is `true` and triggered by the `controller`.
|
- Fix Swiping when `isDisabled` is `true` and triggered by the `controller`.
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,12 @@ class _ExamplePageState extends State<Example> {
|
||||||
|
|
||||||
final cards = candidates.map((candidate) => ExampleCard(candidate)).toList();
|
final cards = candidates.map((candidate) => ExampleCard(candidate)).toList();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ class _CardSwiperState<T extends Widget> extends State<CardSwiper>
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
_animationController.dispose();
|
_animationController.dispose();
|
||||||
widget.controller?.dispose();
|
widget.controller?.removeListener(_controllerListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue