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