Only show turn indicator and server output when in debug mode.

This commit is contained in:
Marco 2022-12-22 00:00:35 +01:00
parent 0b7c3897e5
commit 0356268b32

View File

@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
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';
@ -19,7 +20,7 @@ class ChessApp extends StatelessWidget {
child: BlocProvider( child: BlocProvider(
create: (_) => ChessBloc.getInstance(), create: (_) => ChessBloc.getInstance(),
child: MaterialApp( child: MaterialApp(
title: 'mChess v0.1.20', title: 'mChess v0.1.1337',
home: Scaffold( home: Scaffold(
body: Container( body: Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
@ -38,15 +39,16 @@ class ChessApp extends StatelessWidget {
fit: BoxFit.contain, fit: BoxFit.contain,
child: Row( child: Row(
children: [ children: [
StreamBuilder( if (kDebugMode)
stream: ServerConnection.getInstance().broadcast, StreamBuilder(
builder: (context, snapshot) { stream: ServerConnection.getInstance().broadcast,
return ServerLogWidget( builder: (context, snapshot) {
snapshot.data ?? "<snapshot empty>", return ServerLogWidget(
textColor: Colors.white, snapshot.data ?? "<snapshot empty>",
); textColor: Colors.white,
}, );
), },
),
Container( Container(
margin: const EdgeInsets.all(20), margin: const EdgeInsets.all(20),
child: BlocBuilder<ChessBloc, ChessBoardState>( child: BlocBuilder<ChessBloc, ChessBoardState>(
@ -57,7 +59,7 @@ class ChessApp extends StatelessWidget {
}, },
), ),
), ),
const TurnIndicator(), if (kDebugMode) const TurnIndicator(),
], ],
), ),
)), )),