Skip to content

Commit dc2d151

Browse files
committed
Create Min Height Loading Variants
*Create Min Height loading variants for dynamic images.
1 parent 19adb8b commit dc2d151

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,38 @@ That's it!
3030

3131
[![Loading GIFs Sizes](packages/Loading%20GIFs%20Sizes.gif)](https://gallery.imfast.io/flutterwebsites/loadinggifs/)
3232

33-
This library is optimized for size so it only includes the base asset. Change the size of the loading spinners with `scale` and `placeholderScale`.
33+
### Size
34+
35+
This library is optimized for size so it only includes the base asset sizes. Change the size of the loading spinners using `scale` and `placeholderScale`.
3436

3537
```dart
3638
FadeInImage.assetNetwork(placeholder: cupertinoActivityIndicator, image: "image.png", placeholderScale: 5);
3739
3840
Image.asset(circularProgressIndicator, scale: 10);
3941
```
4042

43+
### Dynamic Images
44+
45+
When loading images whose dimensions are unknown ahead of time, use `cupertinoActivityIndicatorSmall` instead of `cupertinoActivityIndicator`. `cupertinoActivityIndicatorSmall` is a min height variant of `cupertinoActivityIndicator` which allows Flutter to correctly expand the loaded image into the layout.
46+
47+
The small variant should be used when loading a list of images or compositing an image from multiple images.
48+
49+
```dart
50+
ListView(
51+
children: <Widget>[
52+
FadeInImage.assetNetwork(
53+
placeholder: cupertinoActivityIndicatorSmall,
54+
image: "image_1.png"),
55+
FadeInImage.assetNetwork(
56+
placeholder: cupertinoActivityIndicatorSmall,
57+
image: "image_2.png"),
58+
FadeInImage.assetNetwork(
59+
placeholder: cupertinoActivityIndicatorSmall,
60+
image: "image_3.png"),
61+
],
62+
)
63+
```
64+
4165
## Assets
4266

4367
### iOS (Cupertino) Loading Indicators
@@ -94,7 +118,7 @@ Loading GIFs is licensed under Zero-Clause BSD and released as Emailware. If you
94118
<img alt="Codelessly Website"
95119
src="https://lh3.googleusercontent.com/YmMGcgeO7Km9-J9vFRByov5sb7OUKetnKs8pTi0JZMDj3GVJ61GMTcTlHB7u9uHDHag=w96" />
96120
</a>
97-
<a href="https://twitter.com/codelessly1">
121+
<a href="https://twitter.com/codelessly_">
98122
<img alt="Codelessly Twitter"
99123
src="https://lh3.ggpht.com/lSLM0xhCA1RZOwaQcjhlwmsvaIQYaP3c5qbDKCgLALhydrgExnaSKZdGa8S3YtRuVA=w96" />
100124
</a>
186 KB
Loading
15.8 KB
Loading

lib/loading_gifs.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,33 @@ library loading_gifs;
77
const String cupertinoActivityIndicator =
88
"packages/loading_gifs/assets/images/cupertino_activity_indicator.gif";
99

10+
/// Small CupertinoActivityIndicator GIF asset path.
11+
/// Use this asset instead of [cupertinoActivityIndicator]
12+
/// for dynamic images whose dimensions are
13+
/// unknown ahead of time. Use where the
14+
/// loading image resizes itself into the layout for
15+
/// correct size calculation.
16+
/// ```dart
17+
/// Image.asset(cupertinoActivityIndicatorSmall);
18+
/// ```
19+
const String cupertinoActivityIndicatorSmall =
20+
"packages/loading_gifs/assets/images/cupertino_activity_indicator_small.gif";
21+
1022
/// CircularProgressIndicator GIF asset path.
1123
/// ```dart
1224
/// Image.asset(circularProgressIndicator);
1325
/// ```
1426
const String circularProgressIndicator =
1527
"packages/loading_gifs/assets/images/circular_progress_indicator.gif";
28+
29+
/// Small CircularProgressIndicator GIF asset path.
30+
/// Use this asset instead of [circularProgressIndicator]
31+
/// for dynamic images whose dimensions are
32+
/// unknown ahead of time. Use where the
33+
/// loading image resizes itself into the layout for
34+
/// correct size calculation.
35+
/// ```dart
36+
/// Image.asset(circularProgressIndicatorSmall);
37+
/// ```
38+
const String circularProgressIndicatorSmall =
39+
"packages/loading_gifs/assets/images/circular_progress_indicator_small.gif";

0 commit comments

Comments
 (0)