Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rafa Castillo Passols
/
peponator
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
6c25f5e9
authored
Apr 25, 2025
by
Diego Pérez Peña
Committed by
Tecnicos
Apr 25, 2025
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Agregada orientación para la pantalla final y la de récords
parent
508e88e1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
57 deletions
lib/paginas/pantalla_juego.dart
lib/paginas/pantalla_records.dart
lib/paginas/pantalla_juego.dart
View file @
6c25f5e9
...
...
@@ -619,8 +619,10 @@ class _PantallaJuegoState extends State<PantallaJuego>
// TODO: Agregar una pantalla de registro de récords
Widget
_buildPantallaFinal
(
Orientation
orientation
){
final
fullWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
final
fullHeight
=
380.0
;
final
fullWidth
=
(
orientation
==
Orientation
.
portrait
)?
MediaQuery
.
of
(
context
).
size
.
width
-
MediaQuery
.
of
(
context
).
padding
.
horizontal
:
400.0
;
final
fullHeight
=
(
orientation
==
Orientation
.
portrait
)?
380.0
:
MediaQuery
.
of
(
context
).
size
.
height
-
MediaQuery
.
of
(
context
).
padding
.
vertical
;
return
SizedBox
(
width:
fullWidth
,
...
...
lib/paginas/pantalla_records.dart
View file @
6c25f5e9
...
...
@@ -8,60 +8,52 @@ class PantallaRecords extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
// TODO: Cargar los récords (esto se haría con un archivo de texto en la carpeta privada de la aplicación)
final
records
=
<
PeponatorRecord
>[];
records
.
add
(
PeponatorRecord
(
jugador:
"AAA"
,
puntuacion:
12211350
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"BBB"
,
puntuacion:
25
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"CCC"
,
puntuacion:
13
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"DDD"
,
puntuacion:
7
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"EEE"
,
puntuacion:
6
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"FFF"
,
puntuacion:
5
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"GGG"
,
puntuacion:
4
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"HHH"
,
puntuacion:
3
,
fecha:
DateTime
.
now
()
));
return
OrientationBuilder
(
builder:
(
context
,
orientation
)
{
return
Scaffold
(
body:
SafeArea
(
child:
LayoutBuilder
(
builder:
(
context
,
constraints
)
{
if
(
orientation
==
Orientation
.
portrait
){
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
Container
(
_buildTitle
(
context
,
orientation
),
_buildRecordsView
(
context
,
orientation
)
],
);
}
else
{
return
Row
(
children:
[
SizedBox
(
height:
constraints
.
maxHeight
,
width:
constraints
.
maxWidth
/
4
,
child:
_buildTitle
(
context
,
orientation
),
),
SizedBox
(
height:
constraints
.
maxHeight
,
width:
constraints
.
maxWidth
*
3
/
4
,
child:
_buildRecordsView
(
context
,
orientation
),
)
],
);
}
}
)
),
floatingActionButton:
_buildFAB
(
context
,
orientation
),
);
});
}
Widget
_buildTitle
(
BuildContext
context
,
Orientation
orientation
){
return
Container
(
color:
Theme
.
of
(
context
).
colorScheme
.
primary
,
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
8.0
),
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
Text
(
...
...
@@ -84,9 +76,17 @@ class PantallaRecords extends StatelessWidget {
],
),
)
),
if
(
records
.
isNotEmpty
)
Expanded
(
);
}
Widget
_buildRecordsView
(
BuildContext
context
,
Orientation
orientation
){
final
records
=
_loadMockData
();
if
(
records
.
isNotEmpty
)
{
return
Expanded
(
child:
ListView
.
builder
(
shrinkWrap:
true
,
itemCount:
records
.
length
,
itemBuilder:
(
context
,
index
){
Color
c
=
Theme
.
of
(
context
).
colorScheme
.
inversePrimary
;
Color
?
t
=
Theme
.
of
(
context
).
textTheme
.
titleLarge
?.
color
;
...
...
@@ -164,11 +164,14 @@ class PantallaRecords extends StatelessWidget {
),
);
},
shrinkWrap:
true
,
itemCount:
records
.
length
,
)
)
else
Expanded
(
);
}
else
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
Expanded
(
child:
Center
(
child:
Text
(
'No hay ningún récord registrado de momento.
\n\n
¡Juega y registra el primero!'
,
...
...
@@ -176,14 +179,15 @@ class PantallaRecords extends StatelessWidget {
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
)
),
)
),
],
);
}
)
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
}
Widget
_buildFAB
(
BuildContext
context
,
Orientation
orientation
){
return
Align
(
alignment:
(
orientation
==
Orientation
.
portrait
)?
Alignment
.
bottomCenter
:
Alignment
.
bottomRight
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
32.0
),
child:
FloatingActionButton
.
extended
(
...
...
@@ -198,7 +202,10 @@ class PantallaRecords extends StatelessWidget {
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
)),
content:
Text
(
'Esta acción no se puede deshacer. ¿Seguro que quieres borrar todos los récords?'
,
(
orientation
==
Orientation
.
portrait
)?
'Esta acción no se puede deshacer. ¿Seguro que quieres borrar todos los récords?'
:
'Esta acción no se puede deshacer.
\n
¿Seguro que quieres borrar todos los récords?'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
,
),
...
...
@@ -206,6 +213,7 @@ class PantallaRecords extends StatelessWidget {
actions:
[
TextButton
(
onPressed:
()
{
// TODO: Borrar récords
Navigator
.
pop
(
context
);
},
style:
TextButton
.
styleFrom
(
...
...
@@ -214,11 +222,14 @@ class PantallaRecords extends StatelessWidget {
width:
2.0
)
),
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
'Sí'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
primary
),
),
)
),
TextButton
(
...
...
@@ -228,11 +239,14 @@ class PantallaRecords extends StatelessWidget {
style:
TextButton
.
styleFrom
(
backgroundColor:
Theme
.
of
(
context
).
colorScheme
.
primary
),
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
'No'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
onPrimary
),
),
)
)
],
...
...
@@ -249,7 +263,53 @@ class PantallaRecords extends StatelessWidget {
),
),
),
),
);
}
List
<
PeponatorRecord
>
_loadMockData
()
{
final
records
=
<
PeponatorRecord
>[];
records
.
add
(
PeponatorRecord
(
jugador:
"AAA"
,
puntuacion:
12211350
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"BBB"
,
puntuacion:
25
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"CCC"
,
puntuacion:
13
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"DDD"
,
puntuacion:
7
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"EEE"
,
puntuacion:
6
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"FFF"
,
puntuacion:
5
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"GGG"
,
puntuacion:
4
,
fecha:
DateTime
.
now
()
));
records
.
add
(
PeponatorRecord
(
jugador:
"HHH"
,
puntuacion:
3
,
fecha:
DateTime
.
now
()
));
return
records
;
}
}
\ 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