Tags añadidos
This commit is contained in:
@@ -24,6 +24,7 @@ class PremiumUploadDialog extends StatefulWidget {
|
||||
class _PremiumUploadDialogState extends State<PremiumUploadDialog> {
|
||||
final titleController = TextEditingController();
|
||||
final descriptionController = TextEditingController();
|
||||
final tagsController = TextEditingController();
|
||||
MediaCategoryModel? selectedCategory;
|
||||
Uint8List? selectedVideo;
|
||||
String? videoFileName;
|
||||
@@ -36,6 +37,7 @@ class _PremiumUploadDialogState extends State<PremiumUploadDialog> {
|
||||
void dispose() {
|
||||
titleController.dispose();
|
||||
descriptionController.dispose();
|
||||
tagsController.dispose();
|
||||
_videoController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -84,12 +86,23 @@ class _PremiumUploadDialogState extends State<PremiumUploadDialog> {
|
||||
|
||||
setState(() => isUploading = true);
|
||||
|
||||
// Procesar tags: separar por comas o espacios
|
||||
List<String>? tags;
|
||||
if (tagsController.text.isNotEmpty) {
|
||||
tags = tagsController.text
|
||||
.split(RegExp(r'[,\s]+')) // Separar por comas o espacios
|
||||
.map((tag) => tag.trim())
|
||||
.where((tag) => tag.isNotEmpty)
|
||||
.toList();
|
||||
}
|
||||
|
||||
final success = await widget.provider.uploadVideo(
|
||||
title: titleController.text,
|
||||
description: descriptionController.text.isEmpty
|
||||
? null
|
||||
: descriptionController.text,
|
||||
categoryId: selectedCategory!.mediaCategoriesId,
|
||||
tags: tags,
|
||||
);
|
||||
|
||||
if (!mounted) return;
|
||||
@@ -285,6 +298,23 @@ class _PremiumUploadDialogState extends State<PremiumUploadDialog> {
|
||||
_buildLabel('Categoría *'),
|
||||
const Gap(8),
|
||||
_buildCategoryDropdown(),
|
||||
const Gap(20),
|
||||
_buildLabel('Etiquetas (Tags)'),
|
||||
const Gap(4),
|
||||
Text(
|
||||
'Separa las etiquetas con comas o espacios',
|
||||
style: AppTheme.of(context).bodyText2.override(
|
||||
fontFamily: 'Poppins',
|
||||
color: AppTheme.of(context).tertiaryText,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const Gap(8),
|
||||
_buildTextField(
|
||||
controller: tagsController,
|
||||
hintText: 'Ej: deportes, fútbol, entrenamiento',
|
||||
prefixIcon: Icons.label,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user