Skip to content

Commit

Permalink
chore: Various improvements made to SmartImageWidget.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost committed Oct 24, 2024
1 parent 69be9e9 commit eabba24
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/widgets/smart_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,16 @@ class SmartImageWidget extends StatelessWidget {
if (source.startsWith('http://') || source.startsWith('https://')) {
if (imageType == ImageType.other) {
return shouldFadeIn
? FadeInImage(
? FadeInImage.memoryNetwork(
key: imageKey,
placeholder: ResizeImage.resizeIfNeeded(
_cacheWidth,
_cacheHeight,
MemoryImage(kTransparentImage),
),
image: ResizeImage.resizeIfNeeded(
_cacheWidth,
_cacheHeight,
NetworkImage(source),
),
placeholder: kTransparentImage,
placeholderCacheWidth: _cacheWidth,
placeholderCacheHeight: _cacheWidth,
image: source,
width: width,
height: height,
imageCacheWidth: _cacheWidth,
imageCacheHeight: _cacheHeight,
fadeInDuration: fadeInDuration!,
fit: fit,
imageErrorBuilder: errorBuilder == null ? null : ((context, error, stacktrace) => errorBuilder!(context)),
Expand Down Expand Up @@ -167,6 +163,8 @@ class SmartImageWidget extends StatelessWidget {
/// The vector image switcher.
Widget Function(BuildContext context, Widget child)? get _vectorSwitcher => shouldFadeIn
? ((context, child) => AnimatedSwitcher(
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
duration: fadeInDuration!,
child: child,
))
Expand Down

0 comments on commit eabba24

Please sign in to comment.