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
38e38526
authored
Apr 10, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Widgets de lista flexibilizados para evitar overflows
parent
86fb3301
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
129 deletions
lib/modelo/carpeta.dart
lib/modelo/lista_seleccionables.dart
lib/paginas/pagina_configuracion.dart
lib/widgets/carpeta_widget.dart
lib/widgets/convertex_fab_bar.dart
lib/widgets/seleccionable_widget.dart
lib/modelo/carpeta.dart
View file @
38e38526
...
@@ -17,16 +17,20 @@ class Carpeta extends ElementoSeleccionable{
...
@@ -17,16 +17,20 @@ class Carpeta extends ElementoSeleccionable{
bool
get
isOpen
=>
_open
;
bool
get
isOpen
=>
_open
;
bool
get
incluyeSubcarpetas
=>
_incluirSubcarpetas
;
bool
get
incluyeSubcarpetas
=>
_incluirSubcarpetas
;
Carpeta
({
required
super
.
id
,
required
Directory
directory
,
required
Map
<
Formato
,
bool
>
formatos
}):
Carpeta
({
required
super
.
id
,
required
Directory
directory
}):
_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
)
{
final
archivos
=
directory
.
listSync
(
recursive:
true
,
followLinks:
false
);
_formatos
.
add
(
InfoFormato
(
for
(
var
a
in
archivos
)
{
formato:
f
.
key
,
Formato
?
f
=
Formato
.
fromExtension
(
a
.
path
.
split
(
"."
).
last
);
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
if
(
f
!=
null
){
subCarpeta:
f
.
value
));
_formatos
.
add
(
InfoFormato
(
formato:
f
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
subCarpeta:
false
));
}
}
}
}
}
...
...
lib/modelo/lista_seleccionables.dart
View file @
38e38526
...
@@ -27,9 +27,17 @@ class ListaSeleccionables extends ChangeNotifier {
...
@@ -27,9 +27,17 @@ class ListaSeleccionables extends ChangeNotifier {
}
}
void
addCarpeta
(
Directory
directory
){
void
addCarpeta
(
Directory
directory
){
_seleccionables
.
add
(
Carpeta
(
id:
const
Uuid
().
v1
(),
final
newCarpeta
=
Carpeta
(
directory:
directory
,
formatos:
<
Formato
,
bool
>{
Formato
.
mp4
:
false
,
Formato
.
mp3
:
true
}));
id:
const
Uuid
().
v1
(),
notifyListeners
();
directory:
directory
);
if
(
newCarpeta
.
formatos
.
isNotEmpty
){
_seleccionables
.
add
(
Carpeta
(
id:
const
Uuid
().
v1
(),
directory:
directory
));
notifyListeners
();
}
}
}
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
...
...
lib/paginas/pagina_configuracion.dart
View file @
38e38526
...
@@ -31,10 +31,12 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
...
@@ -31,10 +31,12 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
RichText
(
title:
RichText
(
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
text:
TextSpan
(
children:
[
children:
[
WidgetSpan
(
WidgetSpan
(
child:
Icon
(
_getIcon
()
)
child:
_getIcon
(
)
),
),
TextSpan
(
TextSpan
(
text:
_getShownName
(),
text:
_getShownName
(),
...
@@ -49,14 +51,17 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
...
@@ -49,14 +51,17 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
);
);
}
}
Icon
Data
_getIcon
(){
Icon
_getIcon
(){
if
(
widget
.
_elementoAsociado
is
Carpeta
){
if
(
widget
.
_elementoAsociado
is
Carpeta
){
return
Icon
s
.
folder
;
return
Icon
(
Icons
.
folder
)
;
}
}
if
(
widget
.
_elementoAsociado
is
Enlace
){
if
(
widget
.
_elementoAsociado
is
Enlace
){
return
Icon
s
.
link
;
return
Icon
(
Icons
.
link
)
;
}
}
return
Icons
.
insert_drive_file
;
if
(
widget
.
_elementoAsociado
is
Convertible
){
return
(
widget
.
_elementoAsociado
as
Convertible
).
formatoOriginal
.
tipoMultimedia
.
icono
;
}
return
Icon
(
Icons
.
insert_drive_file
);
}
}
String
_getShownName
()
{
String
_getShownName
()
{
...
...
lib/widgets/carpeta_widget.dart
View file @
38e38526
...
@@ -74,59 +74,76 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
...
@@ -74,59 +74,76 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
child:
Row
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
widget
.
carpeta
.
icono
,
Flexible
(
flex:
1
,
child:
widget
.
carpeta
.
icono
),
const
SizedBox
(
width:
10
),
Flexible
(
flex:
1
,
child:
const
SizedBox
(
width:
20
)),
Expanded
(
Flexible
(
child:
Column
(
flex:
15
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
SizedBox
.
expand
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
child:
Column
(
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
start
,
Text
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
widget
.
carpeta
.
nombre
,
children:
[
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
Flexible
(
fontWeight:
FontWeight
.
bold
flex:
1
,
)
child:
Text
(
),
widget
.
carpeta
.
nombre
,
Text
(
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
(
seleccionados
.
length
>
0
)?
fontWeight:
FontWeight
.
bold
'
${seleccionados.length}
formato
$s
seleccionado
$s
'
),
:
'Ningún formato seleccionado'
,
overflow:
TextOverflow
.
ellipsis
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
),
color:
(
seleccionados
.
length
>
0
)?
null
:
Colors
.
red
),
)
Flexible
(
flex:
1
,
child:
Text
(
(
seleccionados
.
length
>
0
)?
'
${seleccionados.length}
formato
$s
seleccionado
$s
'
:
'Ningún formato seleccionado'
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
color:
(
seleccionados
.
length
>
0
)?
null
:
Colors
.
red
)
),
),
],
)
),
),
Flexible
(
flex:
3
,
fit:
FlexFit
.
loose
,
child:
Transform
.
rotate
(
angle:
rotAngle
,
child:
IconButton
(
icon:
Icon
(
Icons
.
arrow_drop_down
,
color:
(
seleccionados
.
length
>
0
)?
null
:
Theme
.
of
(
context
).
disabledColor
,
),
),
],
onPressed:
(
seleccionados
.
length
<=
0
)?
null
:
()
{
)
setState
(()
{
open
=
!
open
;
});
widget
.
carpeta
.
pressOpenClose
();
_controller
.
toggle
();
widget
.
lista
.
actualizaSeleccionable
(
widget
.
indice
,
widget
.
carpeta
);
}
),
),
),
),
Transform
.
rotat
e
(
Flexibl
e
(
angle:
rotAngle
,
flex:
3
,
child:
IconButton
(
child:
IconButton
(
icon:
Icon
(
icon:
const
Icon
(
Icons
.
edit
),
Icons
.
arrow_drop_down
,
onPressed:
()
{
color:
(
seleccionados
.
length
>
0
)?
null
:
Theme
.
of
(
context
).
disabledColor
,
Navigator
.
push
(
context
,
),
MaterialPageRoute
(
builder:
(
context
)
{
onPressed:
(
seleccionados
.
length
<=
0
)?
null
:
()
{
return
PaginaConfiguracion
(
setState
(()
{
indice:
widget
.
indice
,
open
=
!
open
;
elemento:
widget
.
carpeta
,
});
lista:
widget
.
lista
widget
.
carpeta
.
pressOpenClose
();
);
_controller
.
toggle
();
}));
widget
.
lista
.
actualizaSeleccionable
(
widget
.
indice
,
widget
.
carpeta
);
},
}
),
),
),
IconButton
(
icon:
const
Icon
(
Icons
.
edit
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
return
PaginaConfiguracion
(
indice:
widget
.
indice
,
elemento:
widget
.
carpeta
,
lista:
widget
.
lista
);
}));
},
)
)
]
]
),
),
...
@@ -174,7 +191,7 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
...
@@ -174,7 +191,7 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
widget
.
lista
.
actualizaSeleccionable
(
widget
.
indice
,
widget
.
carpeta
);
widget
.
lista
.
actualizaSeleccionable
(
widget
.
indice
,
widget
.
carpeta
);
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
SnackBar
(
content:
Text
(
'
${elemento.formatoOriginal.name.toUpperCase()}
excluido de
${widget.carpeta}
'
),
content:
Text
(
'
${elemento.formatoOriginal.name.toUpperCase()}
excluido de
${widget.carpeta
.nombre
}
'
),
action:
SnackBarAction
(
action:
SnackBarAction
(
label:
'Deshacer'
,
label:
'Deshacer'
,
onPressed:
()
{
onPressed:
()
{
...
@@ -194,42 +211,55 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
...
@@ -194,42 +211,55 @@ class _CarpetaWidgetState extends State<CarpetaWidget>
child:
Row
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
Icon
(
Icons
.
find_in_page_outlined
),
Flexible
(
flex:
1
,
child:
Icon
(
Icons
.
find_in_page_outlined
)),
const
SizedBox
(
width:
10
),
Flexible
(
flex:
1
,
child:
const
SizedBox
(
width:
10
)),
Expanded
(
Flexible
(
child:
Column
(
flex:
13
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
SizedBox
.
expand
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
child:
Column
(
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
start
,
Text
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
widget
.
carpeta
.
nombre
,
children:
[
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
Flexible
(
fontWeight:
FontWeight
.
bold
flex:
1
,
)
child:
Text
(
),
widget
.
carpeta
.
nombre
,
Text
(
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
texto
,
fontWeight:
FontWeight
.
bold
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
),
fontWeight:
FontWeight
.
bold
overflow:
TextOverflow
.
ellipsis
)
),
),
),
],
Flexible
(
)
flex:
1
,
child:
Text
(
texto
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
),
),
],
)
),
),
),
IconButton
(
Flexible
(
icon:
const
Icon
(
Icons
.
edit
),
flex:
2
,
onPressed:
()
{
child:
IconButton
(
Navigator
.
push
(
context
,
icon:
const
Icon
(
Icons
.
edit
),
MaterialPageRoute
(
builder:
(
context
)
{
onPressed:
()
{
return
PaginaConfiguracion
(
Navigator
.
push
(
context
,
indice:
widget
.
indice
,
MaterialPageRoute
(
builder:
(
context
)
{
elemento:
elemento
.
conversion
,
return
PaginaConfiguracion
(
lista:
widget
.
lista
,
indice:
widget
.
indice
,
carpeta:
widget
.
carpeta
elemento:
elemento
.
conversion
,
);
lista:
widget
.
lista
,
}
carpeta:
widget
.
carpeta
));
);
},
}
));
},
),
)
)
]
]
),
),
...
...
lib/widgets/convertex_fab_bar.dart
View file @
38e38526
...
@@ -150,7 +150,6 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
...
@@ -150,7 +150,6 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
onPressed:
()
async
{
onPressed:
()
async
{
String
?
path
=
await
FilePicker
.
platform
.
getDirectoryPath
();
String
?
path
=
await
FilePicker
.
platform
.
getDirectoryPath
();
if
(
path
!=
null
)
{
if
(
path
!=
null
)
{
// TODO: AÑADIR POSIBILIDAD RECURSIVIDAD
var
directory
=
Directory
(
path
);
var
directory
=
Directory
(
path
);
manager
.
addCarpeta
(
directory
);
manager
.
addCarpeta
(
directory
);
}
}
...
...
lib/widgets/seleccionable_widget.dart
View file @
38e38526
...
@@ -28,37 +28,50 @@ class SeleccionableWidget extends StatelessWidget {
...
@@ -28,37 +28,50 @@ class SeleccionableWidget extends StatelessWidget {
Convertible
arch
=
(
seleccionable
as
Convertible
);
Convertible
arch
=
(
seleccionable
as
Convertible
);
String
texto
=
arch
.
formatoOriginal
.
name
.
toUpperCase
();
String
texto
=
arch
.
formatoOriginal
.
name
.
toUpperCase
();
if
(
arch
.
formatoDestino
!=
null
)
texto
+=
" >
${arch.formatoDestino!.name.toUpperCase()}
"
;
if
(
arch
.
formatoDestino
!=
null
)
texto
+=
" >
${arch.formatoDestino!.name.toUpperCase()}
"
;
formatoOrig
=
Text
(
texto
);
formatoOrig
=
Flexible
(
flex:
1
,
child:
Text
(
texto
)
);
}
}
return
Row
(
return
SizedBox
(
children:
<
Widget
>[
height:
60
,
seleccionable
.
icono
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
const
SizedBox
(
width:
10
),
child:
Row
(
Expanded
(
children:
<
Widget
>[
child:
Column
(
Flexible
(
flex:
1
,
child:
seleccionable
.
icono
),
crossAxisAlignment:
CrossAxisAlignment
.
start
,
Flexible
(
flex:
1
,
child:
const
SizedBox
(
width:
15
)),
children:
[
Flexible
(
Text
(
flex:
16
,
visible
,
child:
SizedBox
.
expand
(
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
child:
Column
(
fontWeight:
FontWeight
.
bold
crossAxisAlignment:
CrossAxisAlignment
.
start
,
)
children:
[
),
Flexible
(
if
(
formatoOrig
!=
null
)
formatoOrig
flex:
1
,
],
child:
Text
(
)
visible
,
),
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
IconButton
(
fontWeight:
FontWeight
.
bold
icon:
const
Icon
(
Icons
.
edit
),
)
onPressed:
()
{
),
Navigator
.
push
(
context
,
),
MaterialPageRoute
(
builder:
(
context
)
{
if
(
formatoOrig
!=
null
)
formatoOrig
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
seleccionable
,
lista:
lista
);
],
}));
)
},
),
)
),
]
Flexible
(
flex:
2
,
child:
IconButton
(
icon:
const
Icon
(
Icons
.
edit
),
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