release 1.0.1: add check widget if mounted when setState

master
Jpeng 5 years ago
parent 32547e8642
commit e8667fb5c5

@ -4,3 +4,6 @@
## 1.0.0
* init release
## 1.0.1
* add check mounted when setState

@ -7,14 +7,14 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
version: "2.3.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0"
version: "1.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -66,28 +66,28 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
version: "1.1.7"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
version: "1.8.0+1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
version: "2.0.5"
sky_engine:
dependency: transitive
description: flutter
@ -120,7 +120,7 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
term_glyph:
dependency: transitive
description:

@ -102,7 +102,7 @@ class GifImageState extends State<GifImage>{
int _curIndex = 0;
bool _fetchComplete= false;
ImageInfo get _imageInfo {
if(!_fetchComplete)return null;
if(!_fetchComplete)return null;
return _infos==null?null:_infos[_curIndex];
}
@ -125,14 +125,15 @@ class GifImageState extends State<GifImage>{
super.didUpdateWidget(oldWidget);
if (widget.image != oldWidget.image) {
fetchGif(widget.image).then((imageInfors){
setState(() {
_infos = imageInfors;
_fetchComplete=true;
_curIndex = widget.controller.value.toInt();
if(widget.onFetchCompleted!=null){
widget.onFetchCompleted();
}
});
if(mounted)
setState(() {
_infos = imageInfors;
_fetchComplete=true;
_curIndex = widget.controller.value.toInt();
if(widget.onFetchCompleted!=null){
widget.onFetchCompleted();
}
});
});
}
if (widget.controller != oldWidget.controller) {
@ -143,9 +144,10 @@ class GifImageState extends State<GifImage>{
void _listener(){
if(_curIndex!=widget.controller.value&&_fetchComplete){
setState(() {
_curIndex = widget.controller.value.toInt();
});
if(mounted)
setState(() {
_curIndex = widget.controller.value.toInt();
});
}
}
@ -154,14 +156,15 @@ class GifImageState extends State<GifImage>{
super.didChangeDependencies();
if(_infos==null){
fetchGif(widget.image).then((imageInfors){
setState(() {
_infos = imageInfors;
_fetchComplete=true;
_curIndex = widget.controller.value.toInt();
if(widget.onFetchCompleted!=null){
widget.onFetchCompleted();
}
});
if(mounted)
setState(() {
_infos = imageInfors;
_fetchComplete=true;
_curIndex = widget.controller.value.toInt();
if(widget.onFetchCompleted!=null){
widget.onFetchCompleted();
}
});
});
}
}

@ -19,7 +19,7 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
version: "1.1.7"
sky_engine:
dependency: transitive
description: flutter

@ -1,6 +1,6 @@
name: flutter_gifimage
description: a gifimage for flutter,for solving gif cannot be controlled speed,progress
version: 1.0.0
version: 1.0.1
author: Jpeng <peng8350@gmail.com>
homepage: https://github.com/peng8350/flutter_gifimage

Loading…
Cancel
Save