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
Expand all
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{
bool
get
isOpen
=>
_open
;
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
,
super
(
nombre:
directory
.
path
.
split
(
'/'
).
last
,
icon:
const
Icon
(
Icons
.
folder_outlined
))
{
_formatos
=
[];
for
(
var
f
in
formatos
.
entries
)
{
_formatos
.
add
(
InfoFormato
(
formato:
f
.
key
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
subCarpeta:
f
.
value
));
final
archivos
=
directory
.
listSync
(
recursive:
true
,
followLinks:
false
);
for
(
var
a
in
archivos
)
{
Formato
?
f
=
Formato
.
fromExtension
(
a
.
path
.
split
(
"."
).
last
);
if
(
f
!=
null
){
_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 {
}
void
addCarpeta
(
Directory
directory
){
_seleccionables
.
add
(
Carpeta
(
id:
const
Uuid
().
v1
(),
directory:
directory
,
formatos:
<
Formato
,
bool
>{
Formato
.
mp4
:
false
,
Formato
.
mp3
:
true
}));
notifyListeners
();
final
newCarpeta
=
Carpeta
(
id:
const
Uuid
().
v1
(),
directory:
directory
);
if
(
newCarpeta
.
formatos
.
isNotEmpty
){
_seleccionables
.
add
(
Carpeta
(
id:
const
Uuid
().
v1
(),
directory:
directory
));
notifyListeners
();
}
}
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
...
...
lib/paginas/pagina_configuracion.dart
View file @
38e38526
...
...
@@ -31,10 +31,12 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
return
Scaffold
(
appBar:
AppBar
(
title:
RichText
(
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
WidgetSpan
(
child:
Icon
(
_getIcon
()
)
child:
_getIcon
(
)
),
TextSpan
(
text:
_getShownName
(),
...
...
@@ -49,14 +51,17 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
);
}
Icon
Data
_getIcon
(){
Icon
_getIcon
(){
if
(
widget
.
_elementoAsociado
is
Carpeta
){
return
Icon
s
.
folder
;
return
Icon
(
Icons
.
folder
)
;
}
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
()
{
...
...
lib/widgets/carpeta_widget.dart
View file @
38e38526
This diff is collapsed.
Click to expand it.
lib/widgets/convertex_fab_bar.dart
View file @
38e38526
...
...
@@ -150,7 +150,6 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
onPressed:
()
async
{
String
?
path
=
await
FilePicker
.
platform
.
getDirectoryPath
();
if
(
path
!=
null
)
{
// TODO: AÑADIR POSIBILIDAD RECURSIVIDAD
var
directory
=
Directory
(
path
);
manager
.
addCarpeta
(
directory
);
}
...
...
lib/widgets/seleccionable_widget.dart
View file @
38e38526
...
...
@@ -28,37 +28,50 @@ class SeleccionableWidget extends StatelessWidget {
Convertible
arch
=
(
seleccionable
as
Convertible
);
String
texto
=
arch
.
formatoOriginal
.
name
.
toUpperCase
();
if
(
arch
.
formatoDestino
!=
null
)
texto
+=
" >
${arch.formatoDestino!.name.toUpperCase()}
"
;
formatoOrig
=
Text
(
texto
);
formatoOrig
=
Flexible
(
flex:
1
,
child:
Text
(
texto
)
);
}
return
Row
(
children:
<
Widget
>[
seleccionable
.
icono
,
const
SizedBox
(
width:
10
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
visible
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
),
if
(
formatoOrig
!=
null
)
formatoOrig
],
)
),
IconButton
(
icon:
const
Icon
(
Icons
.
edit
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
seleccionable
,
lista:
lista
);
}));
},
)
]
return
SizedBox
(
height:
60
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
Row
(
children:
<
Widget
>[
Flexible
(
flex:
1
,
child:
seleccionable
.
icono
),
Flexible
(
flex:
1
,
child:
const
SizedBox
(
width:
15
)),
Flexible
(
flex:
16
,
child:
SizedBox
.
expand
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Flexible
(
flex:
1
,
child:
Text
(
visible
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
),
),
if
(
formatoOrig
!=
null
)
formatoOrig
],
)
),
),
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