feat: 改造追剧页双列表与三列卡片
This commit is contained in:
1 parent
cffb68809c
commit
2fac46f248
8 files changed
+435
-276
No files matched your search
@@ -14,7 +14,6 @@ class FollowingGridCard extends StatelessWidget {
|
||||
required this.title,
|
||||
required this.posterUrl,
|
||||
required this.viewCount,
|
||||
required this.tags,
|
||||
required this.subtitle,
|
||||
required this.onTap,
|
||||
this.progress,
|
||||
@@ -26,7 +25,6 @@ class FollowingGridCard extends StatelessWidget {
|
||||
final String title;
|
||||
final String posterUrl;
|
||||
final int viewCount;
|
||||
final List<String> tags;
|
||||
final String subtitle;
|
||||
final VoidCallback onTap;
|
||||
final double? progress;
|
||||
@@ -37,22 +35,21 @@ class FollowingGridCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
key: Key('following-card-$dramaId'),
|
||||
borderRadius: BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||
borderRadius: BorderRadius.circular(AppDimens.homeCardRadius),
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
key: Key('following-cover-$dramaId'),
|
||||
aspectRatio: AppDimens.cardCoverAspectRatio,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimens.cardCoverRadius,
|
||||
AppDimens.homeCardRadius,
|
||||
),
|
||||
child: RemoteImage(
|
||||
posterUrl,
|
||||
@@ -64,18 +61,18 @@ class FollowingGridCard extends StatelessWidget {
|
||||
),
|
||||
if (editing)
|
||||
Positioned(
|
||||
top: -6,
|
||||
right: -6,
|
||||
top: -2,
|
||||
right: -2,
|
||||
child: GestureDetector(
|
||||
key: Key('following-remove-$dramaId'),
|
||||
onTap: onRemove,
|
||||
child: const CircleAvatar(
|
||||
radius: 13,
|
||||
radius: 12,
|
||||
backgroundColor: AppColors.contentChip,
|
||||
child: Icon(
|
||||
Icons.remove_rounded,
|
||||
color: AppColors.textPrimary,
|
||||
size: 18,
|
||||
size: 17,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -88,12 +85,29 @@ class FollowingGridCard extends StatelessWidget {
|
||||
),
|
||||
Positioned(
|
||||
right: AppDimens.cardPlayCountRight,
|
||||
bottom: AppDimens.cardPlayCountBottom,
|
||||
bottom: progress == null
|
||||
? AppDimens.cardPlayCountBottom
|
||||
: AppDimens.followingProgressHeight + 4,
|
||||
child: CoverPlayCount(
|
||||
key: Key('following-views-$dramaId'),
|
||||
count: viewCount,
|
||||
),
|
||||
),
|
||||
if (progress != null)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: LinearProgressIndicator(
|
||||
key: Key('following-progress-$dramaId'),
|
||||
value: progress!.clamp(0.0, 1.0).toDouble(),
|
||||
minHeight: AppDimens.followingProgressHeight,
|
||||
backgroundColor: AppColors.inactiveTrack,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -110,51 +124,55 @@ class FollowingGridCard extends StatelessWidget {
|
||||
height: AppDimens.cardTitleLineHeight,
|
||||
),
|
||||
),
|
||||
if (tags.isNotEmpty) ...[
|
||||
const SizedBox(height: AppDimens.cardTitleTagGap),
|
||||
_tags(),
|
||||
],
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
const SizedBox(height: AppDimens.followingSubtitleGap),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textTertiary,
|
||||
fontSize: AppDimens.cardViewsFont,
|
||||
fontSize: AppDimens.followingSubtitleFont,
|
||||
),
|
||||
),
|
||||
if (progress != null) ...[
|
||||
const SizedBox(height: AppDimens.spaceXs),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(AppDimens.progressRadius),
|
||||
child: LinearProgressIndicator(
|
||||
key: Key('following-progress-$dramaId'),
|
||||
value: progress!.clamp(0.0, 1.0).toDouble(),
|
||||
minHeight: 2,
|
||||
backgroundColor: AppColors.inactiveTrack,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _tags() {
|
||||
final visible = tags.take(3).toList(growable: false);
|
||||
return Text(
|
||||
visible.join(' | '),
|
||||
key: Key('following-tags-$dramaId'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textTertiary,
|
||||
fontSize: AppDimens.cardTagFont,
|
||||
class FollowingAddCard extends StatelessWidget {
|
||||
const FollowingAddCard({super.key, required this.onTap});
|
||||
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
key: const Key('following-add-card'),
|
||||
borderRadius: BorderRadius.circular(AppDimens.homeCardRadius),
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: AppDimens.cardCoverAspectRatio,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.contentSurface,
|
||||
borderRadius: BorderRadius.circular(AppDimens.homeCardRadius),
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
key: Key('following-add-icon'),
|
||||
size: AppDimens.followingAddIconSize,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user