https://github.com/openflutter/flutter_ok_image
a flutter image widget to load image.
https://github.com/openflutter/flutter_ok_image
cache error flutter image load loading net retry
Last synced: 3 months ago
JSON representation
a flutter image widget to load image.
- Host: GitHub
- URL: https://github.com/openflutter/flutter_ok_image
- Owner: OpenFlutter
- License: mit
- Created: 2018-11-22T02:33:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-16T05:37:51.000Z (about 6 years ago)
- Last Synced: 2025-06-12T01:13:45.376Z (4 months ago)
- Topics: cache, error, flutter, image, load, loading, net, retry
- Language: Dart
- Size: 98.6 KB
- Stars: 41
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OKImage
Easy to use this library to build a network image widget, you can build different layouts according to the error/load, also set up the image cache delegate.
[](https://github.com/OpenFlutter/flutter_ok_image)
[](https://pub.dartlang.org/packages/ok_image)

[](https://github.com/OpenFlutter/flutter_ok_image)## use
1. add to your pubspec.yaml
```yaml
ok_image: ^0.4.0
```2. import
```dart
import "package:ok_image/ok_image.dart";
```3. use
```dart
import "package:ok_image/ok_image.dart";
createWidget(){
return OKImage(
url: "https://ws1.sinaimg.cn/large/844036b9ly1fxfo76hzd4j20zk0nc48i.jpg",
width: 200,
height: 200,
timeout: Duration(seconds: 20),
fit: fit,
);
}
```4. params
```markdown
url: image net url
width: width
height: height
fit: show BoxFit
followRedirects: whether image redirection is allowed.
loadingWidget: display on loading
errorWidget: display when image load error / timeout.
retry: retry to load image count.
timeout: timeout duration.
onErrorTap: when loadErrorWidget show ,onTap it.
cacheDelegate: you can use the param to delegate loadImage
```Experimental: Signatures, return values, parameters and other information may be modified in the future.
```md
onLoadStateChanged: will be call on the load state changed.
```5. global config
edit `OKImage.buildErrorWidget` to config global OKImage errorWidget.
edit `OKImage.buildLoadingWidget` to config global OKImage loading.
## about other library
under BSD 3:
1. This library uses [http 0.12.0+2](https://pub.dartlang.org/packages/http) as a framework for network access.
2. using [path_provider 1.2.0](https://pub.dartlang.org/packages/path_provider) to get default catch path.
3. using [crypto 2.0.6](https://pub.dartlang.org/packages/crypto) to make and check md5.Apache 2.0:
1. Using [rxdart 0.22.1](https://pub.dartlang.org/packages/rxdart) processing logic
thanks to open source.
If you are using older versions of these open source libraries, which cause incompatibility, please update your.
If it is incompatible with me, please contact me and I will update the version number when appropriate.