mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-09 19:47:57 +08:00
107 lines
3.3 KiB
Dart
107 lines
3.3 KiB
Dart
import 'package:PiliPlus/common/constants.dart';
|
|
import 'package:PiliPlus/common/widgets/badge.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/space/space_season_series/season.dart';
|
|
import 'package:PiliPlus/utils/date_utils.dart';
|
|
import 'package:PiliPlus/utils/platform_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class SeasonSeriesCard extends StatelessWidget {
|
|
const SeasonSeriesCard({
|
|
super.key,
|
|
required this.item,
|
|
required this.onTap,
|
|
});
|
|
final SpaceSsModel item;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
void onLongPress() => imageSaveDialog(
|
|
title: item.meta!.name,
|
|
cover: item.meta!.cover,
|
|
);
|
|
return Material(
|
|
type: MaterialType.transparency,
|
|
child: InkWell(
|
|
onLongPress: onLongPress,
|
|
onSecondaryTap: PlatformUtils.isMobile ? null : onLongPress,
|
|
onTap: onTap,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: StyleString.safeSpace,
|
|
vertical: 5,
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AspectRatio(
|
|
aspectRatio: StyleString.aspectRatio,
|
|
child: LayoutBuilder(
|
|
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
|
final double maxWidth = boxConstraints.maxWidth;
|
|
final double maxHeight = boxConstraints.maxHeight;
|
|
return Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
NetworkImgLayer(
|
|
src: item.meta!.cover,
|
|
width: maxWidth,
|
|
height: maxHeight,
|
|
),
|
|
PBadge(
|
|
text:
|
|
'${item.meta!.seasonId != null ? '合集' : '列表'}: ${item.meta!.total}',
|
|
bottom: 6.0,
|
|
right: 6.0,
|
|
),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 10),
|
|
content(context),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget content(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
item.meta!.name!,
|
|
textAlign: TextAlign.start,
|
|
style: TextStyle(
|
|
fontSize: theme.textTheme.bodyMedium!.fontSize,
|
|
height: 1.42,
|
|
letterSpacing: 0.3,
|
|
),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
DateFormatUtils.dateFormat(item.meta!.ptime),
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
height: 1,
|
|
color: theme.colorScheme.outline,
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
const Spacer(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|