diff --git a/lib/routes/home/music.dart b/lib/routes/home/music.dart index 48b0c3c..98d22a3 100644 --- a/lib/routes/home/music.dart +++ b/lib/routes/home/music.dart @@ -378,8 +378,7 @@ class AudioPlaylistWidget extends HookConsumerWidget { memCacheWidth: (200 * MediaQuery.devicePixelRatioOf(context)) .round(), - placeholder: - const FallbackAudioPlaylistAvatar(), + placeholder: const FallbackAudioPlaylistAvatar(), cacheManager: CachedNetworkImagesManager.instance, ) : const FallbackAudioPlaylistAvatar(), @@ -862,27 +861,33 @@ class HomeMusicPage extends HookConsumerWidget { children: [ // Аватарка пользователя. if (user.photoMaxUrl != null) ...[ - IsolatedCachedImage( - imageUrl: user.photoMaxUrl!, - cacheKey: "${user.id}400", - imageBuilder: ( - BuildContext context, - ImageProvider imageProvider, - ) { - return Container( - width: 40, - height: 40, - decoration: BoxDecoration( - shape: BoxShape.circle, - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, + SizedBox( + width: 40, + height: 40, + child: IsolatedCachedImage( + imageUrl: user.photoMaxUrl!, + cacheKey: "${user.id}400", + width: 40, + height: 40, + imageBuilder: ( + BuildContext context, + ImageProvider imageProvider, + ) { + return Container( + width: 40, + height: 40, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), ), - ), - ); - }, - cacheManager: - CachedNetworkImagesManager.instance, + ); + }, + cacheManager: + CachedNetworkImagesManager.instance, + ), ), const Gap(18), ], diff --git a/lib/widgets/isolated_cached_network_image.dart b/lib/widgets/isolated_cached_network_image.dart index 9190abe..380d08d 100644 --- a/lib/widgets/isolated_cached_network_image.dart +++ b/lib/widgets/isolated_cached_network_image.dart @@ -180,13 +180,14 @@ class IsolatedCachedImage extends StatelessWidget { matchTextDirection: matchTextDirection, color: color, filterQuality: filterQuality, - - // TODO: Вероятнее всего, так делать не стоит. - frameBuilder: placeholder != null + frameBuilder: placeholder != null || imageBuilder != null ? (context, child, frame, loaded) { - if (loaded || frame != null) return child; + // TODO: Вероятнее всего, так делать не стоит. + if (loaded || frame != null) { + return imageBuilder?.call(context, provider) ?? child; + } - return placeholder!; + return placeholder ?? child; } : null, );