Página principal finalizada

parent b77ddffa
......@@ -225,7 +225,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
_cambiarDificultadPausa();
break;
case OpcionPausa.salir:
// TODO: Handle this case.
Navigator.pop(context);
break;
}
},
......@@ -871,8 +871,7 @@ class _PantallaJuegoState extends State<PantallaJuego>
onPressed = _cambiarDificultadFin;
break;
case OpcionesFinPartida.salir:
// TODO: Handle this case.
onPressed = () { };
onPressed = () => Navigator.pop(context);
break;
}
......
......@@ -7,39 +7,96 @@ class PantallaPrincipal extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: [
TextButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaJuego()
)
),
child: Text('Jugar')
),
TextButton(
onPressed: () =>
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaDificultad()
)
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/fondo.jpg'),
fit: BoxFit.fill
)
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
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(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaJuego()
)
),
style: TextButton.styleFrom(
backgroundColor: Color.fromARGB(255, 0, 125, 0),
),
child: Text(
'Jugar',
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
color: Colors.white
),
)
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
onPressed: () =>
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaDificultad()
)
),
style: TextButton.styleFrom(
backgroundColor: Colors.blueAccent.shade700,
),
child: Text(
'Dificultad',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.white
),
)
),
),
TextButton(
onPressed: () =>
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaRecords()
)
),
style: TextButton.styleFrom(
backgroundColor: Color.fromARGB(255, 213, 0, 0),
),
child: Text(
'Récords',
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.white
),
)
),
],
),
child: Text('Dificultad')
),
TextButton(
onPressed: () =>
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => PantallaRecords()
)
),
child: Text('Récords')
),
],
),
),
const Padding(padding: EdgeInsets.only(bottom: 150.0))
],
),
),
);
}
......
......@@ -6,6 +6,7 @@ import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
import 'package:peponator/modelo/modelo.dart';
import 'package:peponator/l10n/app_localizations.dart';
import 'package:shared_preferences/shared_preferences.dart';
class PantallaRecords extends StatefulWidget {
static const int maxRecords = 20;
......@@ -27,6 +28,14 @@ class PantallaRecords extends StatefulWidget {
}
class _PantallaRecordsState extends State<PantallaRecords> {
bool? manoDerecha;
@override
void initState() {
super.initState();
_loadManoPreferida();
}
@override
Widget build(BuildContext context) {
return OrientationBuilder(builder: (context, orientation) {
......@@ -39,28 +48,92 @@ class _PantallaRecordsState extends State<PantallaRecords> {
return LayoutBuilder(
builder: (context, constraints) {
if(orientation == Orientation.portrait){
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
return Stack(
children: [
_buildTitle(context, orientation),
_buildRecordsView(context, orientation, snapshot.requireData)
],
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildTitle(context, orientation),
_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{
return Row(
return Stack(
children: [
SizedBox(
height: constraints.maxHeight,
width: constraints.maxWidth/4,
child: _buildTitle(context, orientation),
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, 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,
)
)
),
SizedBox(
height: constraints.maxHeight,
width: constraints.maxWidth*3/4,
child: _buildRecordsView(context, orientation, snapshot.requireData),
)
],
]
);
}
}
......@@ -324,4 +397,9 @@ class _PantallaRecordsState extends State<PantallaRecords> {
}
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 {
flex: 20,
child: ClipRRect(
borderRadius: BorderRadius.circular(50.0), //add border radius
child: Image.network(
"https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg",
child: Image(
image: AssetImage('assets/Peponator.png'),
height: 80.0,
width: 80.0,
fit:BoxFit.cover,
......
......@@ -67,6 +67,9 @@ flutter:
# Enables generation of localized YAML files
generate: true
assets:
- assets/
# To add assets to your application, add an assets section, like this:
# assets:
# - 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