Ahora el Batch se pueden añadir tags

This commit is contained in:
Abraham
2026-01-18 21:51:56 -08:00
parent 07a369904b
commit d3ca3e62e3
2 changed files with 118 additions and 89 deletions

View File

@@ -16,6 +16,7 @@ class BatchVideoItem {
String fileName;
String title;
String description;
List<String> tags;
Uint8List videoBytes;
Uint8List? posterBytes;
String? posterFileName;
@@ -31,6 +32,7 @@ class BatchVideoItem {
required this.title,
required this.videoBytes,
this.description = '',
this.tags = const [],
this.posterBytes,
this.posterFileName,
this.blobUrl,
@@ -126,6 +128,7 @@ class _PremiumBatchUploadDialogState extends State<PremiumBatchUploadDialog> {
videoBytes: bytes,
blobUrl: blobUrl,
durationSeconds: duration,
tags: [], // Lista mutable para tags
);
setState(() {
@@ -299,6 +302,7 @@ class _PremiumBatchUploadDialogState extends State<PremiumBatchUploadDialog> {
title: video.title,
description: video.description.isEmpty ? null : video.description,
durationSeconds: video.durationSeconds,
tags: video.tags.isNotEmpty ? video.tags : null,
);
return success;
@@ -482,7 +486,7 @@ class _PremiumBatchUploadDialogState extends State<PremiumBatchUploadDialog> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Subida Masiva de Videos',
'Subir Videos',
style: TextStyle(
color: Colors.white,
fontSize: 20,
@@ -493,7 +497,7 @@ class _PremiumBatchUploadDialogState extends State<PremiumBatchUploadDialog> {
const Gap(4),
Text(
_videoQueue.isEmpty
? 'Selecciona múltiples videos para subir'
? 'Selecciona uno o varios videos'
: '${_videoQueue.length} video(s) en cola',
style: TextStyle(
color: Colors.white.withOpacity(0.8),
@@ -884,6 +888,110 @@ class _PremiumBatchUploadDialogState extends State<PremiumBatchUploadDialog> {
isDense: true,
),
),
const Gap(8),
// Tags
_buildTagsField(video, isEditable),
],
);
}
Widget _buildTagsField(BatchVideoItem video, bool isEditable) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Mostrar tags existentes como chips
if (video.tags.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Wrap(
spacing: 6,
runSpacing: 6,
children: video.tags.map((tag) {
return Container(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFF4EC9F5).withOpacity(0.2),
const Color(0xFFFFB733).withOpacity(0.2),
],
),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: const Color(0xFF4EC9F5).withOpacity(0.3),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
tag,
style: TextStyle(
color: AppTheme.of(context).primaryText,
fontFamily: 'Poppins',
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
if (isEditable) ...[
const Gap(4),
GestureDetector(
onTap: () {
setState(() {
video.tags = List.from(video.tags)..remove(tag);
});
},
child: Icon(
Icons.close_rounded,
size: 14,
color: AppTheme.of(context).tertiaryText,
),
),
],
],
),
);
}).toList(),
),
),
// Campo para agregar nuevo tag
TextField(
enabled: isEditable,
style: TextStyle(
color: AppTheme.of(context).primaryText,
fontFamily: 'Poppins',
fontSize: 13,
),
decoration: InputDecoration(
hintText: 'Agregar tag y presiona Enter',
hintStyle: TextStyle(
color: AppTheme.of(context).tertiaryText,
),
prefixIcon: Icon(
Icons.label_rounded,
color: const Color(0xFFFFB733),
size: 20,
),
filled: true,
fillColor: AppTheme.of(context).secondaryBackground,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide.none,
),
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
isDense: true,
),
onSubmitted: (value) {
final tag = value.trim();
if (tag.isNotEmpty && !video.tags.contains(tag)) {
setState(() {
video.tags = List.from(video.tags)..add(tag);
});
}
},
),
],
);
}