Skip to content

Commit eabba24

Browse files
committed
chore: Various improvements made to SmartImageWidget.
1 parent 69be9e9 commit eabba24

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lib/widgets/smart_image.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,16 @@ class SmartImageWidget extends StatelessWidget {
5252
if (source.startsWith('http://') || source.startsWith('https://')) {
5353
if (imageType == ImageType.other) {
5454
return shouldFadeIn
55-
? FadeInImage(
55+
? FadeInImage.memoryNetwork(
5656
key: imageKey,
57-
placeholder: ResizeImage.resizeIfNeeded(
58-
_cacheWidth,
59-
_cacheHeight,
60-
MemoryImage(kTransparentImage),
61-
),
62-
image: ResizeImage.resizeIfNeeded(
63-
_cacheWidth,
64-
_cacheHeight,
65-
NetworkImage(source),
66-
),
57+
placeholder: kTransparentImage,
58+
placeholderCacheWidth: _cacheWidth,
59+
placeholderCacheHeight: _cacheWidth,
60+
image: source,
6761
width: width,
6862
height: height,
63+
imageCacheWidth: _cacheWidth,
64+
imageCacheHeight: _cacheHeight,
6965
fadeInDuration: fadeInDuration!,
7066
fit: fit,
7167
imageErrorBuilder: errorBuilder == null ? null : ((context, error, stacktrace) => errorBuilder!(context)),
@@ -167,6 +163,8 @@ class SmartImageWidget extends StatelessWidget {
167163
/// The vector image switcher.
168164
Widget Function(BuildContext context, Widget child)? get _vectorSwitcher => shouldFadeIn
169165
? ((context, child) => AnimatedSwitcher(
166+
switchInCurve: Curves.easeIn,
167+
switchOutCurve: Curves.easeOut,
170168
duration: fadeInDuration!,
171169
child: child,
172170
))

0 commit comments

Comments
 (0)