Skip to content
Snippets Groups Projects
Select Git revision
  • 0427bf266bc60c797a9dab10fd6b1ec3e26c97dd
  • master default protected
  • 22-improve-app-metadata
  • 9-improve-layout-and-graphics
  • Release_0.9.1_35 protected
  • Release_0.9.0_34 protected
  • Release_0.8.2_33 protected
  • Release_0.8.1_32 protected
  • Release_0.8.0_31 protected
  • Release_0.7.0_30 protected
  • Release_0.6.0_29 protected
  • Release_0.5.0_28 protected
  • Release_0.4.2_27 protected
  • Release_0.4.1_26 protected
  • Release_0.4.0_25 protected
  • Release_0.3.1_24 protected
  • Release_0.3.0_23 protected
  • Release_0.2.1_22 protected
  • Release_0.2.0_21 protected
  • Release_0.1.1_20 protected
  • Release_0.1.0_19 protected
  • Release_0.0.18_18 protected
  • Release_0.0.17_17 protected
  • Release_0.0.16_16 protected
24 results

global_app_bar.dart

Blame
  • game_bottom.dart 1.56 KiB
    import 'package:flutter/material.dart';
    import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
    
    import 'package:memory/cubit/game_cubit.dart';
    import 'package:memory/models/game/game.dart';
    
    class GameBottomWidget extends StatelessWidget {
      const GameBottomWidget({super.key});
    
      @override
      Widget build(BuildContext context) {
        return BlocBuilder<GameCubit, GameState>(
          builder: (BuildContext context, GameState gameState) {
            final Game currentGame = gameState.currentGame;
    
            const Color borderColor = Colors.grey;
            final int values = currentGame.board.tiles.length ~/ 2;
    
            List<Widget> items = [];
            for (int value = 1; value <= values; value++) {
              final String assetName =
                  'assets/skins/${currentGame.globalSettings.skin}_${currentGame.pairsFound.contains(value) ? value.toString() : 'unknown'}.png';
              items.add(Padding(
                padding: const EdgeInsets.all(2),
                child: Image(
                  image: AssetImage(assetName),
                ),
              ));
            }
    
            return Container(
              margin: const EdgeInsets.all(2),
              padding: const EdgeInsets.all(2),
              decoration: BoxDecoration(
                color: borderColor,
                borderRadius: BorderRadius.circular(2),
                border: Border.all(
                  color: borderColor,
                  width: 2,
                ),
              ),
              child: Table(
                children: [
                  TableRow(
                    children: items,
                  ),
                ],
              ),
            );
          },
        );
      }
    }