mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 17:16:29 +08:00
107 lines
3.0 KiB
Dart
107 lines
3.0 KiB
Dart
import 'package:PiliPlus/common/constants.dart';
|
|
import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
|
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
|
import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
|
import 'package:PiliPlus/utils/fav_util.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class FavVideoItem extends StatelessWidget {
|
|
final String heroTag;
|
|
final FavFolderInfo item;
|
|
final VoidCallback? onTap;
|
|
final VoidCallback? onLongPress;
|
|
|
|
const FavVideoItem({
|
|
super.key,
|
|
this.onTap,
|
|
this.onLongPress,
|
|
required this.heroTag,
|
|
required this.item,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
type: MaterialType.transparency,
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
onLongPress: onLongPress ??
|
|
(onTap == null
|
|
? null
|
|
: () => imageSaveDialog(
|
|
title: item.title,
|
|
cover: item.cover,
|
|
)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AspectRatio(
|
|
aspectRatio: StyleString.aspectRatio,
|
|
child: LayoutBuilder(
|
|
builder: (context, boxConstraints) {
|
|
return Hero(
|
|
tag: heroTag,
|
|
child: NetworkImgLayer(
|
|
src: item.cover,
|
|
width: boxConstraints.maxWidth,
|
|
height: boxConstraints.maxHeight,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 10),
|
|
content(context),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget content(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final fontSize = theme.textTheme.labelMedium!.fontSize;
|
|
final color = theme.colorScheme.outline;
|
|
return Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
item.title,
|
|
textAlign: TextAlign.start,
|
|
style: const TextStyle(
|
|
letterSpacing: 0.3,
|
|
),
|
|
),
|
|
if (item.intro?.isNotEmpty == true)
|
|
Text(
|
|
item.intro!,
|
|
style: TextStyle(
|
|
fontSize: fontSize,
|
|
color: color,
|
|
),
|
|
),
|
|
Text(
|
|
'${item.mediaCount}个内容',
|
|
style: TextStyle(
|
|
fontSize: fontSize,
|
|
color: color,
|
|
),
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
FavUtil.isPublicFavText(item.attr),
|
|
style: TextStyle(
|
|
fontSize: fontSize,
|
|
color: color,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|