-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md
47 lines (38 loc) · 1.63 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Image Color Builder
[![pub package](https://img.shields.io/pub/v/image_color_builder.svg)](https://pub.dartlang.org/packages/image_color_builder)<a href="https://github.com/janlionly/flutter_image_color_builder"><img src="https://img.shields.io/github/stars/janlionly/flutter_image_color_builder.svg?style=flat&logo=github&colorB=deeppink&label=stars" alt="Star on Github"></a>
A Flutter package for generating the image and the image's dominant color with a given image url.
## Usage
See examples to `/example` folder.
```dart
ImageColorBuilder(
url: 'https://picsum.photos/200',
// url: 'assets/images/local.jpg', // support to read local image
fit: BoxFit.cover,
maxCachedCount: 15,
builder: (BuildContext context, Image? image, Color? imageColor) {
return Container(
padding: const EdgeInsets.all(40),
decoration: BoxDecoration(
color: imageColor?.withOpacity(0.8) ?? Colors.red,
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
child: image ?? const Text('No image?'),
);
},
placeholder: (contect, url) => Image.asset(
'assets/images/placeholder.png',
fit: BoxFit.fill,
),
errorWidget: (context, url, error) => Image.asset(
'assets/images/error.png',
fit: BoxFit.fill,
),
)
```
## Author
Visit my github: [janlionly](https://github.com/janlionly)<br>
Contact with me by email: [email protected]
## Contribute
I would love you to contribute to **ImageColorBuilder**
## License
**ImageColorBuilder** is available under the MIT license. See the [LICENSE](https://github.com/janlionly/flutter_image_color_builder/blob/master/LICENSE) file for more info.