81 lines
2.1 KiB
Dart
81 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class LobbySelector extends StatelessWidget {
|
|
const LobbySelector({super.key});
|
|
|
|
final buttonStyle = const ButtonStyle();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
//We deactivate random lobbies for now.
|
|
// ElevatedButton(
|
|
// onPressed: () {
|
|
// context.push('/prepareRandom');
|
|
// },
|
|
// child: const Row(
|
|
// mainAxisSize: MainAxisSize.min,
|
|
// children: [
|
|
// Icon(Icons.question_mark),
|
|
// SizedBox(
|
|
// width: 10,
|
|
// ),
|
|
// Text('Random')
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// const SizedBox(
|
|
// height: 25,
|
|
// ),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
_dialogBuilder(context);
|
|
},
|
|
child: const Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.lock),
|
|
SizedBox(
|
|
width: 10,
|
|
),
|
|
Text('Private')
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
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');
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|