Skip to content

Commit

Permalink
Фиксы круглых аватарок на главном экране и экране профиля.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zensonaton committed Sep 30, 2024
1 parent e509f22 commit 52cd7cf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
49 changes: 27 additions & 22 deletions lib/routes/home/music.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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),
],
Expand Down
11 changes: 6 additions & 5 deletions lib/widgets/isolated_cached_network_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down

0 comments on commit 52cd7cf

Please sign in to comment.