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
70eed32d
authored
Mar 27, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Configuración de carpetas finalizada, mejoras en proceso en la lista de widgets seleccionables
parent
287ae626
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
156 additions
and
64 deletions
lib/modelo/carpeta.dart
lib/modelo/formato.dart
lib/modelo/lista_seleccionables.dart
lib/paginas/pagina_configuracion.dart
lib/paginas/pagina_configuracion_carpeta.dart
lib/paginas/pagina_conversion.dart
lib/paginas/pagina_principal_llena.dart
lib/widgets/seleccionable_widget.dart
lib/modelo/carpeta.dart
View file @
70eed32d
...
@@ -8,21 +8,23 @@ import 'formato.dart';
...
@@ -8,21 +8,23 @@ import 'formato.dart';
class
Carpeta
extends
ElementoSeleccionable
{
class
Carpeta
extends
ElementoSeleccionable
{
final
Directory
_directory
;
final
Directory
_directory
;
final
bool
_incluirSubcarpetas
=
false
;
final
bool
_incluirSubcarpetas
=
false
;
bool
_open
=
false
;
late
final
List
<
InfoFormato
>
_formatos
;
late
final
List
<
InfoFormato
>
_formatos
;
Directory
get
directory
=>
_directory
;
Directory
get
directory
=>
_directory
;
List
<
InfoFormato
>
get
formatos
=>
List
.
unmodifiable
(
_formatos
);
List
<
InfoFormato
>
get
formatos
=>
List
.
unmodifiable
(
_formatos
);
bool
get
isOpen
=>
_open
;
Carpeta
({
required
super
.
id
,
required
Directory
directory
,
required
Map
<
Formato
,
bool
>
formatos
}):
Carpeta
({
required
super
.
id
,
required
Directory
directory
,
required
Map
<
Formato
,
bool
>
formatos
}):
_directory
=
directory
,
_directory
=
directory
,
super
(
nombre:
directory
.
path
.
split
(
'/'
).
last
,
icon:
const
Icon
(
Icons
.
folder_outlined
)){
super
(
nombre:
directory
.
path
.
split
(
'/'
).
last
,
icon:
const
Icon
(
Icons
.
folder_outlined
))
{
_formatos
=
[];
_formatos
=
[];
for
(
var
f
in
formatos
.
entries
)
{
for
(
var
f
in
formatos
.
entries
)
{
_formatos
.
add
(
InfoFormato
(
_formatos
.
add
(
InfoFormato
(
formato:
f
.
key
,
formato:
f
.
key
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
subCarpeta:
f
.
value
,
subCarpeta:
f
.
value
));
archivos:
[]));
}
}
}
}
...
@@ -30,6 +32,15 @@ class Carpeta extends ElementoSeleccionable{
...
@@ -30,6 +32,15 @@ class Carpeta extends ElementoSeleccionable{
_directory
=
directory
,
_formatos
=
formatos
,
_directory
=
directory
,
_formatos
=
formatos
,
super
(
nombre:
directory
.
path
.
split
(
'/'
).
last
,
icon:
const
Icon
(
Icons
.
folder_outlined
));
super
(
nombre:
directory
.
path
.
split
(
'/'
).
last
,
icon:
const
Icon
(
Icons
.
folder_outlined
));
InfoFormato
?
getInfoFormato
({
required
Formato
formato
}){
for
(
InfoFormato
i
in
_formatos
){
if
(
i
.
formatoOriginal
==
formato
){
return
i
;
}
}
return
null
;
}
void
setFormatoDestino
(
Formato
original
,
Formato
?
destino
){
void
setFormatoDestino
(
Formato
original
,
Formato
?
destino
){
final
formatosAlt
=
formatos
.
toList
();
final
formatosAlt
=
formatos
.
toList
();
for
(
InfoFormato
i
in
formatosAlt
){
for
(
InfoFormato
i
in
formatosAlt
){
...
@@ -39,6 +50,10 @@ class Carpeta extends ElementoSeleccionable{
...
@@ -39,6 +50,10 @@ class Carpeta extends ElementoSeleccionable{
}
}
}
}
void
pressOpenClose
(){
_open
=
!
_open
;
}
@override
@override
void
convertir
()
{
void
convertir
()
{
// TODO: <implement>
// TODO: <implement>
...
@@ -49,14 +64,12 @@ class InfoFormato {
...
@@ -49,14 +64,12 @@ class InfoFormato {
final
bool
_subcarpeta
;
final
bool
_subcarpeta
;
bool
_seleccionado
;
bool
_seleccionado
;
final
Convertible
_conversion
;
final
Convertible
_conversion
;
final
List
<
File
>
_archivos
;
bool
get
subcarpeta
=>
_subcarpeta
;
bool
get
subcarpeta
=>
_subcarpeta
;
bool
get
seleccionado
=>
_seleccionado
;
bool
get
seleccionado
=>
_seleccionado
;
Convertible
get
conversion
=>
_conversion
;
Convertible
get
conversion
=>
_conversion
;
Formato
get
formatoOriginal
=>
_conversion
.
formatoOriginal
;
Formato
get
formatoOriginal
=>
_conversion
.
formatoOriginal
;
Formato
?
get
formatoDestino
=>
_conversion
.
formatoDestino
;
Formato
?
get
formatoDestino
=>
_conversion
.
formatoDestino
;
List
<
Archivo
>
get
archivos
=>
List
.
unmodifiable
(
_archivos
);
set
seleccionado
(
bool
value
)
=>
_seleccionado
=
value
;
set
seleccionado
(
bool
value
)
=>
_seleccionado
=
value
;
set
formatoDestino
(
Formato
?
destino
)
=>
_conversion
.
formatoDestino
=
destino
;
set
formatoDestino
(
Formato
?
destino
)
=>
_conversion
.
formatoDestino
=
destino
;
...
@@ -64,9 +77,8 @@ class InfoFormato {
...
@@ -64,9 +77,8 @@ class InfoFormato {
InfoFormato
({
required
Formato
formato
,
InfoFormato
({
required
Formato
formato
,
required
String
nombreCarpeta
,
required
String
nombreCarpeta
,
required
bool
subCarpeta
,
required
bool
subCarpeta
,
bool
?
seleccionado
,
bool
?
seleccionado
}):
required
List
<
File
>
archivos
}):
_subcarpeta
=
subCarpeta
,
_seleccionado
=
seleccionado
??
!
subCarpeta
,
_subcarpeta
=
subCarpeta
,
_seleccionado
=
seleccionado
??
!
subCarpeta
,
_archivos
=
archivos
,
_conversion
=
Convertible
(
id:
"null"
,
nombre:
'
$nombreCarpeta
>
${formato.name}
'
,
_conversion
=
Convertible
(
id:
"null"
,
nombre:
'
$nombreCarpeta
>
${formato.name}
'
,
icon:
Icon
(
Icons
.
find_in_page_outlined
),
formatoOriginal:
formato
);
icon:
Icon
(
Icons
.
find_in_page_outlined
),
formatoOriginal:
formato
);
...
...
lib/modelo/formato.dart
View file @
70eed32d
...
@@ -84,12 +84,13 @@ enum Formato {
...
@@ -84,12 +84,13 @@ enum Formato {
}
}
enum
TipoMultimedia
{
enum
TipoMultimedia
{
video
(
Icon
(
Icons
.
movie_creation_outlined
)),
video
(
"Vídeo"
,
Icon
(
Icons
.
movie_creation_outlined
)),
audio
(
Icon
(
Icons
.
music_note_outlined
)),
audio
(
"Audio"
,
Icon
(
Icons
.
music_note_outlined
)),
imagen
(
Icon
(
Icons
.
image_outlined
));
imagen
(
"Imagen"
,
Icon
(
Icons
.
image_outlined
));
final
String
nombre
;
final
Icon
icono
;
final
Icon
icono
;
const
TipoMultimedia
(
this
.
icono
);
const
TipoMultimedia
(
this
.
nombre
,
this
.
icono
);
}
}
enum
Clasificacion
{
enum
Clasificacion
{
...
...
lib/modelo/lista_seleccionables.dart
View file @
70eed32d
...
@@ -31,4 +31,9 @@ class ListaSeleccionables extends ChangeNotifier {
...
@@ -31,4 +31,9 @@ class ListaSeleccionables extends ChangeNotifier {
directory:
directory
,
formatos:
<
Formato
,
bool
>{
Formato
.
mp4
:
false
,
Formato
.
mp3
:
true
}));
directory:
directory
,
formatos:
<
Formato
,
bool
>{
Formato
.
mp4
:
false
,
Formato
.
mp3
:
true
}));
notifyListeners
();
notifyListeners
();
}
}
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
_seleccionables
.
insert
(
index
,
element
);
notifyListeners
();
}
}
}
\ No newline at end of file
lib/paginas/pagina_configuracion.dart
View file @
70eed32d
...
@@ -8,13 +8,16 @@ class PaginaConfiguracion extends StatefulWidget {
...
@@ -8,13 +8,16 @@ class PaginaConfiguracion extends StatefulWidget {
final
ListaSeleccionables
_lista
;
final
ListaSeleccionables
_lista
;
final
int
_indice
;
final
int
_indice
;
final
ElementoSeleccionable
_elementoAsociado
;
final
ElementoSeleccionable
_elementoAsociado
;
final
Carpeta
?
_carpeta
;
const
PaginaConfiguracion
({
const
PaginaConfiguracion
({
super
.
key
,
super
.
key
,
required
ListaSeleccionables
lista
,
required
ListaSeleccionables
lista
,
required
int
indice
,
required
int
indice
,
required
ElementoSeleccionable
elemento
required
ElementoSeleccionable
elemento
,
}):
_lista
=
lista
,
_indice
=
indice
,
_elementoAsociado
=
elemento
;
Carpeta
?
carpeta
}):
_lista
=
lista
,
_indice
=
indice
,
_elementoAsociado
=
elemento
,
_carpeta
=
carpeta
;
@override
@override
State
<
PaginaConfiguracion
>
createState
()
=>
_PaginaConfiguracionState
();
State
<
PaginaConfiguracion
>
createState
()
=>
_PaginaConfiguracionState
();
...
@@ -67,6 +70,15 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
...
@@ -67,6 +70,15 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
if
(
widget
.
_elementoAsociado
is
Convertible
){
if
(
widget
.
_elementoAsociado
is
Convertible
){
final
arch
=
widget
.
_elementoAsociado
as
Convertible
;
final
arch
=
widget
.
_elementoAsociado
as
Convertible
;
if
(
_categoriaActiva
==
0
){
if
(
_categoriaActiva
==
0
){
if
(
widget
.
_carpeta
!=
null
){
return
PaginaConversion
.
carpeta
(
lista:
manager
,
indiceArchivo:
widget
.
_indice
,
carpeta:
widget
.
_carpeta
!,
infoFormato:
widget
.
_carpeta
!.
getInfoFormato
(
formato:
arch
.
formatoOriginal
)!,
formatoOriginal:
arch
.
formatoOriginal
);
}
return
PaginaConversion
.
convertible
(
return
PaginaConversion
.
convertible
(
lista:
manager
,
lista:
manager
,
indiceArchivo:
widget
.
_indice
,
indiceArchivo:
widget
.
_indice
,
...
...
lib/paginas/pagina_configuracion_carpeta.dart
View file @
70eed32d
...
@@ -207,9 +207,10 @@ class _PaginaConfiguracionCarpetaState extends State<PaginaConfiguracionCarpeta>
...
@@ -207,9 +207,10 @@ class _PaginaConfiguracionCarpetaState extends State<PaginaConfiguracionCarpeta>
Navigator
.
push
(
context
,
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
MaterialPageRoute
(
builder:
(
context
)
{
return
PaginaConfiguracion
(
return
PaginaConfiguracion
(
indice:
widget
.
_
formatosCarpeta
.
indexOf
(
i
)
,
indice:
widget
.
_
indice
,
elemento:
i
.
conversion
,
elemento:
i
.
conversion
,
lista:
widget
.
_lista
,
lista:
widget
.
_lista
,
carpeta:
widget
.
_carpeta
);
);
}
}
));
));
...
...
lib/paginas/pagina_conversion.dart
View file @
70eed32d
...
@@ -166,6 +166,25 @@ class _PaginaConversionState extends State<PaginaConversion>
...
@@ -166,6 +166,25 @@ class _PaginaConversionState extends State<PaginaConversion>
}
}
Widget
_createTabVideos
(){
Widget
_createTabVideos
(){
final
tabs
=
<
Widget
>[];
final
grids
=
<
Widget
>[];
final
tipos
=
TipoMultimedia
.
values
;
for
(
var
element
in
tipos
)
{
if
(
widget
.
_carpeta
!=
null
&&
element
==
TipoMultimedia
.
imagen
)
continue
;
tabs
.
add
(
Tab
(
icon:
element
.
icono
,
text:
element
.
nombre
,
));
grids
.
add
(
GridView
.
count
(
crossAxisCount:
3
,
crossAxisSpacing:
12
,
mainAxisSpacing:
12
,
children:
_createGridBotonesConversion
(
tipo:
element
),
));
}
return
Material
(
return
Material
(
clipBehavior:
Clip
.
antiAlias
,
clipBehavior:
Clip
.
antiAlias
,
shape:
BeveledRectangleBorder
(
shape:
BeveledRectangleBorder
(
...
@@ -191,20 +210,7 @@ class _PaginaConversionState extends State<PaginaConversion>
...
@@ -191,20 +210,7 @@ class _PaginaConversionState extends State<PaginaConversion>
height:
68
,
height:
68
,
child:
TabBar
(
child:
TabBar
(
controller:
_tabController
,
controller:
_tabController
,
tabs:
<
Widget
>[
tabs:
tabs
Tab
(
icon:
TipoMultimedia
.
video
.
icono
,
text:
'Vídeo'
,
),
Tab
(
icon:
TipoMultimedia
.
audio
.
icono
,
text:
'Audio'
,
),
Tab
(
icon:
TipoMultimedia
.
imagen
.
icono
,
text:
'Imagen'
,
)
]
),
),
),
),
SizedBox
(
SizedBox
(
...
@@ -213,14 +219,7 @@ class _PaginaConversionState extends State<PaginaConversion>
...
@@ -213,14 +219,7 @@ class _PaginaConversionState extends State<PaginaConversion>
padding:
const
EdgeInsets
.
only
(
top:
16.0
),
padding:
const
EdgeInsets
.
only
(
top:
16.0
),
child:
TabBarView
(
child:
TabBarView
(
controller:
_tabController
,
controller:
_tabController
,
children:
TipoMultimedia
.
values
.
map
((
tipo
)
{
children:
grids
return
GridView
.
count
(
crossAxisCount:
3
,
crossAxisSpacing:
12
,
mainAxisSpacing:
12
,
children:
_createGridBotonesConversion
(
tipo:
tipo
)
);
}).
toList
()
),
),
),
),
),
),
...
...
lib/paginas/pagina_principal_llena.dart
View file @
70eed32d
...
@@ -19,7 +19,46 @@ class PaginaPrincipalLlena extends StatelessWidget {
...
@@ -19,7 +19,46 @@ class PaginaPrincipalLlena extends StatelessWidget {
return
const
SizedBox
(
height:
8.0
);
return
const
SizedBox
(
height:
8.0
);
},
},
itemBuilder:
(
context
,
index
)
{
itemBuilder:
(
context
,
index
)
{
return
SeleccionableWidget
(
indice:
index
,
seleccionable:
seleccionables
[
index
],
lista:
listaSeleccionables
);
return
Dismissible
(
key:
Key
(
seleccionables
[
index
].
id
),
background:
Container
(
color:
Colors
.
red
,
alignment:
Alignment
.
centerLeft
,
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
Icon
(
Icons
.
delete
,
color:
Colors
.
white
,
size:
31.0
),
),
),
secondaryBackground:
Container
(
color:
Colors
.
red
,
alignment:
Alignment
.
centerRight
,
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
Icon
(
Icons
.
delete
,
color:
Colors
.
white
,
size:
31.0
),
),
),
onDismissed:
(
direction
)
{
listaSeleccionables
.
borraSeleccionable
(
index
);
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'
${seleccionables[index].nombre}
borrado'
),
action:
SnackBarAction
(
label:
'Deshacer'
,
onPressed:
()
{
listaSeleccionables
.
reinsertar
(
index
,
seleccionables
[
index
]);
}
),
)
);
},
child:
SeleccionableWidget
(
indice:
index
,
seleccionable:
seleccionables
[
index
],
lista:
listaSeleccionables
)
);
},
},
),
),
);
);
...
...
lib/widgets/seleccionable_widget.dart
View file @
70eed32d
...
@@ -12,33 +12,55 @@ class SeleccionableWidget extends StatelessWidget {
...
@@ -12,33 +12,55 @@ class SeleccionableWidget extends StatelessWidget {
// TODO: ACTUALIZAR PARA MOSTRAR FORMATOS Y CAMBIOS
// TODO: ACTUALIZAR PARA MOSTRAR FORMATOS Y CAMBIOS
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
String
nombre
=
seleccionable
.
nombre
;
int
index
=
nombre
.
lastIndexOf
(
'.'
);
final
String
visible
;
if
(
index
>
-
1
){
visible
=
nombre
.
substring
(
0
,
index
);
}
else
{
visible
=
nombre
;
}
Widget
?
formatoOrig
;
if
(
seleccionable
is
Convertible
){
Convertible
arch
=
(
seleccionable
as
Convertible
);
String
texto
=
arch
.
formatoOriginal
.
name
.
toUpperCase
();
if
(
arch
.
formatoDestino
!=
null
)
texto
+=
" >
${arch.formatoDestino!.name.toUpperCase()}
"
;
formatoOrig
=
Text
(
texto
);
}
return
Row
(
return
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
seleccionable
.
icono
,
seleccionable
.
icono
,
const
SizedBox
(
width:
10
,),
const
SizedBox
(
width:
10
),
Expanded
(
Expanded
(
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Text
(
Text
(
seleccionable
.
nombre
,
visible
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
),
fontWeight:
FontWeight
.
bold
],
)
)
),
),
if
(
formatoOrig
!=
null
)
formatoOrig
if
(
seleccionable
is
Carpeta
)
],
IconButton
(
onPressed:
()
{},
icon:
Icon
(
Icons
.
menu
)),
)
IconButton
(
),
icon:
const
Icon
(
Icons
.
edit
),
if
(
seleccionable
is
Carpeta
)
onPressed:
()
{
if
((
seleccionable
as
Carpeta
).
isOpen
)
IconButton
(
onPressed:
()
{},
icon:
Icon
(
Icons
.
menu
)),
Navigator
.
push
(
context
,
IconButton
(
MaterialPageRoute
(
builder:
(
context
)
{
icon:
const
Icon
(
Icons
.
edit
),
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
seleccionable
,
lista:
lista
);
onPressed:
()
{
}));
Navigator
.
push
(
context
,
},
MaterialPageRoute
(
builder:
(
context
)
{
)
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
seleccionable
,
lista:
lista
);
],
}));
},
)
]
);
);
}
}
}
}
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