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
f561933f
authored
Apr 14, 2025
by
Rafa Castillo Passols
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
En proceso de refactorizar
parent
54232159
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
157 additions
and
171 deletions
lib/modelo/archivo.dart
lib/modelo/carpeta.dart
lib/modelo/conversor.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/carpeta_widget.dart
lib/widgets/convertex_fab_bar.dart
lib/widgets/seleccionable_widget.dart → lib/widgets/convertible_widget.dart
lib/widgets/widgets.dart
lib/modelo/archivo.dart
View file @
f561933f
...
@@ -5,6 +5,7 @@ import 'convertible.dart';
...
@@ -5,6 +5,7 @@ import 'convertible.dart';
import
'formato.dart'
;
import
'formato.dart'
;
// TODO: QUE PASA SI NO RECONOCEMOS EL FORMATO?
// TODO: QUE PASA SI NO RECONOCEMOS EL FORMATO?
// TODO: MIRAR DE CREAR UN MIXIN TIPO ELEMENTOLOCAL O ALGO ASÍ (Archivo y Carpeta)
class
Archivo
extends
Convertible
{
class
Archivo
extends
Convertible
{
final
File
file
;
final
File
file
;
late
final
Future
<
List
<
Metadato
>>
metadatos
;
late
final
Future
<
List
<
Metadato
>>
metadatos
;
...
...
lib/modelo/carpeta.dart
View file @
f561933f
import
'dart:io'
;
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:uuid/uuid.dart'
;
import
'package:uuid/uuid.dart'
;
import
'archivo.dart'
;
import
'convertible.dart'
;
import
'convertible.dart'
;
import
'elemento_seleccionable.dart'
;
import
'elemento_seleccionable.dart'
;
import
'formato.dart'
;
import
'formato.dart'
;
class
Carpeta
extends
ElementoSeleccionable
{
class
Carpeta
extends
ElementoSeleccionable
{
final
Directory
_directory
;
final
Directory
_directory
;
bool
_incluirSubcarpetas
=
false
;
bool
_incluirSubcarpetas
=
false
;
bool
_open
=
false
;
// bool _open = false;
late
final
List
<
InfoFormato
>
_formatos
;
final
List
<
InfoFormato
>
_formatos
=
<
InfoFormato
>[];
final
_elementos
=
<
FileSystemEntity
>[];
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
;
List
<
FileSystemEntity
>
get
elementos
=>
List
.
unmodifiable
(
_elementos
);
// bool get isOpen => _open;
bool
get
incluyeSubcarpetas
=>
_incluirSubcarpetas
;
bool
get
incluyeSubcarpetas
=>
_incluirSubcarpetas
;
Carpeta
({
required
super
.
id
,
required
Directory
directory
}):
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
=
[];
final
elementos
=
directory
.
listSync
(
recursive:
_incluirSubcarpetas
,
followLinks:
false
);
final
archivos
=
directory
.
listSync
(
recursive:
true
,
followLinks:
false
);
// Ahora mismo no funciona por tema permisos pero Diego está trabajando en ello
for
(
var
a
in
archivos
)
{
for
(
var
fse
in
elementos
)
{
Formato
?
f
=
Formato
.
fromExtension
(
a
.
path
.
split
(
"."
).
last
);
Formato
?
f
=
Formato
.
fromExtension
(
fse
.
path
.
split
(
"."
).
last
);
if
(
f
!=
null
){
if
(
f
!=
null
)
{
_formatos
.
add
(
InfoFormato
(
/*
Creo que podríamos usar mejor _elementos que _formatos
para la construcción de las CarpetaWidget, pero no voy a
quitar _formatos para que la pagina de configuración de la
carpeta siga funcionando
*/
_formatos
.
add
(
InfoFormato
(
formato:
f
,
formato:
f
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
nombreCarpeta:
directory
.
path
.
split
(
'/'
).
last
,
subCarpeta:
false
));
subCarpeta:
false
}
)
);
_elementos
.
add
(
fse
);
}
}
}
}
}
/*
Carpeta.fromList({required super.id, required Directory directory, required List<InfoFormato> formatos}):
Carpeta.fromList({required super.id, required Directory directory, required List<InfoFormato> formatos}):
_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
}){
InfoFormato
?
getInfoFormato
({
required
Formato
formato
}){
for
(
InfoFormato
i
in
_formatos
){
for
(
InfoFormato
i
in
_formatos
){
...
@@ -56,9 +69,16 @@ class Carpeta extends ElementoSeleccionable{
...
@@ -56,9 +69,16 @@ class Carpeta extends ElementoSeleccionable{
}
}
}
}
/*
Esto estaba siendo llamado para guardar que una carpeta había sido abierta
en la página principal para mostrar los archivos y subcarpetas y etc...
Aunque esto lo podriamos tener guerdado solo en el widget correspondiente
void pressOpenClose(){
void pressOpenClose(){
_open = !_open;
_open = !_open;
}
}
*/
void
pressIncluirSubcarpetas
(){
void
pressIncluirSubcarpetas
(){
_incluirSubcarpetas
=
!
_incluirSubcarpetas
;
_incluirSubcarpetas
=
!
_incluirSubcarpetas
;
...
@@ -69,6 +89,11 @@ class Carpeta extends ElementoSeleccionable{
...
@@ -69,6 +89,11 @@ class Carpeta extends ElementoSeleccionable{
}
}
}
}
/**
* Creo que es una clase que ha creado para poder manejar las entidades
* que pueden haber dentro de una carpeta (podría ser Seleccionable)
*/
class
InfoFormato
{
class
InfoFormato
{
final
bool
_subcarpeta
;
final
bool
_subcarpeta
;
bool
seleccionado
;
bool
seleccionado
;
...
@@ -97,7 +122,7 @@ class InfoFormato {
...
@@ -97,7 +122,7 @@ class InfoFormato {
@override
@override
bool
operator
==(
Object
other
)
{
bool
operator
==(
Object
other
)
{
if
(
other
is
InfoFormato
)
return
this
.
formatoOriginal
==
other
.
formatoOriginal
;
if
(
other
is
InfoFormato
)
return
formatoOriginal
==
other
.
formatoOriginal
;
return
super
==
other
;
return
super
==
other
;
}
}
}
}
\ No newline at end of file
lib/modelo/conversor.dart
View file @
f561933f
...
@@ -57,7 +57,7 @@ abstract class Conversor {
...
@@ -57,7 +57,7 @@ abstract class Conversor {
valor:
campos
[
1
]
valor:
campos
[
1
]
));
));
}
catch
(
e
)
{
}
catch
(
e
)
{
print
(
"No se ha podido añadir un metadato
"
+
campos
[
0
]
);
print
(
"No se ha podido añadir un metadato
${campos[0]}
"
);
}
}
}
}
...
...
lib/modelo/lista_seleccionables.dart
View file @
f561933f
...
@@ -4,7 +4,6 @@ import 'package:uuid/uuid.dart';
...
@@ -4,7 +4,6 @@ import 'package:uuid/uuid.dart';
import
'carpeta.dart'
;
import
'carpeta.dart'
;
import
'elemento_seleccionable.dart'
;
import
'elemento_seleccionable.dart'
;
import
'archivo.dart'
;
import
'archivo.dart'
;
import
'formato.dart'
;
class
ListaSeleccionables
extends
ChangeNotifier
{
class
ListaSeleccionables
extends
ChangeNotifier
{
final
_seleccionables
=
<
ElementoSeleccionable
>[];
final
_seleccionables
=
<
ElementoSeleccionable
>[];
...
@@ -31,13 +30,15 @@ class ListaSeleccionables extends ChangeNotifier {
...
@@ -31,13 +30,15 @@ class ListaSeleccionables extends ChangeNotifier {
id:
const
Uuid
().
v1
(),
id:
const
Uuid
().
v1
(),
directory:
directory
directory:
directory
);
);
if
(
newCarpeta
.
formatos
.
isNotEmpty
){
//if(newCarpeta.formatos.isNotEmpty){
_seleccionables
.
add
(
Carpeta
(
_seleccionables
.
add
(
id:
const
Uuid
().
v1
(),
Carpeta
(
directory:
directory
id:
const
Uuid
().
v1
(),
));
directory:
directory
)
);
notifyListeners
();
notifyListeners
();
}
//
}
}
}
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
void
reinsertar
(
int
index
,
ElementoSeleccionable
element
){
...
...
lib/paginas/pagina_configuracion.dart
View file @
f561933f
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:provider/provider.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/paginas/paginas.dart'
;
import
'package:prueba_multimedia/paginas/paginas.dart'
;
class
PaginaConfiguracion
extends
StatefulWidget
{
class
PaginaConfiguracion
extends
StatefulWidget
{
final
ListaSeleccionables
_lista
;
final
ListaSeleccionables
_lista
;
final
int
_indice
;
final
int
_indice
;
final
ElementoSeleccionable
_elementoAsociado
;
final
Convertible
_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
Convertible
elemento
,
Carpeta
?
carpeta
}):
_lista
=
lista
,
_indice
=
indice
,
_elementoAsociado
=
elemento
;
}):
_lista
=
lista
,
_indice
=
indice
,
_elementoAsociado
=
elemento
,
_carpeta
=
carpeta
;
@override
@override
State
<
PaginaConfiguracion
>
createState
()
=>
_PaginaConfiguracionState
();
State
<
PaginaConfiguracion
>
createState
()
=>
_PaginaConfiguracionState
();
...
@@ -25,6 +20,7 @@ class PaginaConfiguracion extends StatefulWidget {
...
@@ -25,6 +20,7 @@ class PaginaConfiguracion extends StatefulWidget {
class
_PaginaConfiguracionState
extends
State
<
PaginaConfiguracion
>
{
class
_PaginaConfiguracionState
extends
State
<
PaginaConfiguracion
>
{
int
_categoriaActiva
=
0
;
int
_categoriaActiva
=
0
;
final
_paginas
=
<
Widget
>[];
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -36,134 +32,88 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
...
@@ -36,134 +32,88 @@ class _PaginaConfiguracionState extends State<PaginaConfiguracion> {
text:
TextSpan
(
text:
TextSpan
(
children:
[
children:
[
WidgetSpan
(
WidgetSpan
(
child:
_getIcon
()
child:
widget
.
_elementoAsociado
.
icono
),
),
TextSpan
(
TextSpan
(
text:
_getShownName
()
,
text:
"
${widget._elementoAsociado.nombre}
"
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
)
)
]
]
)
)
),
),
),
),
body:
_construirCuerpo
(
widget
.
_lista
),
body:
_construirCuerpo
(),
bottomNavigationBar:
_construirBarraNavegacion
()
bottomNavigationBar:
BottomNavigationBar
(
currentIndex:
_categoriaActiva
,
onTap:
(
int
indice
)
=>
setState
(()
{
_categoriaActiva
=
indice
;
}),
items:
_construirElementosBarraNavegacion
()
)
);
);
}
}
Icon
_getIcon
(){
Widget
_construirCuerpo
()
{
if
(
widget
.
_elementoAsociado
is
Carpeta
){
Formato
formatoOriginal
=
widget
.
_elementoAsociado
.
formatoOriginal
;
return
Icon
(
Icons
.
folder
);
bool
esFormatoVideo
=
formatoOriginal
.
tipoMultimedia
==
TipoMultimedia
.
video
;
}
var
archivo
=
widget
.
_elementoAsociado
as
Archivo
;
if
(
widget
.
_elementoAsociado
is
Enlace
){
return
Icon
(
Icons
.
link
);
}
if
(
widget
.
_elementoAsociado
is
Convertible
){
return
(
widget
.
_elementoAsociado
as
Convertible
).
formatoOriginal
.
tipoMultimedia
.
icono
;
}
return
Icon
(
Icons
.
insert_drive_file
);
}
String
_getShownName
()
{
final
sb
=
StringBuffer
();
sb
.
write
(
" "
);
sb
.
write
(
widget
.
_elementoAsociado
.
nombre
);
return
sb
.
toString
();
}
Widget
_construirCuerpo
(
ListaSeleccionables
manager
)
{
_paginas
.
add
(
if
(
widget
.
_elementoAsociado
is
Archivo
){
PaginaConversion
.
convertible
(
final
arch
=
widget
.
_elementoAsociado
as
Archivo
;
lista:
widget
.
_lista
,
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
(
lista:
manager
,
indiceArchivo:
widget
.
_indice
,
indiceArchivo:
widget
.
_indice
,
elemento:
arch
,
elemento:
widget
.
_elementoAsociado
,
formatoOriginal:
arch
.
formatoOriginal
formatoOriginal:
widget
.
_elementoAsociado
.
formatoOriginal
);
)
);
if
(
widget
.
_elementoAsociado
is
Archivo
)
{
if
(
esFormatoVideo
)
{
_paginas
.
add
(
PaginaFotograma
());
}
}
else
if
(
_categoriaActiva
==
2
||
arch
.
formatoOriginal
.
tipoMultimedia
!=
TipoMultimedia
.
video
){
_paginas
.
add
(
return
FutureBuilder
(
FutureBuilder
(
future:
arch
.
metadatos
,
future:
arch
ivo
.
metadatos
,
builder:
(
context
,
snapshot
)
{
builder:
(
context
,
snapshot
)
{
return
snapshot
.
hasData
return
snapshot
.
hasData
?
PaginaMetadatos
(
?
PaginaMetadatos
(
metadatos:
snapshot
.
data
!,
metadatos:
snapshot
.
data
!,
formato:
arch
.
formatoOriginal
formato:
archivo
.
formatoOriginal
)
)
:
CircularProgressIndicator
();
:
const
CircularProgressIndicator
();
}
}
);
),
}
else
{
return
PaginaFotograma
();
}
}
// Páginas de carpetas y formato de archivo para carpeta
// TODO: Carpeta de ejemplo, cargar carpetas de verdad
return
PaginaConfiguracionCarpeta
(
lista:
manager
,
carpeta:
widget
.
_elementoAsociado
as
Carpeta
,
indice:
widget
.
_indice
);
}
BottomNavigationBar
?
_construirBarraNavegacion
(){
if
(
widget
.
_elementoAsociado
is
Archivo
){
return
BottomNavigationBar
(
currentIndex:
_categoriaActiva
,
onTap:
(
int
indice
)
{
setState
(()
{
_categoriaActiva
=
indice
;
});
},
items:
_construirElementosBarraNavegacion
()
);
);
}
}
return
null
;
return
_paginas
[
_categoriaActiva
];
}
}
List
<
BottomNavigationBarItem
>
_construirElementosBarraNavegacion
(){
List
<
BottomNavigationBarItem
>
_construirElementosBarraNavegacion
(){
final
toRet
=
<
BottomNavigationBarItem
>[];
Formato
formatoOriginal
=
widget
.
_elementoAsociado
.
formatoOriginal
;
bool
isVideo
=
false
;
bool
esFormatoVideo
=
formatoOriginal
.
tipoMultimedia
==
TipoMultimedia
.
video
;
if
(
widget
.
_elementoAsociado
is
Archivo
){
final
items
=
<
BottomNavigationBarItem
>[
final
arch
=
widget
.
_elementoAsociado
as
Archivo
;
const
BottomNavigationBarItem
(
if
(
arch
.
formatoOriginal
.
tipoMultimedia
==
TipoMultimedia
.
video
){
icon:
Icon
(
Icons
.
sync
),
isVideo
=
true
;
label:
'Formato de Conversión'
),
];
if
(
widget
.
_elementoAsociado
is
Archivo
)
{
if
(
esFormatoVideo
)
{
items
.
add
(
const
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
local_movies
),
label:
'Fotograma'
)
);
}
}
items
.
add
(
const
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
format_list_bulleted
),
label:
'Metadatos'
),
);
}
}
// Página de selección de conversión
return
items
;
toRet
.
add
(
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
sync
),
label:
isVideo
?
'Conversión'
:
'Formato de Conversión'
));
// Página de selección de fotograma
if
(
isVideo
){
toRet
.
add
(
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
local_movies
),
label:
'Fotograma'
));
}
// Página de edición de metadatos
toRet
.
add
(
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
format_list_bulleted
),
label:
'Metadatos'
));
return
toRet
;
}
}
}
}
lib/paginas/pagina_configuracion_carpeta.dart
View file @
f561933f
...
@@ -215,7 +215,6 @@ class _PaginaConfiguracionCarpetaState extends State<PaginaConfiguracionCarpeta>
...
@@ -215,7 +215,6 @@ class _PaginaConfiguracionCarpetaState extends State<PaginaConfiguracionCarpeta>
indice:
widget
.
_indice
,
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 @
f561933f
...
@@ -43,7 +43,7 @@ class PaginaConversion extends StatefulWidget {
...
@@ -43,7 +43,7 @@ class PaginaConversion extends StatefulWidget {
class
_PaginaConversionState
extends
State
<
PaginaConversion
>
class
_PaginaConversionState
extends
State
<
PaginaConversion
>
with
SingleTickerProviderStateMixin
{
with
SingleTickerProviderStateMixin
{
Formato
?
_formatoConvertido
;
Formato
?
_formatoConvertido
;
Calidad
?
_calidadActual
=
null
;
Calidad
?
_calidadActual
;
bool
_showProfiles
=
true
;
bool
_showProfiles
=
true
;
late
final
TabController
_tabController
;
late
final
TabController
_tabController
;
...
...
lib/paginas/pagina_principal_llena.dart
View file @
f561933f
...
@@ -27,7 +27,8 @@ class PaginaPrincipalLlena extends StatelessWidget {
...
@@ -27,7 +27,8 @@ class PaginaPrincipalLlena extends StatelessWidget {
alignment:
Alignment
.
centerLeft
,
alignment:
Alignment
.
centerLeft
,
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
Icon
(
Icons
.
delete
,
child:
const
Icon
(
Icons
.
delete
,
color:
Colors
.
white
,
color:
Colors
.
white
,
size:
31.0
size:
31.0
),
),
...
@@ -38,9 +39,10 @@ class PaginaPrincipalLlena extends StatelessWidget {
...
@@ -38,9 +39,10 @@ class PaginaPrincipalLlena extends StatelessWidget {
alignment:
Alignment
.
centerRight
,
alignment:
Alignment
.
centerRight
,
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
Icon
(
Icons
.
delete
,
child:
const
Icon
(
color:
Colors
.
white
,
Icons
.
delete
,
size:
31.0
color:
Colors
.
white
,
size:
31.0
),
),
),
),
),
),
...
@@ -58,9 +60,17 @@ class PaginaPrincipalLlena extends StatelessWidget {
...
@@ -58,9 +60,17 @@ class PaginaPrincipalLlena extends StatelessWidget {
)
)
);
);
},
},
child:
(
seleccionables
[
index
]
is
Carpeta
)?
child:
(
seleccionables
[
index
]
is
Carpeta
)
CarpetaWidget
(
indice:
index
,
carpeta:
seleccionables
[
index
]
as
Carpeta
,
lista:
listaSeleccionables
)
?
CarpetaWidget
(
:
SeleccionableWidget
(
indice:
index
,
seleccionable:
seleccionables
[
index
],
lista:
listaSeleccionables
)
indice:
index
,
carpeta:
seleccionables
[
index
]
as
Carpeta
,
lista:
listaSeleccionables
)
:
ConvertibleWidget
(
indice:
index
,
convertible:
seleccionables
[
index
]
as
Convertible
,
lista:
listaSeleccionables
)
);
);
},
},
),
),
...
...
lib/widgets/carpeta_widget.dart
View file @
f561933f
This diff is collapsed.
Click to expand it.
lib/widgets/convertex_fab_bar.dart
View file @
f561933f
import
'dart:io'
;
import
'package:ffmpeg_kit_flutter/return_code.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:file_picker/file_picker.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/widgets/widgets.dart'
;
import
'package:prueba_multimedia/widgets/widgets.dart'
;
...
...
lib/widgets/
selecciona
ble_widget.dart
→
lib/widgets/
converti
ble_widget.dart
View file @
f561933f
...
@@ -2,42 +2,37 @@ import 'package:flutter/material.dart';
...
@@ -2,42 +2,37 @@ import 'package:flutter/material.dart';
import
'package:prueba_multimedia/paginas/paginas.dart'
;
import
'package:prueba_multimedia/paginas/paginas.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
class
Selecciona
bleWidget
extends
StatelessWidget
{
class
Converti
bleWidget
extends
StatelessWidget
{
final
int
indice
;
final
int
indice
;
final
ElementoSeleccionable
selecciona
ble
;
final
Convertible
converti
ble
;
final
ListaSeleccionables
lista
;
final
ListaSeleccionables
lista
;
const
SeleccionableWidget
({
super
.
key
,
required
this
.
indice
,
required
this
.
seleccionable
,
required
this
.
lista
});
const
ConvertibleWidget
({
super
.
key
,
required
this
.
indice
,
required
this
.
convertible
,
required
this
.
lista
});
// 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
=
selecciona
ble
.
nombre
;
final
String
nombre
=
converti
ble
.
nombre
;
int
index
=
nombre
.
lastIndexOf
(
'.'
);
int
index
=
nombre
.
lastIndexOf
(
'.'
);
final
String
visible
;
final
String
nombreConvertible
=
index
>
-
1
if
(
index
>
-
1
){
?
nombre
.
substring
(
0
,
index
)
visible
=
nombre
.
substring
(
0
,
index
);
:
nombre
;
// Descripción debajo del nombre del convertible con los formatos
String
formatoOrigenYDestino
=
convertible
.
formatoOriginal
.
name
.
toUpperCase
();
if
(
convertible
.
formatoDestino
!=
null
)
{
formatoOrigenYDestino
+=
" >
${convertible.formatoDestino!.name.toUpperCase()}
"
;
}
}
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
=
Flexible
(
flex:
1
,
child:
Text
(
texto
));
}
return
SizedBox
(
return
SizedBox
(
height:
60
,
height:
60
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
Row
(
child:
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
Flexible
(
flex:
1
,
child:
selecciona
ble
.
icono
),
Flexible
(
flex:
1
,
child:
converti
ble
.
icono
),
Flexible
(
flex:
1
,
child:
const
SizedBox
(
width:
15
)),
const
Flexible
(
flex:
1
,
child:
SizedBox
(
width:
15
)),
Flexible
(
Flexible
(
flex:
16
,
flex:
16
,
child:
SizedBox
.
expand
(
child:
SizedBox
.
expand
(
...
@@ -47,13 +42,16 @@ class SeleccionableWidget extends StatelessWidget {
...
@@ -47,13 +42,16 @@ class SeleccionableWidget extends StatelessWidget {
Flexible
(
Flexible
(
flex:
1
,
flex:
1
,
child:
Text
(
child:
Text
(
vis
ible
,
nombreConvert
ible
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
fontWeight:
FontWeight
.
bold
)
)
),
),
),
),
if
(
formatoOrig
!=
null
)
formatoOrig
Flexible
(
flex:
1
,
child:
Text
(
formatoOrigenYDestino
)
)
],
],
)
)
),
),
...
@@ -65,7 +63,11 @@ class SeleccionableWidget extends StatelessWidget {
...
@@ -65,7 +63,11 @@ class SeleccionableWidget extends StatelessWidget {
onPressed:
()
{
onPressed:
()
{
Navigator
.
push
(
context
,
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
MaterialPageRoute
(
builder:
(
context
)
{
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
seleccionable
,
lista:
lista
);
return
PaginaConfiguracion
(
indice:
indice
,
elemento:
convertible
,
lista:
lista
);
}));
}));
},
},
),
),
...
...
lib/widgets/widgets.dart
View file @
f561933f
...
@@ -2,4 +2,4 @@ export 'action_button.dart';
...
@@ -2,4 +2,4 @@ export 'action_button.dart';
export
'convertex_fab_bar.dart'
;
export
'convertex_fab_bar.dart'
;
export
'convertex_prototipo_app.dart'
;
export
'convertex_prototipo_app.dart'
;
export
'expandable_fab.dart'
;
export
'expandable_fab.dart'
;
export
'seleccionable_widget.dart'
;
export
'convertible_widget.dart'
;
\ No newline at end of file
\ No newline at end of file
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