Show server response in main window for debugging purpose.
This commit is contained in:
parent
ce63a3e483
commit
75727980a7
@ -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,11 +26,13 @@ class ChessApp extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: BlocProvider(
|
||||
child: Column(
|
||||
children: [
|
||||
FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(20),
|
||||
child: BlocProvider(
|
||||
create: (_) => ChessBloc.getInstance(),
|
||||
child: BlocBuilder<ChessBloc, ChessBoardState>(
|
||||
builder: (context, state) {
|
||||
@ -37,10 +40,20 @@ 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());
|
||||
},
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user