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/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,11 +26,13 @@ class ChessApp extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: FittedBox(
|
child: Column(
|
||||||
fit: BoxFit.contain,
|
children: [
|
||||||
child: Container(
|
FittedBox(
|
||||||
margin: const EdgeInsets.all(20),
|
fit: BoxFit.contain,
|
||||||
child: BlocProvider(
|
child: Container(
|
||||||
|
margin: const EdgeInsets.all(20),
|
||||||
|
child: BlocProvider(
|
||||||
create: (_) => ChessBloc.getInstance(),
|
create: (_) => ChessBloc.getInstance(),
|
||||||
child: BlocBuilder<ChessBloc, ChessBoardState>(
|
child: BlocBuilder<ChessBloc, ChessBoardState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
@ -37,10 +40,20 @@ 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());
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user