Restructure app. Change design.
This commit is contained in:
parent
4626084abd
commit
d1ba004ebb
@ -13,15 +13,12 @@ class ChessApp extends StatelessWidget {
|
||||
create: (_) => ConnectionCubit.getInstance(),
|
||||
child: BlocProvider(
|
||||
create: (_) => ChessBloc.getInstance(),
|
||||
child: Container(
|
||||
color: Colors.amber,
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: MaterialApp.router(
|
||||
theme: ThemeData.dark(useMaterial3: true),
|
||||
routerConfig: router,
|
||||
title: 'mChess v0.1.1337',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:mchess/chess_bloc/chess_bloc.dart';
|
||||
|
||||
import 'package:mchess/chess/chess_board.dart';
|
||||
import 'package:mchess/chess/turn_indicator_widget.dart';
|
||||
import 'package:mchess/connection_cubit/connection_cubit.dart';
|
||||
|
||||
import 'package:mchess/connection/ws_connection.dart';
|
||||
import 'package:mchess/utils/widgets/server_log_widget.dart';
|
||||
|
||||
class ChessApp extends StatelessWidget {
|
||||
const ChessApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (_) => ConnectionCubit.getInstance(),
|
||||
child: BlocProvider(
|
||||
create: (_) => ChessBloc.getInstance(),
|
||||
child: MaterialApp(
|
||||
title: 'mChess v0.1.1337',
|
||||
home: Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color.fromARGB(255, 20, 20, 20),
|
||||
Color.fromARGB(255, 30, 30, 30),
|
||||
Color.fromARGB(255, 40, 40, 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: Row(
|
||||
children: [
|
||||
if (kDebugMode)
|
||||
StreamBuilder(
|
||||
stream: ServerConnection.getInstance().broadcast,
|
||||
builder: (context, snapshot) {
|
||||
return ServerLogWidget(
|
||||
snapshot.data ?? "<snapshot empty>",
|
||||
textColor: Colors.white,
|
||||
);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: BlocBuilder<ChessBloc, ChessBoardState>(
|
||||
builder: (context, state) {
|
||||
return ChessBoard(
|
||||
bState: state,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
if (kDebugMode) const TurnIndicator(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
ConnectionCubit.getInstance().reconnect();
|
||||
},
|
||||
child: const Icon(Icons.network_wifi),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -16,19 +16,7 @@ class ChessGame extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color.fromARGB(255, 20, 20, 20),
|
||||
Color.fromARGB(255, 30, 30, 30),
|
||||
Color.fromARGB(255, 40, 40, 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
body: Center(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: Row(
|
||||
@ -56,7 +44,7 @@ class ChessGame extends StatelessWidget {
|
||||
if (kDebugMode) const TurnIndicator(),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
|
@ -6,14 +6,13 @@ class LobbySelector extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
return Scaffold(
|
||||
body: TextButton(
|
||||
onPressed: () {
|
||||
context.go("/play");
|
||||
context.push("/play");
|
||||
},
|
||||
child: const Text('Random lobby'),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user