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
c0293fdf
authored
Apr 03, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Carpeta widget comenzado, animación terminada
parent
70eed32d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
193 additions
and
3 deletions
lib/paginas/pagina_principal_llena.dart
lib/widgets/carpeta_widget.dart
lib/widgets/seleccionable_widget.dart
lib/paginas/pagina_principal_llena.dart
View file @
c0293fdf
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'package:prueba_multimedia/widgets/carpeta_widget.dart'
;
import
'package:prueba_multimedia/widgets/widgets.dart'
;
import
'package:prueba_multimedia/widgets/widgets.dart'
;
class
PaginaPrincipalLlena
extends
StatelessWidget
{
class
PaginaPrincipalLlena
extends
StatelessWidget
{
...
@@ -57,7 +58,9 @@ class PaginaPrincipalLlena extends StatelessWidget {
...
@@ -57,7 +58,9 @@ class PaginaPrincipalLlena extends StatelessWidget {
)
)
);
);
},
},
child:
SeleccionableWidget
(
indice:
index
,
seleccionable:
seleccionables
[
index
],
lista:
listaSeleccionables
)
child:
(
seleccionables
[
index
]
is
Carpeta
)?
CarpetaWidget
(
indice:
index
,
carpeta:
seleccionables
[
index
]
as
Carpeta
,
lista:
listaSeleccionables
)
:
SeleccionableWidget
(
indice:
index
,
seleccionable:
seleccionables
[
index
],
lista:
listaSeleccionables
)
);
);
},
},
),
),
...
...
lib/widgets/carpeta_widget.dart
0 → 100644
View file @
c0293fdf
import
'package:flutter/material.dart'
;
import
'package:prueba_multimedia/paginas/paginas.dart'
;
import
'package:prueba_multimedia/modelo/modelo.dart'
;
import
'dart:math'
;
class
CarpetaWidget
extends
StatefulWidget
{
final
int
indice
;
final
Carpeta
carpeta
;
final
ListaSeleccionables
lista
;
const
CarpetaWidget
({
super
.
key
,
required
this
.
indice
,
required
this
.
carpeta
,
required
this
.
lista
});
@override
State
<
CarpetaWidget
>
createState
()
=>
_CarpetaWidgetState
();
}
class
_CarpetaWidgetState
extends
State
<
CarpetaWidget
>
with
SingleTickerProviderStateMixin
{
late
final
AnimationController
_controller
;
late
final
numChild
=
widget
.
carpeta
.
formatos
.
length
;
bool
open
=
false
;
double
rotAngle
=
0
;
double
height
=
20
;
@override
void
initState
()
{
_controller
=
AnimationController
(
duration:
Duration
(
milliseconds:
200
),
vsync:
this
);
_controller
.
addListener
(()
{
setState
(()
{
rotAngle
=
pi
*
_controller
.
value
;
height
=
40
*
_controller
.
value
;
});
});
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
SizedBox
(
height:
60
+
(
numChild
*
height
),
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
Stack
(
children:
[
Positioned
(
top:
0
,
child:
buildMainContainer
(),
),
...
buildSecondaryContainers
()
]
),
);
}
Widget
buildMainContainer
(){
return
SizedBox
(
height:
60
,
width:
MediaQuery
.
of
(
context
).
size
.
width
-
10
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
widget
.
carpeta
.
icono
,
const
SizedBox
(
width:
10
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
widget
.
carpeta
.
nombre
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
),
],
)
),
Transform
.
rotate
(
angle:
rotAngle
,
child:
IconButton
(
icon:
Icon
(
Icons
.
arrow_drop_down
),
onPressed:
()
{
setState
(()
{
open
=
!
open
;
});
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
);
}));
},
)
]
),
);
}
List
<
Widget
>
buildSecondaryContainers
(){
return
widget
.
carpeta
.
formatos
.
map
((
formato
)
{
final
Icon
icon
;
if
(
formato
.
formatoOriginal
.
tipoMultimedia
==
TipoMultimedia
.
imagen
){
icon
=
Icon
(
Icons
.
image_search
);
}
else
if
(
formato
.
formatoOriginal
.
tipoMultimedia
==
TipoMultimedia
.
audio
){
icon
=
Icon
(
Icons
.
manage_search
);
}
else
{
icon
=
Icon
(
Icons
.
screen_search_desktop_outlined
);
}
return
ClipRect
(
clipper:
_MyRectClipper
(
_controller
),
child:
SizedBox
(
height:
40
,
width:
MediaQuery
.
of
(
context
).
size
.
width
-
10
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
24.0
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
Icon
(
Icons
.
image_search
),
const
SizedBox
(
width:
10
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
widget
.
carpeta
.
nombre
,
style:
Theme
.
of
(
context
).
textTheme
.
bodyLarge
?.
copyWith
(
fontWeight:
FontWeight
.
bold
)
),
],
)
),
IconButton
(
icon:
const
Icon
(
Icons
.
edit
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
return
PaginaConfiguracion
(
indice:
widget
.
indice
,
elemento:
widget
.
carpeta
,
lista:
widget
.
lista
);
}));
},
)
]
),
),
),
);;
}).
toList
();
}
}
class
_MyRectClipper
extends
CustomClipper
<
Rect
>
{
final
AnimationController
_controller
;
_MyRectClipper
(
this
.
_controller
);
@override
Rect
getClip
(
Size
size
)
{
double
value
=
(
1
-
_controller
.
value
)*
40
;
return
Rect
.
fromLTWH
(
0
,
value
,
1000
,
40
);
}
@override
bool
shouldReclip
(
covariant
CustomClipper
<
Rect
>
oldClipper
)
{
return
true
;
}
}
\ No newline at end of file
lib/widgets/seleccionable_widget.dart
View file @
c0293fdf
...
@@ -49,8 +49,6 @@ class SeleccionableWidget extends StatelessWidget {
...
@@ -49,8 +49,6 @@ class SeleccionableWidget extends StatelessWidget {
],
],
)
)
),
),
if
(
seleccionable
is
Carpeta
)
if
((
seleccionable
as
Carpeta
).
isOpen
)
IconButton
(
onPressed:
()
{},
icon:
Icon
(
Icons
.
menu
)),
IconButton
(
IconButton
(
icon:
const
Icon
(
Icons
.
edit
),
icon:
const
Icon
(
Icons
.
edit
),
onPressed:
()
{
onPressed:
()
{
...
...
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