mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-18 16:16:14 +08:00
@@ -30,16 +30,16 @@ class Pic {
|
||||
List<Pic>? pics;
|
||||
int? style;
|
||||
String? url;
|
||||
num? width;
|
||||
num? height;
|
||||
double? width;
|
||||
double? height;
|
||||
num? size;
|
||||
String? liveUrl;
|
||||
bool? isLongPic;
|
||||
|
||||
Pic.fromJson(Map<String, dynamic> json) {
|
||||
url = json['url'];
|
||||
width = json['width'];
|
||||
height = json['height'];
|
||||
width = (json['width'] as num?)?.toDouble();
|
||||
height = (json['height'] as num?)?.toDouble();
|
||||
size = json['size'];
|
||||
pics = (json['pics'] as List?)?.map((item) => Pic.fromJson(item)).toList();
|
||||
style = json['style'];
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -46,6 +45,7 @@ Widget htmlRender({
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
}
|
||||
final size = isEmote ? 22.0 : null;
|
||||
return Hero(
|
||||
tag: imgUrl,
|
||||
child: GestureDetector(
|
||||
@@ -58,10 +58,14 @@ Widget htmlRender({
|
||||
);
|
||||
}
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
width: isEmote ? 22 : maxWidth,
|
||||
height: isEmote ? 22 : null,
|
||||
src: imgUrl,
|
||||
child: CachedNetworkImage(
|
||||
width: size,
|
||||
height: size,
|
||||
imageUrl: Utils.thumbnailImgUrl(imgUrl, 60),
|
||||
fadeInDuration: const Duration(milliseconds: 120),
|
||||
fadeOutDuration: const Duration(milliseconds: 120),
|
||||
placeholder: (context, url) =>
|
||||
Image.asset('assets/images/loading.png'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -160,29 +160,31 @@ class OpusContent extends StatelessWidget {
|
||||
return widget;
|
||||
case 2 when (element.pic != null):
|
||||
if (element.pic!.pics!.length == 1) {
|
||||
final pic = element.pic!.pics!.first;
|
||||
final width = pic.width == null
|
||||
? null
|
||||
: min(maxWidth.toDouble(), pic.width!);
|
||||
final height = width == null || pic.height == null
|
||||
? null
|
||||
: width * pic.height! / pic.width!;
|
||||
return Hero(
|
||||
tag: element.pic!.pics!.first.url!,
|
||||
tag: pic.url!,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (callback != null) {
|
||||
callback!([element.pic!.pics!.first.url!], 0);
|
||||
callback!([pic.url!], 0);
|
||||
} else {
|
||||
context.imageView(
|
||||
initialPage: 0,
|
||||
imgList: [
|
||||
SourceModel(url: element.pic!.pics!.first.url!)
|
||||
],
|
||||
imgList: [SourceModel(url: pic.url!)],
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Center(
|
||||
child: ClipRRect(
|
||||
borderRadius: StyleString.mdRadius,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: Utils.thumbnailImgUrl(
|
||||
element.pic!.pics!.first.url!,
|
||||
60,
|
||||
),
|
||||
width: width,
|
||||
height: height,
|
||||
imageUrl: Utils.thumbnailImgUrl(pic.url!, 60),
|
||||
fadeInDuration: const Duration(milliseconds: 120),
|
||||
fadeOutDuration: const Duration(milliseconds: 120),
|
||||
placeholder: (context, url) =>
|
||||
@@ -190,7 +192,6 @@ class OpusContent extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return imageView(
|
||||
|
||||
Reference in New Issue
Block a user