gameBox method

Container gameBox(
  1. BuildContext context,
  2. GameData gameData
)

Implementation

Container gameBox(BuildContext context, GameData gameData) {
  return Container(
    width: defaultWidth * 0.7,
    margin: EdgeInsets.only(bottom: defaultWidth * 0.05),
    padding: EdgeInsets.all(defaultWidth * 0.05),
    decoration: BoxDecoration(
        color: Theme.of(context).colorScheme.background,
        borderRadius: const BorderRadius.all(Radius.circular(15)),
        border: Border.all(
          color: Theme.of(context).colorScheme.primary,
          width: 1.25,
        )),
    child: Column(
      children: [
        Text(
          convertirFecha(gameData.createdAt),
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 17,
            color: Theme.of(context).colorScheme.primary,
          ),
        ),
        SizedBox(height: defaultWidth * 0.05),
        Text(
          gameData.gameType,
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 17,
            color: Theme.of(context).colorScheme.primary,
          ),
        ),
        SizedBox(height: defaultWidth * 0.05),
        if (gameData.winner == "Empate") ...[
          const Text(
            "¡Has empatado!",
            textAlign: TextAlign.center,
            overflow: TextOverflow.visible,
            style: TextStyle(
              fontSize: 19,
              fontWeight: FontWeight.bold,
              color: Colors.orange,
            ),
          ),
        ] else if (gameData.winner == "LIGHT" &&
                gameData.lightPlayer == userData.id ||
            gameData.winner == "DARK" &&
                gameData.darkPlayer == userData.id) ...[
          const Text(
            "¡Has ganado!",
            textAlign: TextAlign.center,
            overflow: TextOverflow.visible,
            style: TextStyle(
              fontSize: 19,
              fontWeight: FontWeight.bold,
              color: Colors.green,
            ),
          ),
        ] else ...[
          const Text(
            "¡Has perdido!",
            textAlign: TextAlign.center,
            overflow: TextOverflow.visible,
            style: TextStyle(
              fontSize: 19,
              fontWeight: FontWeight.bold,
              color: Colors.red,
            ),
          ),
        ]
      ],
    ),
  );
}