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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mchess/chess_bloc/chess_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 { class ChessApp extends StatelessWidget {
const ChessApp({super.key}); const ChessApp({super.key});
@ -25,7 +26,9 @@ class ChessApp extends StatelessWidget {
), ),
), ),
child: Center( child: Center(
child: FittedBox( child: Column(
children: [
FittedBox(
fit: BoxFit.contain, fit: BoxFit.contain,
child: Container( child: Container(
margin: const EdgeInsets.all(20), margin: const EdgeInsets.all(20),
@ -37,12 +40,22 @@ class ChessApp extends StatelessWidget {
bState: state, 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._( const ChessSquare._(
{required this.coordinate, {required this.coordinate,
required this.containedPiece, required this.containedPiece,
required this.color, required this.color});
super.key});
factory ChessSquare(ChessCoordinate coord, ChessPiece? piece) { factory ChessSquare(ChessCoordinate coord, ChessPiece? piece) {
Color lightSquares = Colors.brown.shade50; Color lightSquares = Colors.brown.shade50;