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

@@ -86,13 +86,28 @@ class _DashboardPageState extends State<DashboardPage>
Widget _buildHeader() { Widget _buildHeader() {
return Container( return Container(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(32),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: AppTheme.of(context).primaryGradient, gradient: LinearGradient(
borderRadius: BorderRadius.circular(16), begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF4EC9F5),
const Color(0xFF6B2F8A),
const Color(0xFFFFB733),
],
stops: const [0.0, 0.5, 1.0],
),
borderRadius: BorderRadius.circular(24),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.3), color: const Color(0xFF4EC9F5).withOpacity(0.4),
blurRadius: 30,
offset: const Offset(0, 10),
spreadRadius: 2,
),
BoxShadow(
color: const Color(0xFFFFB733).withOpacity(0.3),
blurRadius: 20, blurRadius: 20,
offset: const Offset(0, 5), offset: const Offset(0, 5),
), ),
@@ -101,38 +116,59 @@ class _DashboardPageState extends State<DashboardPage>
child: Row( child: Row(
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2), color: Colors.white.withOpacity(0.25),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withOpacity(0.4),
width: 2,
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 15,
offset: const Offset(0, 5),
),
],
), ),
child: const Icon( child: const Icon(
Icons.dashboard, Icons.dashboard_rounded,
size: 32, size: 40,
color: Colors.white, color: Colors.white,
), ),
), ),
const Gap(16), const Gap(24),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Dashboard MDF/IDF', 'Dashboard Premium',
style: AppTheme.of(context).title1.override( style: AppTheme.of(context).title1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Colors.white, color: Colors.white,
fontSize: 24, fontSize: 32,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: 0.5,
), ),
), ),
const Gap(4), const Gap(8),
Text( Container(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.25),
borderRadius: BorderRadius.circular(12),
),
child: Text(
'Panel de control de contenido multimedia', 'Panel de control de contenido multimedia',
style: AppTheme.of(context).bodyText1.override( style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Colors.white.withOpacity(0.9), color: Colors.white,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500,
),
), ),
), ),
], ],
@@ -220,21 +256,58 @@ class _DashboardPageState extends State<DashboardPage>
Widget _buildStatCard( Widget _buildStatCard(
String title, String value, IconData icon, Color color) { String title, String value, IconData icon, Color color) {
return Container( return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppTheme.of(context).secondaryBackground, gradient: LinearGradient(
borderRadius: BorderRadius.circular(12), begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppTheme.of(context).secondaryBackground,
AppTheme.of(context).tertiaryBackground,
],
),
borderRadius: BorderRadius.circular(20),
border: Border.all( border: Border.all(
color: color.withOpacity(0.3), color: color.withOpacity(0.3),
width: 2,
), ),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: color.withOpacity(0.1), color: color.withOpacity(0.2),
blurRadius: 20,
offset: const Offset(0, 8),
spreadRadius: 0,
),
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10, blurRadius: 10,
offset: const Offset(0, 4), offset: const Offset(0, 4),
), ),
], ],
), ),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Stack(
children: [
// Efecto de brillo sutil en la esquina
Positioned(
top: -50,
right: -50,
child: Container(
width: 150,
height: 150,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
color.withOpacity(0.15),
color.withOpacity(0.0),
],
),
),
),
),
Padding(
padding: const EdgeInsets.all(24),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -242,42 +315,97 @@ class _DashboardPageState extends State<DashboardPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.1), gradient: LinearGradient(
borderRadius: BorderRadius.circular(8), colors: [
color.withOpacity(0.2),
color.withOpacity(0.1),
],
),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: color.withOpacity(0.3),
width: 2,
),
boxShadow: [
BoxShadow(
color: color.withOpacity(0.3),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
), ),
child: Icon( child: Icon(
icon, icon,
color: color, color: color,
size: 24, size: 28,
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: color.withOpacity(0.15),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: color.withOpacity(0.3),
),
),
child: Icon(
Icons.trending_up_rounded,
color: color,
size: 16,
), ),
), ),
], ],
), ),
const Gap(16), const Gap(24),
Text( Text(
value, value,
style: AppTheme.of(context).title1.override( style: AppTheme.of(context).title1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText, color: AppTheme.of(context).primaryText,
fontSize: 28, fontSize: 36,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: -0.5,
), ),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const Gap(4), const Gap(8),
Text( Row(
children: [
Container(
width: 4,
height: 16,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(2),
),
),
const Gap(8),
Expanded(
child: Text(
title, title,
style: AppTheme.of(context).bodyText2.override( style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).secondaryText, color: AppTheme.of(context).secondaryText,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600,
),
), ),
), ),
], ],
), ),
],
),
),
],
),
),
); );
} }
@@ -285,39 +413,91 @@ class _DashboardPageState extends State<DashboardPage>
final categoriesMap = stats['videos_by_category'] as Map<String, dynamic>?; final categoriesMap = stats['videos_by_category'] as Map<String, dynamic>?;
return Container( return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppTheme.of(context).secondaryBackground, gradient: LinearGradient(
borderRadius: BorderRadius.circular(16), begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppTheme.of(context).secondaryBackground,
AppTheme.of(context).tertiaryBackground,
],
),
borderRadius: BorderRadius.circular(24),
border: Border.all( border: Border.all(
color: AppTheme.of(context).primaryColor.withOpacity(0.2), color: AppTheme.of(context).primaryColor.withOpacity(0.2),
width: 2,
), ),
boxShadow: [
BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, 8),
), ),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: Padding(
padding: const EdgeInsets.all(28),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Icon( Container(
Icons.pie_chart, padding: const EdgeInsets.all(12),
color: AppTheme.of(context).primaryColor, decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).primaryColor.withOpacity(0.2),
AppTheme.of(context).primaryColor.withOpacity(0.1),
],
), ),
const Gap(8), borderRadius: BorderRadius.circular(12),
border: Border.all(
color:
AppTheme.of(context).primaryColor.withOpacity(0.3),
),
),
child: Icon(
Icons.pie_chart_rounded,
color: AppTheme.of(context).primaryColor,
size: 24,
),
),
const Gap(16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text( Text(
'Distribución por Categoría', 'Distribución por Categoría',
style: AppTheme.of(context).title3.override( style: AppTheme.of(context).title3.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText, color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const Gap(4),
Text(
'Videos organizados por categoría',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
), ),
), ),
], ],
), ),
const Gap(20), ),
],
),
const Gap(24),
if (categoriesMap != null && categoriesMap.isNotEmpty) if (categoriesMap != null && categoriesMap.isNotEmpty)
...categoriesMap.entries.map( ...categoriesMap.entries.map(
(entry) => Padding( (entry) => Padding(
padding: const EdgeInsets.only(bottom: 12), padding: const EdgeInsets.only(bottom: 16),
child: _buildCategoryBar( child: _buildCategoryBar(
entry.key, entry.key,
entry.value, entry.value,
@@ -329,106 +509,238 @@ class _DashboardPageState extends State<DashboardPage>
Center( Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(40), padding: const EdgeInsets.all(40),
child: Text( child: Column(
children: [
Icon(
Icons.category_outlined,
size: 64,
color: AppTheme.of(context).tertiaryText,
),
const Gap(16),
Text(
'No hay datos de categorías', 'No hay datos de categorías',
style: AppTheme.of(context).bodyText2.override( style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText, color: AppTheme.of(context).tertiaryText,
), ),
), ),
],
),
), ),
), ),
], ],
), ),
),
),
); );
} }
Widget _buildCategoryBar(String category, int count, int maxCount) { Widget _buildCategoryBar(String category, int count, int maxCount) {
final percentage = maxCount > 0 ? count / maxCount : 0.0; final percentage = maxCount > 0 ? count / maxCount : 0.0;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
category,
style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
),
),
Text(
count.toString(),
style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryColor,
fontWeight: FontWeight.bold,
),
),
],
),
const Gap(8),
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: percentage,
backgroundColor: AppTheme.of(context).tertiaryBackground,
valueColor: AlwaysStoppedAnimation<Color>(
AppTheme.of(context).primaryColor,
),
minHeight: 8,
),
),
],
);
}
Widget _buildRecentActivity() {
return Container( return Container(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppTheme.of(context).secondaryBackground, color: AppTheme.of(context).primaryBackground.withOpacity(0.5),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(12),
border: Border.all( border: Border.all(
color: AppTheme.of(context).primaryColor.withOpacity(0.2), color: AppTheme.of(context).primaryColor.withOpacity(0.1),
), ),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Icon( Expanded(
Icons.access_time, child: Text(
color: AppTheme.of(context).primaryColor, category,
style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.w600,
), ),
const Gap(8), ),
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).primaryColor,
AppTheme.of(context).secondaryColor,
],
),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Text(
count.toString(),
style: const TextStyle(
fontFamily: 'Poppins',
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 13,
),
),
),
],
),
const Gap(12),
Stack(
children: [
Container(
height: 10,
decoration: BoxDecoration(
color: AppTheme.of(context).tertiaryBackground,
borderRadius: BorderRadius.circular(5),
),
),
FractionallySizedBox(
widthFactor: percentage,
child: Container(
height: 10,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).primaryColor,
AppTheme.of(context).secondaryColor,
],
),
borderRadius: BorderRadius.circular(5),
boxShadow: [
BoxShadow(
color:
AppTheme.of(context).primaryColor.withOpacity(0.5),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
),
),
],
),
],
),
);
}
Widget _buildRecentActivity() {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppTheme.of(context).secondaryBackground,
AppTheme.of(context).tertiaryBackground,
],
),
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: AppTheme.of(context).primaryColor.withOpacity(0.2),
width: 2,
),
boxShadow: [
BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.1),
blurRadius: 20,
offset: const Offset(0, 8),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: Padding(
padding: const EdgeInsets.all(28),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).secondaryColor.withOpacity(0.2),
AppTheme.of(context).secondaryColor.withOpacity(0.1),
],
),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppTheme.of(context)
.secondaryColor
.withOpacity(0.3),
),
),
child: Icon(
Icons.history_rounded,
color: AppTheme.of(context).secondaryColor,
size: 24,
),
),
const Gap(16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text( Text(
'Actividad Reciente', 'Actividad Reciente',
style: AppTheme.of(context).title3.override( style: AppTheme.of(context).title3.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText, color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const Gap(4),
Text(
'Últimos videos subidos',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
), ),
), ),
], ],
), ),
const Gap(20), ),
],
),
const Gap(24),
Consumer<VideosProvider>( Consumer<VideosProvider>(
builder: (context, provider, child) { builder: (context, provider, child) {
if (provider.mediaFiles.isEmpty) { if (provider.mediaFiles.isEmpty) {
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(40), padding: const EdgeInsets.all(40),
child: Text( child: Column(
children: [
Icon(
Icons.video_library_outlined,
size: 64,
color: AppTheme.of(context).tertiaryText,
),
const Gap(16),
Text(
'No hay actividad reciente', 'No hay actividad reciente',
style: AppTheme.of(context).bodyText2.override( style: AppTheme.of(context).bodyText1.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText, color: AppTheme.of(context).tertiaryText,
), ),
), ),
],
),
), ),
); );
} }
@@ -437,71 +749,140 @@ class _DashboardPageState extends State<DashboardPage>
return Column( return Column(
children: recentVideos.map((video) { children: recentVideos.map((video) {
return Padding( return Container(
padding: const EdgeInsets.only(bottom: 16), margin: const EdgeInsets.only(bottom: 12),
child: Row( padding: const EdgeInsets.all(16),
children: [
Container(
width: 48,
height: 48,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppTheme.of(context)
.primaryBackground
.withOpacity(0.5),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: AppTheme.of(context) color: AppTheme.of(context)
.primaryColor .primaryColor
.withOpacity(0.1), .withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
Icons.video_library,
color: AppTheme.of(context).primaryColor,
), ),
), ),
const Gap(12), child: Row(
children: [
Container(
width: 56,
height: 56,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).primaryColor,
AppTheme.of(context).secondaryColor,
],
),
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.play_arrow_rounded,
color: Colors.white,
size: 28,
),
),
const Gap(16),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
video.title ?? video.fileName, video.title ?? video.fileName,
style: AppTheme.of(context).bodyText1.override( style: AppTheme.of(context)
.bodyText1
.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText, color:
AppTheme.of(context).primaryText,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14,
), ),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const Gap(6),
Row(
children: [
Icon(
Icons.access_time_rounded,
size: 14,
color:
AppTheme.of(context).tertiaryText,
),
const Gap(4), const Gap(4),
Text( Text(
'Hace ${_getTimeAgo(video.createdAt)}', 'Hace ${_getTimeAgo(video.createdAt)}',
style: AppTheme.of(context).bodyText2.override( style: AppTheme.of(context)
.bodyText2
.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText, color: AppTheme.of(context)
.tertiaryText,
fontSize: 12, fontSize: 12,
), ),
), ),
], ],
), ),
],
), ),
),
const Gap(12),
Container( Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 12, horizontal: 12,
vertical: 6, vertical: 8,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppTheme.of(context) gradient: LinearGradient(
.secondaryColor colors: [
.withOpacity(0.1), AppTheme.of(context).success,
borderRadius: BorderRadius.circular(12), AppTheme.of(context)
.success
.withOpacity(0.8),
],
), ),
child: Text( borderRadius: BorderRadius.circular(10),
'${video.reproducciones} views', boxShadow: [
style: AppTheme.of(context).bodyText2.override( BoxShadow(
color: AppTheme.of(context)
.success
.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.visibility_rounded,
color: Colors.white,
size: 14,
),
const Gap(6),
Text(
'${video.reproducciones}',
style: const TextStyle(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).secondaryColor, color: Colors.white,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
],
),
), ),
], ],
), ),
@@ -512,6 +893,8 @@ class _DashboardPageState extends State<DashboardPage>
), ),
], ],
), ),
),
),
); );
} }

View File

@@ -155,6 +155,66 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
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: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF4EC9F5),
Color(0xFFFFB733),
],
),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: const Color(0xFF4EC9F5).withOpacity(0.4),
blurRadius: 12,
offset: const Offset(0, 4),
),
],
),
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,
),
),
],
),
),
),
),
),
)
else
// Vista desktop: diseño original con icono, texto y botón
Row( Row(
children: [ children: [
Container( Container(
@@ -169,7 +229,8 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppTheme.of(context).primaryColor.withOpacity(0.3), color:
AppTheme.of(context).primaryColor.withOpacity(0.3),
blurRadius: 8, blurRadius: 8,
offset: const Offset(0, 2), offset: const Offset(0, 2),
), ),
@@ -195,7 +256,6 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
fontSize: 22, fontSize: 22,
), ),
), ),
if (!isMobile) ...[
const Gap(4), const Gap(4),
Text( Text(
'${provider.mediaFiles.length} videos disponibles', '${provider.mediaFiles.length} videos disponibles',
@@ -206,14 +266,12 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
), ),
), ),
], ],
],
), ),
), ),
PremiumButton( PremiumButton(
text: isMobile ? 'Subir' : 'Subir Video', text: 'Subir Video',
icon: Icons.cloud_upload, icon: Icons.cloud_upload,
onPressed: () => _showUploadDialog(provider), onPressed: () => _showUploadDialog(provider),
width: isMobile ? 100 : null,
), ),
], ],
), ),
@@ -607,141 +665,320 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
} }
Widget _buildVideoCard(MediaFileModel video, VideosProvider provider) { Widget _buildVideoCard(MediaFileModel video, VideosProvider provider) {
return Card( return Container(
margin: const EdgeInsets.only(bottom: 16), margin: const EdgeInsets.only(bottom: 20),
color: AppTheme.of(context).secondaryBackground, decoration: BoxDecoration(
shape: RoundedRectangleBorder( gradient: LinearGradient(
borderRadius: BorderRadius.circular(12), begin: Alignment.topLeft,
side: BorderSide( end: Alignment.bottomRight,
colors: [
AppTheme.of(context).secondaryBackground,
AppTheme.of(context).tertiaryBackground,
],
),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: AppTheme.of(context).primaryColor.withOpacity(0.2), 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,
), ),
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Mostrar poster si existe, sino mostrar placeholder // Thumbnail con overlay premium
ClipRRect( Stack(
borderRadius: const BorderRadius.only( children: [
topLeft: Radius.circular(12), AspectRatio(
topRight: Radius.circular(12),
),
child: AspectRatio(
aspectRatio: 16 / 9, aspectRatio: 16 / 9,
child: video.posterUrl != null && video.posterUrl!.isNotEmpty child: video.posterUrl != null && video.posterUrl!.isNotEmpty
? Image.network( ? Image.network(
video.posterUrl!, video.posterUrl!,
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container( errorBuilder: (context, error, stackTrace) =>
color: AppTheme.of(context).tertiaryBackground, Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).tertiaryBackground,
AppTheme.of(context).primaryBackground,
],
),
),
child: Icon( child: Icon(
Icons.video_library, Icons.video_library_rounded,
size: 64, size: 80,
color: AppTheme.of(context).tertiaryText, color: AppTheme.of(context).tertiaryText,
), ),
), ),
) )
: Container( : Container(
color: AppTheme.of(context).tertiaryBackground, decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppTheme.of(context).tertiaryBackground,
AppTheme.of(context).primaryBackground,
],
),
),
child: Icon( child: Icon(
Icons.video_library, Icons.video_library_rounded,
size: 64, size: 80,
color: AppTheme.of(context).tertiaryText, 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],
), ),
),
),
),
// 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,
),
),
),
),
),
),
// 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,
),
),
],
),
),
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(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Título
Text( Text(
video.title ?? video.fileName, video.title ?? video.fileName,
style: AppTheme.of(context).title3.override( style: AppTheme.of(context).title3.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).primaryText, color: AppTheme.of(context).primaryText,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18,
letterSpacing: 0.3,
), ),
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const Gap(8), const Gap(12),
// Descripción
if (video.fileDescription != null && if (video.fileDescription != null &&
video.fileDescription!.isNotEmpty) video.fileDescription!.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 8), padding: const EdgeInsets.only(bottom: 16),
child: Text( child: Text(
video.fileDescription!, video.fileDescription!,
style: AppTheme.of(context).bodyText2.override( style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: AppTheme.of(context).secondaryText, color: AppTheme.of(context).secondaryText,
fontSize: 14,
lineHeight: 1.5,
), ),
maxLines: 2, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
Row( // Tags si existen
children: [ if (video.tags.isNotEmpty)
Icon( Padding(
Icons.play_circle_filled, padding: const EdgeInsets.only(bottom: 16),
size: 16, child: Wrap(
color: AppTheme.of(context).tertiaryText, spacing: 8,
runSpacing: 8,
children: video.tags.take(4).map((tag) {
return Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
), ),
const Gap(4), decoration: BoxDecoration(
Text( color: AppTheme.of(context)
'${video.reproducciones} reproducciones', .primaryColor
style: AppTheme.of(context).bodyText2.override( .withOpacity(0.1),
fontFamily: 'Poppins', borderRadius: BorderRadius.circular(8),
color: AppTheme.of(context).tertiaryText, border: Border.all(
fontSize: 12, color: AppTheme.of(context)
.primaryColor
.withOpacity(0.3),
), ),
), ),
if (video.durationSeconds != null) ...[ child: Text(
const Gap(12), tag,
Icon( style: TextStyle(
Icons.access_time, color: AppTheme.of(context).primaryColor,
size: 16, fontSize: 11,
color: AppTheme.of(context).tertiaryText, fontWeight: FontWeight.w600,
),
const Gap(4),
Text(
_formatDuration(video.durationSeconds!),
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
), ),
), ),
], );
}).toList(),
),
),
// Divisor
Container(
height: 1,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.transparent,
AppTheme.of(context).primaryColor.withOpacity(0.2),
Colors.transparent,
], ],
), ),
const Gap(12), ),
),
const Gap(16),
// Botones de acción premium
Row( Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
TextButton.icon( Expanded(
onPressed: () => _playVideo(video), child: _buildMobilePremiumButton(
icon: const Icon(Icons.play_circle_outline, size: 18), icon: Icons.edit_rounded,
label: const Text('Reproducir'), label: 'Editar',
style: TextButton.styleFrom( color: AppTheme.of(context).secondaryColor,
foregroundColor: const Color(0xFF4EC9F5),
),
),
TextButton.icon(
onPressed: () => _editVideoDialog(video, provider), onPressed: () => _editVideoDialog(video, provider),
icon: const Icon(Icons.edit, size: 18),
label: const Text('Editar'),
style: TextButton.styleFrom(
foregroundColor: const Color(0xFFFFB733),
), ),
), ),
TextButton.icon( const Gap(12),
_buildMobileIconButton(
icon: Icons.delete_rounded,
color: AppTheme.of(context).error,
onPressed: () => _deleteVideoDialog(video, provider), onPressed: () => _deleteVideoDialog(video, provider),
icon: const Icon(Icons.delete, size: 18),
label: const Text('Eliminar'),
style: TextButton.styleFrom(
foregroundColor: const Color(0xFFFF2D2D),
),
), ),
], ],
), ),
@@ -750,6 +987,86 @@ class _GestorVideosPageState extends State<GestorVideosPage> {
), ),
], ],
), ),
),
);
}
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),
),
),
); );
} }