Show server response in main window for debugging purpose.

This commit is contained in:
Marco 2022-11-13 14:28:30 +01:00
parent ce63a3e483
commit 75727980a7
2 changed files with 23 additions and 11 deletions

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mchess/chess_bloc/chess_bloc.dart';
import 'package:mchess/connection/ws_connection.dart';
import 'chess_board.dart';
import 'package:mchess/chessapp/chess_board.dart';
class ChessApp extends StatelessWidget {
const ChessApp({super.key});
@ -25,7 +26,9 @@ class ChessApp extends StatelessWidget {
),
),
child: Center(
child: FittedBox(
child: Column(
children: [
FittedBox(
fit: BoxFit.contain,
child: Container(
margin: const EdgeInsets.all(20),
@ -37,12 +40,22 @@ class ChessApp extends StatelessWidget {
bState: state,
);
},
),
),
),
),
StreamBuilder(
stream: ServerConnection.getInstance().channel.stream,
builder: (context, snapshot) {
return Text(
style: const TextStyle(color: Colors.white),
snapshot.data.toString());
},
)
],
)),
),
),
),
),
),
);
}
}

View File

@ -17,8 +17,7 @@ class ChessSquare extends StatelessWidget {
const ChessSquare._(
{required this.coordinate,
required this.containedPiece,
required this.color,
super.key});
required this.color});
factory ChessSquare(ChessCoordinate coord, ChessPiece? piece) {
Color lightSquares = Colors.brown.shade50;