diff --git a/CHANGELOG.md b/CHANGELOG.md index e4054c9..cf92a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,3 +12,5 @@ ## 1.0.0 +## 1.0.0+1 + diff --git a/example/pubspec.lock b/example/pubspec.lock index 6adbcf5..4cdca58 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -47,7 +47,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.0+1" flutter_test: dependency: "direct dev" description: flutter diff --git a/lib/qrcode_reader_view.dart b/lib/qrcode_reader_view.dart index 8911709..bfec753 100644 --- a/lib/qrcode_reader_view.dart +++ b/lib/qrcode_reader_view.dart @@ -29,6 +29,7 @@ class _QrcodeReaderViewState extends State with TickerProvider QrReaderViewController _controller; AnimationController _animationController; bool openFlashlight; + Timer _timer; @override void initState() { super.initState(); @@ -44,11 +45,11 @@ class _QrcodeReaderViewState extends State with TickerProvider ..addListener(upState) ..addStatusListener((state) { if (state == AnimationStatus.completed) { - Timer(Duration(seconds: 1), () { + _timer = Timer(Duration(seconds: 1), () { _animationController?.reverse(from: 1.0); }); } else if (state == AnimationStatus.dismissed) { - Timer(Duration(seconds: 1), () { + _timer =Timer(Duration(seconds: 1), () { _animationController?.forward(from: 0.0); }); } @@ -57,6 +58,7 @@ class _QrcodeReaderViewState extends State with TickerProvider } void _clearAnimation() { + _timer?.cancel(); _animationController?.dispose(); _animationController = null; } @@ -230,7 +232,7 @@ class _QrcodeReaderViewState extends State with TickerProvider @override void dispose() { - _animationController?.dispose(); + _clearAnimation(); super.dispose(); } } diff --git a/pubspec.yaml b/pubspec.yaml index ce4050f..0a55b97 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_qr_reader description: QR code (scan QRCode and picture) recognition (AndroidView/UiKitView) -version: 1.0.0 +version: 1.0.0+1 author: 王贺天 homepage: https://github.com/hetian9288/flutter_qr_reader