fix gestor de contenido, wip reproductor y diseño
This commit is contained in:
@@ -251,6 +251,9 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
rendererContext.row.cells['video']?.value as MediaFileModel?;
|
||||
if (video == null) return const SizedBox();
|
||||
|
||||
// Obtener poster desde metadata_json
|
||||
final posterUrl = video.posterUrl;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
@@ -259,9 +262,9 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: video.fileUrl != null
|
||||
child: posterUrl != null && posterUrl.isNotEmpty
|
||||
? Image.network(
|
||||
video.fileUrl!,
|
||||
posterUrl,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => Icon(
|
||||
Icons.video_library,
|
||||
@@ -285,8 +288,8 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
width: 250,
|
||||
),
|
||||
PlutoColumn(
|
||||
title: 'Archivo',
|
||||
field: 'fileName',
|
||||
title: 'Descripción',
|
||||
field: 'file_description',
|
||||
type: PlutoColumnType.text(),
|
||||
width: 200,
|
||||
),
|
||||
@@ -381,28 +384,37 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (video.fileUrl != null)
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: Image.network(
|
||||
video.fileUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
color: AppTheme.of(context).tertiaryBackground,
|
||||
child: Icon(
|
||||
Icons.video_library,
|
||||
size: 64,
|
||||
color: AppTheme.of(context).tertiaryText,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Mostrar poster si existe, sino mostrar placeholder
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
topRight: Radius.circular(12),
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: video.posterUrl != null && video.posterUrl!.isNotEmpty
|
||||
? Image.network(
|
||||
video.posterUrl!,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
color: AppTheme.of(context).tertiaryBackground,
|
||||
child: Icon(
|
||||
Icons.video_library,
|
||||
size: 64,
|
||||
color: AppTheme.of(context).tertiaryText,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
color: AppTheme.of(context).tertiaryBackground,
|
||||
child: Icon(
|
||||
Icons.video_library,
|
||||
size: 64,
|
||||
color: AppTheme.of(context).tertiaryText,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
@@ -586,7 +598,7 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
.where((cat) => cat.mediaCategoriesId == video.mediaCategoryFk)
|
||||
.firstOrNull;
|
||||
|
||||
await showDialog(
|
||||
final result = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => StatefulBuilder(
|
||||
builder: (context, setDialogState) => AlertDialog(
|
||||
@@ -671,7 +683,7 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(
|
||||
'Cancelar',
|
||||
style: TextStyle(
|
||||
@@ -681,8 +693,6 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
|
||||
// Actualizar campos
|
||||
if (titleController.text != video.title) {
|
||||
await provider.updateVideoTitle(
|
||||
@@ -707,16 +717,7 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
);
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Video actualizado exitosamente'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
|
||||
await _loadData();
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.of(context).primaryColor,
|
||||
@@ -728,6 +729,20 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Manejar resultado después de cerrar el diálogo
|
||||
if (result == true) {
|
||||
await _loadData();
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Video actualizado exitosamente'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteVideo(
|
||||
|
||||
@@ -63,6 +63,9 @@ class _VideosLayoutState extends State<VideosLayout> {
|
||||
}
|
||||
|
||||
Widget _buildHeader(bool isMobile) {
|
||||
final isDark = AppTheme.themeMode == ThemeMode.dark;
|
||||
final isLightBackground = !isDark;
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(isMobile ? 16 : 24),
|
||||
decoration: BoxDecoration(
|
||||
@@ -82,26 +85,15 @@ class _VideosLayoutState extends State<VideosLayout> {
|
||||
color: AppTheme.of(context).primaryText,
|
||||
onPressed: () => _scaffoldKey.currentState?.openDrawer(),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppTheme.of(context).primaryGradient,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.energy_savings_leaf,
|
||||
color: Color(0xFF0B0B0D),
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
const Gap(12),
|
||||
Text(
|
||||
'EnergyMedia',
|
||||
style: AppTheme.of(context).title2.override(
|
||||
fontFamily: 'Poppins',
|
||||
color: AppTheme.of(context).primaryText,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
// Logo de EnergyMedia
|
||||
Image.asset(
|
||||
isMobile
|
||||
? 'assets/images/favicon.png'
|
||||
: isLightBackground
|
||||
? 'assets/images/logo_nh.png'
|
||||
: 'assets/images/logo_nh_b.png',
|
||||
height: isMobile ? 32 : 75,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
@@ -154,29 +146,13 @@ class _VideosLayoutState extends State<VideosLayout> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.energy_savings_leaf,
|
||||
color: Color(0xFF0B0B0D),
|
||||
size: 32,
|
||||
),
|
||||
// Logo de EnergyMedia
|
||||
Image.asset(
|
||||
'assets/images/logo_nh_b.png',
|
||||
height: 50,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const Gap(16),
|
||||
Text(
|
||||
'EnergyMedia',
|
||||
style: AppTheme.of(context).title2.override(
|
||||
fontFamily: 'Poppins',
|
||||
color: const Color(0xFF0B0B0D),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
const Gap(4),
|
||||
const Gap(12),
|
||||
Text(
|
||||
'Content Manager',
|
||||
style: AppTheme.of(context).bodyText2.override(
|
||||
@@ -436,28 +412,13 @@ class _VideosLayoutState extends State<VideosLayout> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.energy_savings_leaf,
|
||||
color: Color(0xFF0B0B0D),
|
||||
size: 32,
|
||||
),
|
||||
// Logo de EnergyMedia
|
||||
Image.asset(
|
||||
'assets/images/logo_nh.png',
|
||||
height: 45,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const Gap(12),
|
||||
Text(
|
||||
'EnergyMedia',
|
||||
style: AppTheme.of(context).title2.override(
|
||||
fontFamily: 'Poppins',
|
||||
color: const Color(0xFF0B0B0D),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const Gap(4),
|
||||
Text(
|
||||
'Content Manager',
|
||||
style: AppTheme.of(context).bodyText2.override(
|
||||
|
||||
Reference in New Issue
Block a user