Skip to content
Snippets Groups Projects
Select Git revision
  • 4da2da61a5fc522a27ba6930bae9c0c451ed9feb
  • master default protected
  • 101-add-shader-test-page
  • 65-improve-app-metadata
  • Release_1.8.2_82 protected
  • Release_1.8.1_81 protected
  • Release_1.8.0_80 protected
  • Release_1.7.2_79 protected
  • Release_1.7.1_78 protected
  • Release_1.7.0_77 protected
  • Release_1.6.0_76 protected
  • Release_1.5.0_75 protected
  • Release_1.4.0_74 protected
  • Release_1.3.2_73 protected
  • Release_1.3.1_72 protected
  • Release_1.3.0_71 protected
  • Release_1.2.1_70 protected
  • Release_1.2.0_69 protected
  • Release_1.1.3_68 protected
  • Release_1.1.2_67 protected
  • Release_1.1.1_66 protected
  • Release_1.1.0_65 protected
  • Release_1.0.63_64 protected
  • Release_1.0.62_63 protected
24 results

contents.xcworkspacedata

Blame
  • game_board.dart 6.18 KiB
    import 'package:flutter/material.dart';
    import 'package:flutter_bloc/flutter_bloc.dart';
    
    import 'package:awale/cubit/game_cubit.dart';
    import 'package:awale/models/game/game.dart';
    import 'package:awale/ui/widgets/game/game_house.dart';
    import 'package:awale/ui/widgets/game/game_player.dart';
    import 'package:awale/ui/widgets/game/game_score.dart';
    
    class GameBoardWidget extends StatelessWidget {
      const GameBoardWidget({super.key});
    
      @override
      Widget build(BuildContext context) {
        return Center(
          child: BlocBuilder<GameCubit, GameState>(
            builder: (BuildContext context, GameState gameState) {
              final Game currentGame = gameState.currentGame;
              final Color borderColor = Theme.of(context).colorScheme.onSurface;
    
              var screenSize = MediaQuery.of(context).size;
    
              const totalMargins = 9 * 4;
              final availableHeight = screenSize.height - totalMargins;
    
              final double houseHeight = availableHeight / 10;
              final double houseWidth = houseHeight;
    
              return Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  currentGame.isFinished
                      ? const SizedBox.shrink()
                      : SizedBox(
                          width: houseWidth,
                          height: houseHeight,
                          child: const GamePlayerWidget(playerIndex: 0),
                        ),
                  Container(
                    margin: const EdgeInsets.all(2),
                    padding: const EdgeInsets.all(2),
                    decoration: BoxDecoration(
                      color: borderColor,
                      borderRadius: BorderRadius.circular(40),
                      border: Border.all(
                        color: borderColor,
                        width: 6,
                      ),
                    ),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        SizedBox(
                          width: 2 * houseWidth,
                          height: houseHeight,
                          child: const GameScoreWidget(playerIndex: 1),
                        ),
                        Table(
                          defaultColumnWidth: const IntrinsicColumnWidth(),
                          children: [
                            TableRow(children: [
                              SizedBox(
                                width: houseWidth,
                                height: houseHeight,
                                child: const GameHouseWidget(cellIndex: 0),
                              ),
                              SizedBox(
                                width: houseWidth,