mejorado responsive

This commit is contained in:
Abraham
2026-01-12 23:57:16 -08:00
parent 40a9be5936
commit cd23fdc071
2 changed files with 1114 additions and 414 deletions

View File

@@ -155,47 +155,107 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(12),
if (isMobile)
// Vista móvil: solo botón centrado con diseño mejorado
Center(
child: Container(
width: double.infinity,
constraints: const BoxConstraints(maxWidth: 300),
decoration: BoxDecoration(
gradient: LinearGradient(
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF4EC9F5),
const Color(0xFFFFB733),
Color(0xFF4EC9F5),
Color(0xFFFFB733),
],
),
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
color: const Color(0xFF4EC9F5).withOpacity(0.4),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
),
child: const Icon(
Icons.video_library,
color: Color(0xFF0B0B0D),
size: 24,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () => _showUploadDialog(provider),
borderRadius: BorderRadius.circular(16),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 24, vertical: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.cloud_upload_rounded,
color: Color(0xFF0B0B0D),
size: 24,
),
const Gap(12),
Text(
'Subir Video',
style: const TextStyle(
color: Color(0xFF0B0B0D),
fontSize: 16,
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
letterSpacing: 0.5,
),
),
],
),
),
),
),
),
const Gap(16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Gestor de Videos',
style: AppTheme.of(context).title2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold,
fontSize: 22,
),
)
else
// Vista desktop: diseño original con icono, texto y botón
Row(
children: [
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFF4EC9F5),
const Color(0xFFFFB733),
],
),
if (!isMobile) ...[
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color:
AppTheme.of(context).primaryColor.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: const Icon(
Icons.video_library,
color: Color(0xFF0B0B0D),
size: 24,
),
),
const Gap(16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Gestor de Videos',
style: AppTheme.of(context).title2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold,
fontSize: 22,
),
),
const Gap(4),
Text(
'${provider.mediaFiles.length} videos disponibles',
@@ -206,17 +266,15 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
),
),
],
],
),
),
),
PremiumButton(
text: isMobile ? 'Subir' : 'Subir Video',
icon: Icons.cloud_upload,
onPressed: () => _showUploadDialog(provider),
width: isMobile ? 100 : null,
),
],
),
PremiumButton(
text: 'Subir Video',
icon: Icons.cloud_upload,
onPressed: () => _showUploadDialog(provider),
),
],
),
const Gap(16),
_buildSearchField(provider),
],
@@ -607,148 +665,407 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
}
Widget _buildVideoCard(MediaFileModel video, VideosProvider provider) {
return Card(
margin: const EdgeInsets.only(bottom: 16),
color: AppTheme.of(context).secondaryBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
return Container(
margin: const EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppTheme.of(context).secondaryBackground,
AppTheme.of(context).tertiaryBackground,
],
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 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,
),
),
),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
width: 2,
),
boxShadow: [
BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.15),
blurRadius: 20,
offset: const Offset(0, 8),
spreadRadius: 0,
),
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Thumbnail con overlay premium
Stack(
children: [
Text(
video.title ?? video.fileName,
style: AppTheme.of(context).title3.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const Gap(8),
if (video.fileDescription != null &&
video.fileDescription!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text(
video.fileDescription!,
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).secondaryText,
AspectRatio(
aspectRatio: 16 / 9,
child: video.posterUrl != null && video.posterUrl!.isNotEmpty
? Image.network(
video.posterUrl!,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) =>
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).tertiaryBackground,
AppTheme.of(context).primaryBackground,
],
),
),
child: Icon(
Icons.video_library_rounded,
size: 80,
color: AppTheme.of(context).tertiaryText,
),
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
)
: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).tertiaryBackground,
AppTheme.of(context).primaryBackground,
],
),
),
child: Icon(
Icons.video_library_rounded,
size: 80,
color: AppTheme.of(context).tertiaryText,
),
),
),
// Overlay con gradiente
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withOpacity(0.7),
],
stops: const [0.5, 1.0],
),
),
),
Row(
children: [
Icon(
Icons.play_circle_filled,
size: 16,
color: AppTheme.of(context).tertiaryText,
),
const Gap(4),
Text(
'${video.reproducciones} reproducciones',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
),
),
if (video.durationSeconds != null) ...[
const Gap(12),
Icon(
Icons.access_time,
size: 16,
color: AppTheme.of(context).tertiaryText,
),
const Gap(4),
Text(
_formatDuration(video.durationSeconds!),
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
),
),
],
],
),
const Gap(12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton.icon(
onPressed: () => _playVideo(video),
icon: const Icon(Icons.play_circle_outline, size: 18),
label: const Text('Reproducir'),
style: TextButton.styleFrom(
foregroundColor: const Color(0xFF4EC9F5),
// Botón de play central
Positioned.fill(
child: Center(
child: Container(
width: 64,
height: 64,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).primaryColor,
AppTheme.of(context).secondaryColor,
],
),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: AppTheme.of(context)
.primaryColor
.withOpacity(0.5),
blurRadius: 20,
offset: const Offset(0, 4),
),
],
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () => _playVideo(video),
customBorder: const CircleBorder(),
child: const Icon(
Icons.play_arrow_rounded,
color: Colors.white,
size: 36,
),
),
),
),
TextButton.icon(
onPressed: () => _editVideoDialog(video, provider),
icon: const Icon(Icons.edit, size: 18),
label: const Text('Editar'),
style: TextButton.styleFrom(
foregroundColor: const Color(0xFFFFB733),
),
),
// Stats en la parte inferior
Positioned(
bottom: 12,
left: 12,
right: 12,
child: Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 6,
),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.6),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color:
AppTheme.of(context).success.withOpacity(0.5),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.visibility_rounded,
size: 14,
color: AppTheme.of(context).success,
),
const Gap(4),
Text(
'${video.reproducciones}',
style: TextStyle(
color: AppTheme.of(context).success,
fontSize: 11,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
TextButton.icon(
onPressed: () => _deleteVideoDialog(video, provider),
icon: const Icon(Icons.delete, size: 18),
label: const Text('Eliminar'),
style: TextButton.styleFrom(
foregroundColor: const Color(0xFFFF2D2D),
),
),
],
const Gap(8),
if (video.durationSeconds != null)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 6,
),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.6),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Colors.white.withOpacity(0.3),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.access_time_rounded,
size: 14,
color: Colors.white,
),
const Gap(4),
Text(
_formatDuration(video.durationSeconds!),
style: const TextStyle(
color: Colors.white,
fontSize: 11,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
),
],
),
// Contenido de la card
Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Título
Text(
video.title ?? video.fileName,
style: AppTheme.of(context).title3.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold,
fontSize: 18,
letterSpacing: 0.3,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const Gap(12),
// Descripción
if (video.fileDescription != null &&
video.fileDescription!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
video.fileDescription!,
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).secondaryText,
fontSize: 14,
lineHeight: 1.5,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
),
// Tags si existen
if (video.tags.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: video.tags.take(4).map((tag) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: AppTheme.of(context)
.primaryColor
.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: AppTheme.of(context)
.primaryColor
.withOpacity(0.3),
),
),
child: Text(
tag,
style: TextStyle(
color: AppTheme.of(context).primaryColor,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
);
}).toList(),
),
),
// Divisor
Container(
height: 1,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.transparent,
AppTheme.of(context).primaryColor.withOpacity(0.2),
Colors.transparent,
],
),
),
),
const Gap(16),
// Botones de acción premium
Row(
children: [
Expanded(
child: _buildMobilePremiumButton(
icon: Icons.edit_rounded,
label: 'Editar',
color: AppTheme.of(context).secondaryColor,
onPressed: () => _editVideoDialog(video, provider),
),
),
const Gap(12),
_buildMobileIconButton(
icon: Icons.delete_rounded,
color: AppTheme.of(context).error,
onPressed: () => _deleteVideoDialog(video, provider),
),
],
),
],
),
),
],
),
),
);
}
Widget _buildMobilePremiumButton({
required IconData icon,
required String label,
required Color color,
required VoidCallback onPressed,
}) {
return Container(
height: 48,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
color.withOpacity(0.15),
color.withOpacity(0.08),
],
),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: color.withOpacity(0.3),
width: 2,
),
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onPressed,
borderRadius: BorderRadius.circular(12),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color: color, size: 20),
const Gap(8),
Text(
label,
style: TextStyle(
color: color,
fontSize: 14,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
),
],
),
],
),
),
);
}
Widget _buildMobileIconButton({
required IconData icon,
required Color color,
required VoidCallback onPressed,
}) {
return Container(
width: 48,
height: 48,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
color.withOpacity(0.15),
color.withOpacity(0.08),
],
),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: color.withOpacity(0.3),
width: 2,
),
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onPressed,
borderRadius: BorderRadius.circular(12),
child: Icon(icon, color: color, size: 20),
),
),
);
}