158 lines
5.1 KiB
Dart
158 lines
5.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_lucide/flutter_lucide.dart';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import '../../../core/theme/app_colors.dart';
|
|
import '../../../core/theme/app_spacing.dart';
|
|
|
|
/// Video card for home grid - matches Pencil card1
|
|
class VideoCard extends StatelessWidget {
|
|
const VideoCard({
|
|
super.key,
|
|
required this.imageUrl,
|
|
this.credits = '50',
|
|
this.onTap,
|
|
this.onGenerateSimilar,
|
|
});
|
|
|
|
final String imageUrl;
|
|
final String credits;
|
|
final VoidCallback? onTap;
|
|
final VoidCallback? onGenerateSimilar;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
return Container(
|
|
width: constraints.maxWidth,
|
|
height: constraints.maxHeight,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surfaceAlt,
|
|
borderRadius: BorderRadius.circular(24),
|
|
border: Border.all(color: AppColors.border, width: 1),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.shadowMedium,
|
|
blurRadius: 12,
|
|
offset: const Offset(0, 4),
|
|
),
|
|
],
|
|
),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(24),
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
CachedNetworkImage(
|
|
imageUrl: imageUrl,
|
|
fit: BoxFit.cover,
|
|
placeholder: (_, __) => Container(
|
|
color: AppColors.surfaceAlt,
|
|
),
|
|
errorWidget: (_, __, ___) => Container(
|
|
color: AppColors.surfaceAlt,
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 12,
|
|
right: 12,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.md,
|
|
vertical: AppSpacing.xs,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.overlayDark,
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
LucideIcons.sparkles,
|
|
size: 12,
|
|
color: AppColors.surface,
|
|
),
|
|
const SizedBox(width: AppSpacing.sm),
|
|
Text(
|
|
credits,
|
|
style: const TextStyle(
|
|
color: AppColors.surface,
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
fontFamily: 'Inter',
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned.fill(
|
|
child: Center(
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
width: 48,
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surface.withValues(alpha: 0.9),
|
|
borderRadius: BorderRadius.circular(24),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withValues(alpha: 0.13),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: const Icon(
|
|
LucideIcons.play,
|
|
size: 24,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
bottom: 12,
|
|
left: 12,
|
|
right: 12,
|
|
child: GestureDetector(
|
|
onTap: onGenerateSimilar,
|
|
child: Container(
|
|
height: 44,
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primary,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.primaryShadow.withValues(alpha: 0.25),
|
|
blurRadius: 6,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
alignment: Alignment.center,
|
|
child: const Text(
|
|
'Generate Similar',
|
|
style: TextStyle(
|
|
color: AppColors.surface,
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
fontFamily: 'Inter',
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|