Página principal finalizada

parent b77ddffa
...@@ -225,7 +225,7 @@ class _PantallaJuegoState extends State<PantallaJuego> ...@@ -225,7 +225,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
_cambiarDificultadPausa(); _cambiarDificultadPausa();
break; break;
case OpcionPausa.salir: case OpcionPausa.salir:
// TODO: Handle this case. Navigator.pop(context);
break; break;
} }
}, },
...@@ -871,8 +871,7 @@ class _PantallaJuegoState extends State<PantallaJuego> ...@@ -871,8 +871,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
onPressed = _cambiarDificultadFin; onPressed = _cambiarDificultadFin;
break; break;
case OpcionesFinPartida.salir: case OpcionesFinPartida.salir:
// TODO: Handle this case. onPressed = () => Navigator.pop(context);
onPressed = () { };
break; break;
} }
......
...@@ -7,19 +7,53 @@ class PantallaPrincipal extends StatelessWidget { ...@@ -7,19 +7,53 @@ class PantallaPrincipal extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/fondo.jpg'),
fit: BoxFit.fill
)
),
child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
TextButton( Padding(
padding: const EdgeInsets.all(48.0),
child: Image(
image: AssetImage('assets/logo.png')
),
),
Container(
color: Color.fromARGB(200, 0, 0, 0),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0),
child: TextButton(
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => PantallaJuego() builder: (BuildContext context) => PantallaJuego()
) )
), ),
child: Text('Jugar') style: TextButton.styleFrom(
backgroundColor: Color.fromARGB(255, 0, 125, 0),
), ),
TextButton( child: Text(
'Jugar',
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
color: Colors.white
),
)
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
onPressed: () => onPressed: () =>
Navigator.push( Navigator.push(
context, context,
...@@ -27,7 +61,16 @@ class PantallaPrincipal extends StatelessWidget { ...@@ -27,7 +61,16 @@ class PantallaPrincipal extends StatelessWidget {
builder: (BuildContext context) => PantallaDificultad() builder: (BuildContext context) => PantallaDificultad()
) )
), ),
child: Text('Dificultad') style: TextButton.styleFrom(
backgroundColor: Colors.blueAccent.shade700,
),
child: Text(
'Dificultad',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.white
),
)
),
), ),
TextButton( TextButton(
onPressed: () => onPressed: () =>
...@@ -37,10 +80,24 @@ class PantallaPrincipal extends StatelessWidget { ...@@ -37,10 +80,24 @@ class PantallaPrincipal extends StatelessWidget {
builder: (BuildContext context) => PantallaRecords() builder: (BuildContext context) => PantallaRecords()
) )
), ),
child: Text('Récords') style: TextButton.styleFrom(
backgroundColor: Color.fromARGB(255, 213, 0, 0),
),
child: Text(
'Récords',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.white
),
)
),
],
),
),
), ),
const Padding(padding: EdgeInsets.only(bottom: 150.0))
], ],
), ),
),
); );
} }
} }
...@@ -6,6 +6,7 @@ import 'package:intl/intl.dart'; ...@@ -6,6 +6,7 @@ import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:peponator/modelo/modelo.dart'; import 'package:peponator/modelo/modelo.dart';
import 'package:peponator/l10n/app_localizations.dart'; import 'package:peponator/l10n/app_localizations.dart';
import 'package:shared_preferences/shared_preferences.dart';
class PantallaRecords extends StatefulWidget { class PantallaRecords extends StatefulWidget {
static const int maxRecords = 20; static const int maxRecords = 20;
...@@ -27,6 +28,14 @@ class PantallaRecords extends StatefulWidget { ...@@ -27,6 +28,14 @@ class PantallaRecords extends StatefulWidget {
} }
class _PantallaRecordsState extends State<PantallaRecords> { class _PantallaRecordsState extends State<PantallaRecords> {
bool? manoDerecha;
@override
void initState() {
super.initState();
_loadManoPreferida();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return OrientationBuilder(builder: (context, orientation) { return OrientationBuilder(builder: (context, orientation) {
...@@ -39,16 +48,50 @@ class _PantallaRecordsState extends State<PantallaRecords> { ...@@ -39,16 +48,50 @@ class _PantallaRecordsState extends State<PantallaRecords> {
return LayoutBuilder( return LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
if(orientation == Orientation.portrait){ if(orientation == Orientation.portrait){
return Column( return Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
_buildTitle(context, orientation), _buildTitle(context, orientation),
_buildRecordsView(context, orientation, snapshot.requireData) _buildRecordsView(context, orientation, snapshot.requireData)
], ],
),
Positioned(
top: 0,
left: 10,
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
style: ButtonStyle(
elevation: WidgetStatePropertyAll<double>(5.0),
shape: WidgetStatePropertyAll<OutlinedBorder>(CircleBorder()),
padding: WidgetStatePropertyAll<EdgeInsets>(
EdgeInsets.all(16.0)
),
side: WidgetStatePropertyAll<BorderSide>(
BorderSide(
width: 2.0,
color: (Theme.of(context).brightness == Brightness.light)?
Colors.black12 :
Colors.grey.shade400,
)
)
),
child: Icon(
Icons.arrow_back,
size: 28.0,
)
)
),
]
); );
} }
else{ else{
return Row( return Stack(
children: [
Row(
children: [ children: [
SizedBox( SizedBox(
height: constraints.maxHeight, height: constraints.maxHeight,
...@@ -61,6 +104,36 @@ class _PantallaRecordsState extends State<PantallaRecords> { ...@@ -61,6 +104,36 @@ class _PantallaRecordsState extends State<PantallaRecords> {
child: _buildRecordsView(context, orientation, snapshot.requireData), child: _buildRecordsView(context, orientation, snapshot.requireData),
) )
], ],
),
Positioned(
top: 0,
left: 10,
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
style: ButtonStyle(
elevation: WidgetStatePropertyAll<double>(5.0),
shape: WidgetStatePropertyAll<OutlinedBorder>(CircleBorder()),
padding: WidgetStatePropertyAll<EdgeInsets>(
EdgeInsets.all(16.0)
),
side: WidgetStatePropertyAll<BorderSide>(
BorderSide(
width: 2.0,
color: (Theme.of(context).brightness == Brightness.light)?
Colors.black12 :
Colors.grey.shade400,
)
)
),
child: Icon(
Icons.arrow_back,
size: 28.0,
)
)
),
]
); );
} }
} }
...@@ -324,4 +397,9 @@ class _PantallaRecordsState extends State<PantallaRecords> { ...@@ -324,4 +397,9 @@ class _PantallaRecordsState extends State<PantallaRecords> {
} }
setState(() {}); setState(() {});
} }
Future<void> _loadManoPreferida() async {
final p = await SharedPreferences.getInstance();
manoDerecha = await p.getBool('manoDerecha');
}
} }
\ No newline at end of file
...@@ -20,8 +20,8 @@ class PeponatorMensaje extends StatelessWidget { ...@@ -20,8 +20,8 @@ class PeponatorMensaje extends StatelessWidget {
flex: 20, flex: 20,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(50.0), //add border radius borderRadius: BorderRadius.circular(50.0), //add border radius
child: Image.network( child: Image(
"https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg", image: AssetImage('assets/Peponator.png'),
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
fit:BoxFit.cover, fit:BoxFit.cover,
......
...@@ -67,6 +67,9 @@ flutter: ...@@ -67,6 +67,9 @@ flutter:
# Enables generation of localized YAML files # Enables generation of localized YAML files
generate: true generate: true
assets:
- assets/
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
# - images/a_dot_burr.jpeg # - images/a_dot_burr.jpeg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment