Marco
c213d9b1f3
Now the client considers the position sent by the server to build the position on the board.
62 lines
1.5 KiB
Dart
62 lines
1.5 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: [
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
_dialogBuilder(context);
|
|
},
|
|
child: const Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.lock),
|
|
SizedBox(
|
|
width: 10,
|
|
),
|
|
Text('Private game')
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
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');
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|