Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rafa Castillo Passols
/
Prototipo-Multimedia
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
744ee85f
authored
May 28, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Arreglos menores en toda la aplicación
parent
1be68f5d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
22 deletions
lib/modelo/enlace.dart
lib/modelo/lista_seleccionables.dart
lib/paginas/pagina_ajustes.dart
lib/paginas/pagina_conversion.dart
lib/paginas/pagina_principal.dart
lib/widgets/action_button.dart
lib/widgets/convertex_fab_bar.dart
pubspec.lock
lib/modelo/enlace.dart
View file @
744ee85f
...
@@ -7,15 +7,22 @@ import 'package:path_provider/path_provider.dart';
...
@@ -7,15 +7,22 @@ import 'package:path_provider/path_provider.dart';
import
'package:uuid/uuid.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
//
TODO: QUE PASA SI NO RECONOCEMOS EL FORMATO?
//
/ Clase que representa un enlace a un archivo alojado en la web
class
Enlace
extends
Convertible
{
class
Enlace
extends
Convertible
{
/// URL al archivo en cuestión
final
String
_url
;
final
String
_url
;
/// Archivo que se descargadrá y que contiene el archivo a convertir
late
final
Future
<
File
>
_file
;
late
final
Future
<
File
>
_file
;
/// Si el archivo se está descargando
bool
_descargado
=
false
;
bool
_descargado
=
false
;
/// Nombre del archivo
String
?
_nombreArchivo
;
String
?
_nombreArchivo
;
/// Devuelve la URL al archivo en cuestión
String
get
url
=>
_url
;
String
get
url
=>
_url
;
/// Devuelve el nombre del archivo
String
?
get
nombreArchivo
=>
_nombreArchivo
;
String
?
get
nombreArchivo
=>
_nombreArchivo
;
/// Devuelve si el archivo se está descargando
bool
get
descargado
=>
_descargado
;
bool
get
descargado
=>
_descargado
;
...
@@ -24,13 +31,14 @@ class Enlace extends Convertible {
...
@@ -24,13 +31,14 @@ class Enlace extends Convertible {
nombre:
direccion
.
length
<
33
nombre:
direccion
.
length
<
33
?
direccion
?
direccion
:
"
${direccion.substring(0, 33)}
..."
,
:
"
${direccion.substring(0, 33)}
..."
,
formatoOriginal:
Formato
.
fromExtension
(
'jpg'
)!,
formatoOriginal:
Formato
.
fromExtension
(
direccion
.
split
(
'.'
).
last
)!,
icon:
const
Icon
(
Icons
.
link
)
icon:
const
Icon
(
Icons
.
link
)
)
)
{
{
_file
=
_descargar
(
_url
);
_file
=
_descargar
(
_url
);
}
}
/// Función para descargar el archivo desde internet
Future
<
File
>
_descargar
(
String
direccion
)
async
{
Future
<
File
>
_descargar
(
String
direccion
)
async
{
// Descargamos los datos
// Descargamos los datos
final
dio
=
Dio
();
final
dio
=
Dio
();
...
@@ -69,6 +77,7 @@ class Enlace extends Convertible {
...
@@ -69,6 +77,7 @@ class Enlace extends Convertible {
return
file
;
return
file
;
}
}
/// Convierte este enlace al formato deseado
@override
@override
Future
<
ReturnCode
?>
convertir
(
String
pathSalida
)
async
{
Future
<
ReturnCode
?>
convertir
(
String
pathSalida
)
async
{
// Eliminamos el archivo temporal después de la conversión
// Eliminamos el archivo temporal después de la conversión
...
...
lib/modelo/lista_seleccionables.dart
View file @
744ee85f
...
@@ -67,12 +67,15 @@ class ListaSeleccionables extends ChangeNotifier {
...
@@ -67,12 +67,15 @@ class ListaSeleccionables extends ChangeNotifier {
/// Agrega un enlace (archivo para descargar) a ala lista
/// Agrega un enlace (archivo para descargar) a ala lista
bool
addEnlace
(
String
url
)
{
bool
addEnlace
(
String
url
)
{
_seleccionables
.
add
(
Enlace
(
if
(
Formato
.
fromExtension
(
url
.
split
(
'.'
).
last
)
!=
null
){
id:
const
Uuid
().
v1
(),
_seleccionables
.
add
(
Enlace
(
direccion:
url
id:
const
Uuid
().
v1
(),
));
direccion:
url
notifyListeners
();
));
return
true
;
notifyListeners
();
return
true
;
}
return
false
;
}
}
/// Reinserta un elemento anteriormente eliminado de la lista
/// Reinserta un elemento anteriormente eliminado de la lista
...
...
lib/paginas/pagina_ajustes.dart
View file @
744ee85f
...
@@ -144,7 +144,7 @@ class _PaginaAjustesState extends State<PaginaAjustes> {
...
@@ -144,7 +144,7 @@ class _PaginaAjustesState extends State<PaginaAjustes> {
Column
(
Column
(
children:
[
children:
[
Text
(
Text
(
"Con
v
ertex"
,
"Con
V
ertex"
,
style:
textTheme
.
titleLarge
,
style:
textTheme
.
titleLarge
,
),
),
const
SizedBox
(
height:
16.0
,),
const
SizedBox
(
height:
16.0
,),
...
...
lib/paginas/pagina_conversion.dart
View file @
744ee85f
...
@@ -64,8 +64,6 @@ class _PaginaConversionState extends State<PaginaConversion>
...
@@ -64,8 +64,6 @@ class _PaginaConversionState extends State<PaginaConversion>
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
// TODO: HECHO PARA QUE NO PETE PERO HABRÁ QUE REVISAR.
// PONER UN SCAFOLD Y FACOTIRZAR
return
Material
(
return
Material
(
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
...
@@ -86,8 +84,6 @@ class _PaginaConversionState extends State<PaginaConversion>
...
@@ -86,8 +84,6 @@ class _PaginaConversionState extends State<PaginaConversion>
_createFormatBox
(
false
)
_createFormatBox
(
false
)
],
],
),
),
const
SizedBox
(
height:
20.0
),
_createCalidadSelectionPanel
()
],
],
),
),
),
),
...
...
lib/paginas/pagina_principal.dart
View file @
744ee85f
...
@@ -23,7 +23,7 @@ class PaginaPrincipal extends StatelessWidget {
...
@@ -23,7 +23,7 @@ class PaginaPrincipal extends StatelessWidget {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
title:
Text
(
'Con
vertex Prototipo
'
,
'Con
Vertex
'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
?.
copyWith
(
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
?.
copyWith
(
color:
Colors
.
white
color:
Colors
.
white
),
),
...
...
lib/widgets/action_button.dart
View file @
744ee85f
...
@@ -126,7 +126,16 @@ class ActionButton extends StatelessWidget {
...
@@ -126,7 +126,16 @@ class ActionButton extends StatelessWidget {
});
});
if
(
url
!=
null
)
{
if
(
url
!=
null
)
{
manager
.
addEnlace
(
url
);
bool
added
=
manager
.
addEnlace
(
url
);
if
(!
added
)
{
_mostrarSnackBar
(
context
,
'El archivo del enlace seleccionado no es de un formato multimedia conocido'
);
return
;
}
if
(
onSuccess
!=
null
&&
context
.
mounted
)
{
onSuccess
!();
}
}
}
}
}
...
@@ -177,7 +186,7 @@ class ActionButton extends StatelessWidget {
...
@@ -177,7 +186,7 @@ class ActionButton extends StatelessWidget {
_actualizadorProgreso
();
_actualizadorProgreso
();
final
now
=
DateTime
.
now
();
final
now
=
DateTime
.
now
();
final
nombreZip
=
"Con
v
ertex_"
final
nombreZip
=
"Con
V
ertex_"
"
${now.day}
-
${now.month}
-
${now.year}
_"
"
${now.day}
-
${now.month}
-
${now.year}
_"
"
${now.hour}
-
${now.minute}
-
${now.second}
"
;
"
${now.hour}
-
${now.minute}
-
${now.second}
"
;
final
zipFileEncoder
=
ZipFileEncoder
();
final
zipFileEncoder
=
ZipFileEncoder
();
...
...
lib/widgets/convertex_fab_bar.dart
View file @
744ee85f
...
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
...
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/provider_ajustes.dart'
;
import
'package:prueba_multimedia/modelo/provider_ajustes.dart'
;
import
'package:prueba_multimedia/paginas/pagina_configuracion.dart'
;
import
'package:prueba_multimedia/paginas/pagina_configuracion_carpeta.dart'
;
import
'package:prueba_multimedia/widgets/widgets.dart'
;
import
'package:prueba_multimedia/widgets/widgets.dart'
;
class
ConVertexFabBar
extends
StatefulWidget
{
class
ConVertexFabBar
extends
StatefulWidget
{
...
@@ -39,8 +41,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
...
@@ -39,8 +41,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
static
const
convertirButtonTypes
=
<
ActionButtonTypes
>[
static
const
convertirButtonTypes
=
<
ActionButtonTypes
>[
ActionButtonTypes
.
copiar
,
ActionButtonTypes
.
copiar
,
ActionButtonTypes
.
comprimir
,
ActionButtonTypes
.
comprimir
ActionButtonTypes
.
reemplazar
];
];
@override
@override
...
@@ -187,7 +188,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
...
@@ -187,7 +188,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
List
<
Widget
>
_loadAgregarActionButtons
(
BuildContext
context
,
List
<
Widget
>
_loadAgregarActionButtons
(
BuildContext
context
,
ListaSeleccionables
manager
)
ListaSeleccionables
manager
)
{
{
final
VoidCallback
closeButtons
=
()
{
accionesFinal
()
{
setState
(()
{
setState
(()
{
_convertirOpen
=
false
;
_convertirOpen
=
false
;
_agregarOpen
=
false
;
_agregarOpen
=
false
;
...
@@ -196,14 +197,35 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
...
@@ -196,14 +197,35 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
_convertirKey
.
currentState
?.
close
();
_convertirKey
.
currentState
?.
close
();
}
}
_agregarKey
.
currentState
?.
close
();
_agregarKey
.
currentState
?.
close
();
};
final
manager2
=
Provider
.
of
<
ListaSeleccionables
>(
context
,
listen:
false
);
int
ix
=
manager2
.
seleccionables
.
length
-
1
;
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
if
(
manager2
.
seleccionables
[
ix
]
is
Carpeta
){
return
PaginaConfiguracionCarpeta
(
lista:
manager2
,
indice:
ix
,
carpeta:
manager2
.
seleccionables
[
ix
]
as
Carpeta
);
}
return
PaginaConfiguracion
(
lista:
manager2
,
indice:
ix
,
elemento:
manager2
.
seleccionables
[
ix
]
as
Convertible
);
}
)
);
}
return
agregarButtonTypes
.
map
(
(
type
)
{
return
agregarButtonTypes
.
map
(
(
type
)
{
return
ActionButton
(
return
ActionButton
(
tipoBoton:
type
,
tipoBoton:
type
,
manager:
manager
,
manager:
manager
,
context:
context
,
context:
context
,
onSuccess:
closeButtons
,
onSuccess:
accionesFinal
,
disabled:
false
,
disabled:
false
,
providerAjustes:
widget
.
providerAjustes
,
providerAjustes:
widget
.
providerAjustes
,
);
);
...
@@ -255,7 +277,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
...
@@ -255,7 +277,7 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
listenerActualizar
(
manager
);
listenerActualizar
(
manager
);
final
now
=
DateTime
.
now
();
final
now
=
DateTime
.
now
();
final
nombreZip
=
"Con
v
ertex_"
final
nombreZip
=
"Con
V
ertex_"
"
${now.day}
-
${now.month}
-
${now.year}
_"
"
${now.day}
-
${now.month}
-
${now.year}
_"
"
${now.hour}
-
${now.minute}
-
${now.second}
"
;
"
${now.hour}
-
${now.minute}
-
${now.second}
"
;
final
zipFileEncoder
=
ZipFileEncoder
();
final
zipFileEncoder
=
ZipFileEncoder
();
...
...
pubspec.lock
View file @
744ee85f
...
@@ -73,6 +73,22 @@ packages:
...
@@ -73,6 +73,22 @@ packages:
url: "https://pub.dev"
url: "https://pub.dev"
source: hosted
source: hosted
version: "1.0.8"
version: "1.0.8"
dio:
dependency: "direct main"
description:
name: dio
sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9"
url: "https://pub.dev"
source: hosted
version: "5.8.0+1"
dio_web_adapter:
dependency: transitive
description:
name: dio_web_adapter
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
fake_async:
fake_async:
dependency: transitive
dependency: transitive
description:
description:
...
@@ -168,6 +184,14 @@ packages:
...
@@ -168,6 +184,14 @@ packages:
description: flutter
description: flutter
source: sdk
source: sdk
version: "0.0.0"
version: "0.0.0"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
url: "https://pub.dev"
source: hosted
version: "4.1.2"
leak_tracker:
leak_tracker:
dependency: transitive
dependency: transitive
description:
description:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment