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
d45390bb
authored
May 12, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Continuando la l10n y mejorado el FAB de borrar récords
parent
0f078eea
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
275 additions
and
89 deletions
lib/l10n/app_en.arb
lib/l10n/app_es.arb
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_en.dart
lib/l10n/app_localizations_es.dart
lib/paginas/pantalla_juego.dart
lib/paginas/pantalla_records.dart
lib/peponator_app.dart
lib/widgets/pantalla_pausa.dart
lib/l10n/app_en.arb
View file @
d45390bb
...
...
@@ -34,5 +34,51 @@
},
"@reallyDeleteHiScores": {
"description": "Interrogates the user whether they are sure that they want to delete all of their Hi-Scores"
},
"yourGuess": "Your guess...",
"attempts": "Attempts",
"maximum": "Maximum",
"minimum": "Minimum",
"@yourGuess": {
"description": "Text that awaits user input for its guessed number"
},
"@attempts": {
"description": "Expression for the maximum number of mistakes that the user can make to guess the number"
},
"@maximum": {
"description": "Mathematical expression for the biggest possible number"
},
"@minimum": {
"description": "Mathematical expression for the smallest possible number"
},
"specialHints": "Special Hints",
"hintsWarning": "Be careful! Unlocking hints is penalized",
"evenOrOdd": "Is it even or odd?",
"divisible": "By which number is it divisible?",
"digitsSum": "What do its digits add up to?",
"digitsCount": "How many digits does it have?",
"pause": "Pause",
"resume": "Resume",
"changeHand": "Change hand",
"newGame": "New game",
"changeDifficulty": "Change difficulty",
"exitGame": "Exit game",
"@pause": {
"description": "Expression of the frozen state of a game"
},
"@resume": {
"description": "Text that refers to continuing the game from frozen state"
},
"@changeHand": {
"description": "Text that indicates the possibility of changing the dominant hand"
},
"@newGame": {
"description": "Text that refers to starting a new game"
},
"@changeDifficulty": {
"description": "Text that refers to choosing new configurations to make the game easier or harder"
},
"@exitGame": {
"description": "Text that refers to quitting the current game and returning to the main menu"
}
}
\ No newline at end of file
lib/l10n/app_es.arb
View file @
d45390bb
...
...
@@ -7,5 +7,15 @@
"playToRegister": "¡Juega y registra el primero!",
"deleteHighScores": "Borrar récords",
"noUndo": "Esta acción no se puede deshacer.",
"reallyDeleteHiScores": "¿Seguro que quieres borrar todos los récords?"
"reallyDeleteHiScores": "¿Seguro que quieres borrar todos los récords?",
"yourGuess": "Tu respuesta...",
"attempts": "Intentos",
"maximum": "Máximo",
"minimum": "Mínimo",
"pause": "Pausa",
"resume": "Reanudar",
"changeHand": "Cambiar de mano",
"newGame": "Nueva partida",
"changeDifficulty": "Cambiar dificultad",
"exitGame": "Terminar partida"
}
\ No newline at end of file
lib/l10n/app_localizations.dart
View file @
d45390bb
...
...
@@ -148,6 +148,66 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Do you really want to delete all Hi-Scores?'**
String
get
reallyDeleteHiScores
;
/// Text that awaits user input for its guessed number
///
/// In en, this message translates to:
/// **'Your guess...'**
String
get
yourGuess
;
/// Expression for the maximum number of mistakes that the user can make to guess the number
///
/// In en, this message translates to:
/// **'Attempts'**
String
get
attempts
;
/// Mathematical expression for the biggest possible number
///
/// In en, this message translates to:
/// **'Maximum'**
String
get
maximum
;
/// Mathematical expression for the smallest possible number
///
/// In en, this message translates to:
/// **'Minimum'**
String
get
minimum
;
/// Expression of the frozen state of a game
///
/// In en, this message translates to:
/// **'Pause'**
String
get
pause
;
/// Text that refers to continuing the game from frozen state
///
/// In en, this message translates to:
/// **'Resume'**
String
get
resume
;
/// Text that indicates the possibility of changing the dominant hand
///
/// In en, this message translates to:
/// **'Change hand'**
String
get
changeHand
;
/// Text that refers to starting a new game
///
/// In en, this message translates to:
/// **'New game'**
String
get
newGame
;
/// Text that refers to choosing new configurations to make the game easier or harder
///
/// In en, this message translates to:
/// **'Change difficulty'**
String
get
changeDifficulty
;
/// Text that refers to quitting the current game and returning to the main menu
///
/// In en, this message translates to:
/// **'Exit game'**
String
get
exitGame
;
}
class
_AppLocalizationsDelegate
extends
LocalizationsDelegate
<
AppLocalizations
>
{
...
...
lib/l10n/app_localizations_en.dart
View file @
d45390bb
...
...
@@ -34,4 +34,34 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String
get
reallyDeleteHiScores
=>
'Do you really want to delete all Hi-Scores?'
;
@override
String
get
yourGuess
=>
'Your guess...'
;
@override
String
get
attempts
=>
'Attempts'
;
@override
String
get
maximum
=>
'Maximum'
;
@override
String
get
minimum
=>
'Minimum'
;
@override
String
get
pause
=>
'Pause'
;
@override
String
get
resume
=>
'Resume'
;
@override
String
get
changeHand
=>
'Change hand'
;
@override
String
get
newGame
=>
'New game'
;
@override
String
get
changeDifficulty
=>
'Change difficulty'
;
@override
String
get
exitGame
=>
'Exit game'
;
}
lib/l10n/app_localizations_es.dart
View file @
d45390bb
...
...
@@ -34,4 +34,34 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String
get
reallyDeleteHiScores
=>
'¿Seguro que quieres borrar todos los récords?'
;
@override
String
get
yourGuess
=>
'Tu respuesta...'
;
@override
String
get
attempts
=>
'Intentos'
;
@override
String
get
maximum
=>
'Máximo'
;
@override
String
get
minimum
=>
'Mínimo'
;
@override
String
get
pause
=>
'Pausa'
;
@override
String
get
resume
=>
'Reanudar'
;
@override
String
get
changeHand
=>
'Cambiar de mano'
;
@override
String
get
newGame
=>
'Nueva partida'
;
@override
String
get
changeDifficulty
=>
'Cambiar dificultad'
;
@override
String
get
exitGame
=>
'Terminar partida'
;
}
lib/paginas/pantalla_juego.dart
View file @
d45390bb
...
...
@@ -3,6 +3,7 @@ import 'dart:convert';
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:peponator/l10n/app_localizations.dart'
;
import
'package:peponator/modelo/peponator_record.dart'
;
import
'package:peponator/modelo/pista.dart'
;
import
'package:peponator/paginas/paginas.dart'
;
...
...
@@ -480,7 +481,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
decoration:
InputDecoration
(
hintText:
'Tu respuesta...'
,
hintText:
AppLocalizations
.
of
(
context
)?.
yourGuess
??
'Tu respuesta...'
,
border:
OutlineInputBorder
(),
errorBorder:
OutlineInputBorder
(
borderSide:
BorderSide
(
...
...
@@ -512,7 +513,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
Text
(
'Intentos'
,
AppLocalizations
.
of
(
context
)?.
attempts
??
'Intentos'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
primary
,
...
...
@@ -551,7 +552,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
[
Text
(
'Máximo'
,
AppLocalizations
.
of
(
context
)?.
maximum
??
'Máximo'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Colors
.
red
,
...
...
@@ -637,7 +638,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
),
),
Text
(
'Mínimo'
,
AppLocalizations
.
of
(
context
)?.
minimum
??
'Mínimo'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
fontWeight:
FontWeight
.
w800
,
...
...
lib/paginas/pantalla_records.dart
View file @
d45390bb
...
...
@@ -110,7 +110,6 @@ class _PantallaRecordsState extends State<PantallaRecords> {
}
Widget
_buildRecordsView
(
BuildContext
context
,
Orientation
orientation
,
List
<
PeponatorRecord
>
records
){
records
.
add
(
new
PeponatorRecord
(
jugador:
"AAAAA"
,
puntuacion:
2000
,
fecha:
DateTime
.
now
()));
if
(
records
.
isNotEmpty
)
{
final
vistaRecords
=
ListView
.
builder
(
shrinkWrap:
true
,
...
...
@@ -228,83 +227,75 @@ class _PantallaRecordsState extends State<PantallaRecords> {
Widget
_buildFAB
(
BuildContext
context
,
Orientation
orientation
){
final
noUndo
=
AppLocalizations
.
of
(
context
)?.
noUndo
??
'Esta acción no se puede deshacer.'
;
final
reallyDeleteHiScores
=
AppLocalizations
.
of
(
context
)?.
reallyDeleteHiScores
??
'¿Seguro que quieres borrar todos los récords?'
;
return
Align
(
alignment:
(
orientation
==
Orientation
.
portrait
)?
Alignment
.
bottomCenter
:
Alignment
.
bottomRight
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
32.0
),
child:
FloatingActionButton
.
extended
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
context
)
{
return
AlertDialog
(
title:
Center
(
child:
Text
(
AppLocalizations
.
of
(
context
)?.
deleteHighScores
??
'Borrar récords'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
)),
content:
Text
(
(
orientation
==
Orientation
.
portrait
)?
'
$noUndo
$reallyDeleteHiScores
'
:
'
$noUndo
\n
$reallyDeleteHiScores
'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
,
),
actionsAlignment:
MainAxisAlignment
.
spaceAround
,
actions:
[
TextButton
(
onPressed:
()
{
_deleteRecords
();
Navigator
.
pop
(
context
);
},
style:
TextButton
.
styleFrom
(
side:
BorderSide
(
color:
Colors
.
grey
,
width:
2.0
)
),
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
AppLocalizations
.
of
(
context
)?.
yes
??
'Sí'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
primary
),
),
return
FloatingActionButton
(
onPressed:
()
{
showDialog
(
context:
context
,
builder:
(
context
)
{
return
AlertDialog
(
title:
Center
(
child:
Text
(
AppLocalizations
.
of
(
context
)?.
deleteHighScores
??
'Borrar récords'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
,
)),
content:
Text
(
(
orientation
==
Orientation
.
portrait
)?
'
$noUndo
$reallyDeleteHiScores
'
:
'
$noUndo
\n
$reallyDeleteHiScores
'
,
textAlign:
TextAlign
.
center
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
,
),
actionsAlignment:
MainAxisAlignment
.
spaceAround
,
actions:
[
TextButton
(
onPressed:
()
{
_deleteRecords
();
Navigator
.
pop
(
context
);
},
style:
TextButton
.
styleFrom
(
side:
BorderSide
(
color:
Colors
.
grey
,
width:
2.0
)
),
TextButton
(
onPressed:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
},
style:
TextButton
.
styleFrom
(
backgroundColor:
Theme
.
of
(
context
).
colorScheme
.
primary
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
AppLocalizations
.
of
(
context
)?.
yes
??
'Sí'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
primary
),
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
AppLocalizations
.
of
(
context
)?.
no
??
'No'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
onPrimary
),
),
)
),
)
],
);
}
);
},
backgroundColor:
Colors
.
red
,
label:
Text
(
AppLocalizations
.
of
(
context
)?.
deleteHighScores
??
'Borrar récords'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
?.
copyWith
(
color:
Colors
.
white
),
),
),
),
TextButton
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
style:
TextButton
.
styleFrom
(
backgroundColor:
Theme
.
of
(
context
).
colorScheme
.
primary
),
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
24.0
),
child:
Text
(
AppLocalizations
.
of
(
context
)?.
no
??
'No'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleMedium
?.
copyWith
(
color:
Theme
.
of
(
context
).
colorScheme
.
onPrimary
),
),
)
)
],
);
}
);
},
backgroundColor:
Colors
.
red
,
child:
Icon
(
Icons
.
delete_forever
,
color:
Colors
.
white
,
size:
36
,
),
);
}
...
...
lib/peponator_app.dart
View file @
d45390bb
...
...
@@ -19,7 +19,7 @@ class PeponatorApp extends StatelessWidget {
supportedLocales:
AppLocalizations
.
supportedLocales
,
darkTheme:
ThemeData
.
dark
(),
themeMode:
ThemeMode
.
system
,
home:
Pantalla
Records
(
)
home:
Pantalla
Juego
(
fromHome:
true
)
);
}
}
lib/widgets/pantalla_pausa.dart
View file @
d45390bb
import
'package:flutter/material.dart'
;
import
'package:peponator/l10n/app_localizations.dart'
;
class
PantallaPausa
extends
StatelessWidget
{
final
Orientation
orientacion
;
...
...
@@ -22,7 +23,7 @@ class PantallaPausa extends StatelessWidget {
return
SimpleDialog
(
alignment:
alignment
,
title:
Center
(
child:
Text
(
'Pausa'
,
AppLocalizations
.
of
(
context
)?.
pause
??
'Pausa'
,
style:
(
orientacion
==
Orientation
.
portrait
)?
Theme
.
of
(
context
).
textTheme
.
headlineLarge
:
Theme
.
of
(
context
).
textTheme
.
headlineSmall
,
...
...
@@ -47,7 +48,7 @@ class PantallaPausa extends StatelessWidget {
size:
32.0
),
label:
Text
(
element
.
text
,
element
.
getText
(
context
)
,
style:
Theme
.
of
(
context
).
textTheme
.
titleLarge
?.
copyWith
(
fontWeight:
(
Theme
.
of
(
context
).
brightness
==
Brightness
.
light
)?
null
:
FontWeight
.
bold
,
color:
element
.
getColor
(
Theme
.
of
(
context
).
brightness
)
??
Theme
.
of
(
context
).
colorScheme
.
primary
...
...
@@ -61,16 +62,15 @@ class PantallaPausa extends StatelessWidget {
}
enum
OpcionPausa
{
reanudar
(
Icons
.
play_arrow_outlined
,
"Reanudar"
),
cambioMano
(
Icons
.
front_hand_outlined
,
"Cambiar de mano"
),
nuevaPartida
(
Icons
.
refresh
,
"Nueva partida"
),
cambiarDificultad
(
Icons
.
settings_outlined
,
"Cambiar dificultad"
),
salir
(
Icons
.
logout
,
"Terminar partida"
);
reanudar
(
Icons
.
play_arrow_outlined
),
cambioMano
(
Icons
.
front_hand_outlined
),
nuevaPartida
(
Icons
.
refresh
),
cambiarDificultad
(
Icons
.
settings_outlined
),
salir
(
Icons
.
logout
);
final
IconData
icon
;
final
String
text
;
const
OpcionPausa
(
this
.
icon
,
this
.
text
);
const
OpcionPausa
(
this
.
icon
);
Color
?
getColor
(
Brightness
brillo
)
{
switch
(
this
){
...
...
@@ -88,4 +88,19 @@ enum OpcionPausa {
return
null
;
}
}
String
getText
(
BuildContext
context
)
{
switch
(
this
){
case
OpcionPausa
.
reanudar
:
return
AppLocalizations
.
of
(
context
)?.
resume
??
'Reanudar'
;
case
OpcionPausa
.
cambioMano
:
return
AppLocalizations
.
of
(
context
)?.
changeHand
??
'Cambiar de mano'
;
case
OpcionPausa
.
nuevaPartida
:
return
AppLocalizations
.
of
(
context
)?.
newGame
??
'Nueva partida'
;
case
OpcionPausa
.
cambiarDificultad
:
return
AppLocalizations
.
of
(
context
)?.
changeDifficulty
??
'Cambiar dificultad'
;
case
OpcionPausa
.
salir
:
return
AppLocalizations
.
of
(
context
)?.
exitGame
??
'Terminar partida'
;
}
}
}
\ 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