modificacion de colores en el login

This commit is contained in:
Abraham
2026-01-13 15:44:45 -08:00
parent 9533b60906
commit 7bdb9a2d74
6 changed files with 236 additions and 32 deletions

View File

@@ -42,6 +42,7 @@ class _EditVideoDialogState extends State<EditVideoDialog> {
late TextEditingController tagsController;
Uint8List? newPosterBytes;
String? newPosterFileName;
bool _deletePoster = false;
VideoPlayerController? _videoPlayerController;
ChewieController? _chewieController;
bool _isVideoLoading = false;
@@ -162,8 +163,12 @@ class _EditVideoDialogState extends State<EditVideoDialog> {
);
}
// Actualizar portada si se seleccionó una nueva
if (newPosterBytes != null && newPosterFileName != null) {
// Eliminar portada si se solicitó
if (_deletePoster) {
await widget.provider.deletePoster(widget.video.mediaFileId);
}
// Actualizar portada si se seleccionó una nueva (solo si no se eliminó)
else if (newPosterBytes != null && newPosterFileName != null) {
await widget.provider.updateVideoPoster(
widget.video.mediaFileId,
newPosterBytes!,
@@ -437,10 +442,100 @@ class _EditVideoDialogState extends State<EditVideoDialog> {
}
Widget _buildPosterSection() {
final hasPoster = widget.video.posterUrl != null && !_deletePoster;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.video.posterUrl != null)
if (_deletePoster)
Container(
height: 140,
width: double.infinity,
decoration: BoxDecoration(
color: AppTheme.of(context).tertiaryBackground,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: const Color(0xFFFF2D2D).withOpacity(0.3),
width: 2,
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.delete_outline,
size: 48,
color: const Color(0xFFFF2D2D).withOpacity(0.7),
),
const Gap(8),
Text(
'Portada marcada para eliminar',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: const Color(0xFFFF2D2D),
fontSize: 12,
),
),
],
),
),
)
else if (newPosterBytes != null)
// Mostrar preview de nueva portada seleccionada
Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.memory(
newPosterBytes!,
height: 140,
width: double.infinity,
fit: BoxFit.cover,
),
),
Positioned(
top: 8,
right: 8,
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: AppTheme.of(context).success,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.fiber_new,
size: 14,
color: Colors.white,
),
const Gap(4),
Text(
'Nueva',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: Colors.white,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
],
),
),
),
],
)
else if (hasPoster)
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.network(
@@ -458,30 +553,89 @@ class _EditVideoDialogState extends State<EditVideoDialog> {
color: AppTheme.of(context).tertiaryBackground,
borderRadius: BorderRadius.circular(12),
),
child: Icon(
Icons.image,
size: 48,
color: AppTheme.of(context).tertiaryText,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.video_library,
size: 48,
color: AppTheme.of(context).tertiaryText,
),
const Gap(8),
Text(
'Sin portada',
style: AppTheme.of(context).bodyText2.override(
fontFamily: 'Poppins',
color: AppTheme.of(context).tertiaryText,
fontSize: 12,
),
),
],
),
),
const Gap(12),
ElevatedButton.icon(
onPressed: _selectPoster,
icon: const Icon(Icons.image, size: 18),
label: Text(
newPosterBytes != null ? 'Portada Seleccionada' : 'Cambiar Portada',
),
style: ElevatedButton.styleFrom(
backgroundColor: newPosterBytes != null
? AppTheme.of(context).success
: AppTheme.of(context).primaryColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
Row(
children: [
Expanded(
child: ElevatedButton.icon(
onPressed: _deletePoster ? null : _selectPoster,
icon: const Icon(Icons.image, size: 18),
label: Text(
newPosterBytes != null
? 'Portada Seleccionada'
: 'Cambiar Portada',
),
style: ElevatedButton.styleFrom(
backgroundColor: newPosterBytes != null
? AppTheme.of(context).success
: AppTheme.of(context).primaryColor,
foregroundColor: Colors.white,
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
elevation: 0,
disabledBackgroundColor:
AppTheme.of(context).tertiaryText.withOpacity(0.3),
),
),
),
elevation: 0,
),
if (hasPoster || _deletePoster) ...[
const Gap(8),
ElevatedButton.icon(
onPressed: () {
setState(() {
_deletePoster = !_deletePoster;
if (_deletePoster) {
// Si se marca para eliminar, limpiar nueva portada seleccionada
newPosterBytes = null;
newPosterFileName = null;
}
});
},
icon: Icon(
_deletePoster ? Icons.undo : Icons.delete_outline,
size: 18,
),
label: Text(
_deletePoster ? 'Deshacer' : 'Eliminar',
),
style: ElevatedButton.styleFrom(
backgroundColor: _deletePoster
? AppTheme.of(context).warning
: const Color(0xFFFF2D2D),
foregroundColor: Colors.white,
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
elevation: 0,
),
),
],
],
),
if (newPosterBytes != null) ...[
const Gap(8),