mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
@@ -281,7 +281,7 @@ class CustomGridView extends StatelessWidget {
|
|||||||
width: imageWidth,
|
width: imageWidth,
|
||||||
height: imageHeight,
|
height: imageHeight,
|
||||||
alignment: item.isLongPic ? .topCenter : .center,
|
alignment: item.isLongPic ? .topCenter : .center,
|
||||||
forceUseCacheWidth: item.width <= item.height,
|
cacheWidth: item.width <= item.height,
|
||||||
getPlaceHolder: () => placeHolder,
|
getPlaceHolder: () => placeHolder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -11,30 +11,30 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.src,
|
required this.src,
|
||||||
required this.width,
|
required this.width,
|
||||||
this.height,
|
required this.height,
|
||||||
this.type = .def,
|
this.type = .def,
|
||||||
this.fadeOutDuration = const Duration(milliseconds: 120),
|
this.fadeOutDuration = const Duration(milliseconds: 120),
|
||||||
this.fadeInDuration = const Duration(milliseconds: 120),
|
this.fadeInDuration = const Duration(milliseconds: 120),
|
||||||
this.quality,
|
this.quality,
|
||||||
this.borderRadius = StyleString.mdRadius,
|
this.borderRadius = StyleString.mdRadius,
|
||||||
this.forceUseCacheWidth = false,
|
|
||||||
this.getPlaceHolder,
|
this.getPlaceHolder,
|
||||||
this.fit = .cover,
|
this.fit = .cover,
|
||||||
this.alignment = .center,
|
this.alignment = .center,
|
||||||
|
this.cacheWidth,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? src;
|
final String? src;
|
||||||
final double width;
|
final double width;
|
||||||
final double? height;
|
final double height;
|
||||||
final ImageType type;
|
final ImageType type;
|
||||||
final Duration fadeOutDuration;
|
final Duration fadeOutDuration;
|
||||||
final Duration fadeInDuration;
|
final Duration fadeInDuration;
|
||||||
final int? quality;
|
final int? quality;
|
||||||
final BorderRadius borderRadius;
|
final BorderRadius borderRadius;
|
||||||
final bool forceUseCacheWidth;
|
|
||||||
final ValueGetter<Widget>? getPlaceHolder;
|
final ValueGetter<Widget>? getPlaceHolder;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final Alignment alignment;
|
final Alignment alignment;
|
||||||
|
final bool? cacheWidth;
|
||||||
|
|
||||||
static Color? reduceLuxColor = Pref.reduceLuxColor;
|
static Color? reduceLuxColor = Pref.reduceLuxColor;
|
||||||
static bool reduce = false;
|
static bool reduce = false;
|
||||||
@@ -64,10 +64,10 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
required bool isAvatar,
|
required bool isAvatar,
|
||||||
}) {
|
}) {
|
||||||
int? memCacheWidth, memCacheHeight;
|
int? memCacheWidth, memCacheHeight;
|
||||||
if (height == null || forceUseCacheWidth || width <= height!) {
|
if (cacheWidth ?? width <= height) {
|
||||||
memCacheWidth = width.cacheSize(context);
|
memCacheWidth = width.cacheSize(context);
|
||||||
} else {
|
} else {
|
||||||
memCacheHeight = height?.cacheSize(context);
|
memCacheHeight = height.cacheSize(context);
|
||||||
}
|
}
|
||||||
return CachedNetworkImage(
|
return CachedNetworkImage(
|
||||||
imageUrl: ImageUtils.thumbnailUrl(src, quality),
|
imageUrl: ImageUtils.thumbnailUrl(src, quality),
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ class BaseEmote {
|
|||||||
late String url;
|
late String url;
|
||||||
late String emoticonUnique;
|
late String emoticonUnique;
|
||||||
late double width;
|
late double width;
|
||||||
double? height;
|
late double height;
|
||||||
late final isUpower = emoticonUnique.startsWith('upower_');
|
late final isUpower = emoticonUnique.startsWith('upower_');
|
||||||
|
|
||||||
BaseEmote.fromJson(Map<String, dynamic> json) {
|
BaseEmote.fromJson(Map<String, dynamic> json) {
|
||||||
url = json['url'];
|
url = json['url'];
|
||||||
emoticonUnique = json['emoticon_unique'];
|
emoticonUnique = json['emoticon_unique'];
|
||||||
width = (json['width'] as num).toDouble();
|
width = (json['width'] as num).toDouble();
|
||||||
height = (json['height'] as num?)?.toDouble();
|
height = (json['height'] as num?)?.toDouble() ?? width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||||
|
|||||||
@@ -234,11 +234,7 @@ class LiveRoomChatPanel extends StatelessWidget {
|
|||||||
src: uemote.url,
|
src: uemote.url,
|
||||||
type: ImageType.emote,
|
type: ImageType.emote,
|
||||||
width: isUpower ? uemote.width : uemote.width / devicePixelRatio,
|
width: isUpower ? uemote.width : uemote.width / devicePixelRatio,
|
||||||
height: uemote.height == null
|
height: isUpower ? uemote.height : uemote.height / devicePixelRatio,
|
||||||
? null
|
|
||||||
: isUpower
|
|
||||||
? uemote.height!
|
|
||||||
: uemote.height! / devicePixelRatio,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1602,7 +1602,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
|||||||
src: videoDetailController.cover.value,
|
src: videoDetailController.cover.value,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
forceUseCacheWidth: true,
|
cacheWidth: true,
|
||||||
getPlaceHolder: () => Center(
|
getPlaceHolder: () => Center(
|
||||||
child: Image.asset('assets/images/loading.png'),
|
child: Image.asset('assets/images/loading.png'),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user