mchess-client/lib/pages/lobby_selector.dart

62 lines
1.5 KiB
Dart
Raw Normal View History

2022-12-25 15:16:23 +00:00
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class LobbySelector extends StatelessWidget {
const LobbySelector({super.key});
2023-06-29 23:49:18 +00:00
final buttonStyle = const ButtonStyle();
2022-12-25 15:16:23 +00:00
@override
Widget build(BuildContext context) {
2022-12-25 19:18:50 +00:00
return Scaffold(
2023-06-08 15:10:48 +00:00
body: Center(
2023-06-29 23:49:18 +00:00
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
_dialogBuilder(context);
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.lock),
SizedBox(
width: 10,
),
Text('Private game')
2023-06-29 23:49:18 +00:00
],
),
),
],
2023-06-08 15:10:48 +00:00
),
2022-12-25 19:18:50 +00:00
),
2022-12-25 15:16:23 +00:00
);
}
2023-06-29 23:49:18 +00:00
Future<void> _dialogBuilder(BuildContext context) {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Host or join?'),
actions: <Widget>[
TextButton(
child: const Text('Host'),
onPressed: () {
context.push('/host');
},
),
TextButton(
child: const Text('Join'),
onPressed: () {
context.push('/join');
},
),
],
);
},
);
}
2022-12-25 15:16:23 +00:00
}