Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 23-add-timer
  • 65-update-icons
  • 82-fix-colors
  • 84-improve-app-metadata
  • master
  • Release_0.0.16_16
  • Release_0.0.17_17
  • Release_0.0.18_18
  • Release_0.0.19_19
  • Release_0.0.20_20
  • Release_0.0.21_21
  • Release_0.0.22_22
  • Release_0.0.23_23
  • Release_0.0.24_24
  • Release_0.0.25_25
  • Release_0.0.26_26
  • Release_0.0.27_27
  • Release_0.0.28_28
  • Release_0.0.29_29
  • Release_0.0.30_30
  • Release_0.0.31_31
  • Release_0.0.32_32
  • Release_0.0.33_33
  • Release_0.0.34_34
  • Release_0.0.35_35
  • Release_0.0.36_36
  • Release_0.0.37_37
  • Release_0.0.38_38
  • Release_0.0.39_39
  • Release_0.0.40_40
  • Release_0.0.41_41
  • Release_0.0.42_42
  • Release_0.0.43_43
  • Release_0.0.44_44
  • Release_0.0.45_45
  • Release_0.0.46_46
  • Release_0.0.47_47
  • Release_0.0.48_48
  • Release_0.1.0_49
  • Release_0.1.10_59
  • Release_0.1.11_60
  • Release_0.1.12_61
  • Release_0.1.13_62
  • Release_0.1.14_63
  • Release_0.1.15_64
  • Release_0.1.16_65
  • Release_0.1.17_66
  • Release_0.1.18_67
  • Release_0.1.19_68
  • Release_0.1.1_50
  • Release_0.1.20_69
  • Release_0.1.21_70
  • Release_0.1.22_71
  • Release_0.1.2_51
  • Release_0.1.3_52
  • Release_0.1.4_53
  • Release_0.1.5_54
  • Release_0.1.6_55
  • Release_0.1.7_56
  • Release_0.1.8_57
  • Release_0.1.9_58
  • Release_0.10.0_87
  • Release_0.10.1_88
  • Release_0.10.2_89
  • Release_0.10.3_90
  • Release_0.10.4_91
  • Release_0.2.0_72
  • Release_0.2.1_73
  • Release_0.3.0_74
  • Release_0.3.1_75
  • Release_0.4.0_76
  • Release_0.4.1_77
  • Release_0.5.0_78
  • Release_0.5.1_79
  • Release_0.5.2_80
  • Release_0.6.0_81
  • Release_0.7.0_82
  • Release_0.8.0_83
  • Release_0.9.0_84
  • Release_0.9.1_85
  • Release_0.9.2_86
81 results

Target

Select target project
No results found
Select Git revision
  • 23-add-timer
  • 65-update-icons
  • 82-fix-colors
  • 84-improve-app-metadata
  • master
  • Release_0.0.16_16
  • Release_0.0.17_17
  • Release_0.0.18_18
  • Release_0.0.19_19
  • Release_0.0.20_20
  • Release_0.0.21_21
  • Release_0.0.22_22
  • Release_0.0.23_23
  • Release_0.0.24_24
  • Release_0.0.25_25
  • Release_0.0.26_26
  • Release_0.0.27_27
  • Release_0.0.28_28
  • Release_0.0.29_29
  • Release_0.0.30_30
  • Release_0.0.31_31
  • Release_0.0.32_32
  • Release_0.0.33_33
  • Release_0.0.34_34
  • Release_0.0.35_35
  • Release_0.0.36_36
  • Release_0.0.37_37
  • Release_0.0.38_38
  • Release_0.0.39_39
  • Release_0.0.40_40
  • Release_0.0.41_41
  • Release_0.0.42_42
  • Release_0.0.43_43
  • Release_0.0.44_44
  • Release_0.0.45_45
  • Release_0.0.46_46
  • Release_0.0.47_47
  • Release_0.0.48_48
  • Release_0.1.0_49
  • Release_0.1.10_59
  • Release_0.1.11_60
  • Release_0.1.12_61
  • Release_0.1.13_62
  • Release_0.1.14_63
  • Release_0.1.15_64
  • Release_0.1.16_65
  • Release_0.1.17_66
  • Release_0.1.18_67
  • Release_0.1.19_68
  • Release_0.1.1_50
  • Release_0.1.20_69
  • Release_0.1.21_70
  • Release_0.1.22_71
  • Release_0.1.2_51
  • Release_0.1.3_52
  • Release_0.1.4_53
  • Release_0.1.5_54
  • Release_0.1.6_55
  • Release_0.1.7_56
  • Release_0.1.8_57
  • Release_0.1.9_58
  • Release_0.10.0_87
  • Release_0.10.1_88
  • Release_0.10.2_89
  • Release_0.10.3_90
  • Release_0.10.4_91
  • Release_0.2.0_72
  • Release_0.2.1_73
  • Release_0.3.0_74
  • Release_0.3.1_75
  • Release_0.4.0_76
  • Release_0.4.1_77
  • Release_0.5.0_78
  • Release_0.5.1_79
  • Release_0.5.2_80
  • Release_0.6.0_81
  • Release_0.7.0_82
  • Release_0.8.0_83
  • Release_0.9.0_84
  • Release_0.9.1_85
  • Release_0.9.2_86
81 results
Show changes
107 files
+ 510
391
Compare changes
  • Side-by-side
  • Inline

Files

Original line number Original line Diff line number Diff line
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=true
app.versionName=0.1.6
app.versionName=0.1.7
app.versionCode=55
app.versionCode=56
Original line number Original line Diff line number Diff line
@@ -9,8 +9,18 @@ CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
BASE_DIR="$(dirname "${CURRENT_DIR}")"


SOURCE="${CURRENT_DIR}/icon.svg"
SOURCE="${CURRENT_DIR}/icon.svg"
SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"

OPTIPNG_OPTIONS="-preserve -quiet -o7"
OPTIPNG_OPTIONS="-preserve -quiet -o7"


if [ ! -f "${SOURCE}" ]; then
  echo "Missing file: ${SOURCE}"
fi

if [ ! -f "${SOURCE_FASTLANE}" ]; then
  echo "Missing file: ${SOURCE_FASTLANE}"
fi

# optimize svg
# optimize svg
cp ${SOURCE} ${SOURCE}.tmp
cp ${SOURCE} ${SOURCE}.tmp
scour \
scour \
@@ -19,6 +29,7 @@ scour \
    --enable-viewboxing \
    --enable-viewboxing \
    --enable-comment-stripping \
    --enable-comment-stripping \
    --nindent=4 \
    --nindent=4 \
    --quiet \
    -i ${SOURCE}.tmp \
    -i ${SOURCE}.tmp \
    -o ${SOURCE}
    -o ${SOURCE}
rm ${SOURCE}.tmp
rm ${SOURCE}.tmp
@@ -28,6 +39,8 @@ function build_icon() {
  ICON_SIZE="$1"
  ICON_SIZE="$1"
  TARGET="$2"
  TARGET="$2"


  echo "Building ${TARGET}"

  TARGET_PNG="${TARGET}.png"
  TARGET_PNG="${TARGET}.png"


  inkscape \
  inkscape \
@@ -45,7 +58,7 @@ function build_fastlane_image() {
  HEIGHT="$2"
  HEIGHT="$2"
  TARGET="$3"
  TARGET="$3"


  SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"
  echo "Building ${TARGET}"


  cp ${SOURCE_FASTLANE} ${SOURCE_FASTLANE}.tmp
  cp ${SOURCE_FASTLANE} ${SOURCE_FASTLANE}.tmp
  scour \
  scour \
@@ -54,6 +67,7 @@ function build_fastlane_image() {
      --enable-viewboxing \
      --enable-viewboxing \
      --enable-comment-stripping \
      --enable-comment-stripping \
      --nindent=4 \
      --nindent=4 \
      --quiet \
      -i ${SOURCE_FASTLANE}.tmp \
      -i ${SOURCE_FASTLANE}.tmp \
      -o ${SOURCE_FASTLANE}
      -o ${SOURCE_FASTLANE}
  rm ${SOURCE_FASTLANE}.tmp
  rm ${SOURCE_FASTLANE}.tmp
Original line number Original line Diff line number Diff line
@@ -7,8 +7,59 @@ command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not


CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
ASSETS_DIR="${BASE_DIR}/assets"


OPTIPNG_OPTIONS="-preserve -quiet -o7"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
ICON_SIZE=192

#######################################################

# Game images
AVAILABLE_GAME_IMAGES="
  button_back
  button_start
  button_help
  button_show_conflicts
  game_win
  placeholder
  cell_empty
"

# Settings images
AVAILABLES_GAME_SETTINGS="
  level:easy,medium,hard,nightmare
  size:2x2,3x2,3x3,4x4
"

# Skins
AVAILABLE_SKINS="
  default
  food
  monsters
  nature
"

# Images per skin
SKIN_IMAGES="
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  16
"

#######################################################


# optimize svg
# optimize svg
function optimize_svg() {
function optimize_svg() {
@@ -21,6 +72,7 @@ function optimize_svg() {
      --enable-viewboxing \
      --enable-viewboxing \
      --enable-comment-stripping \
      --enable-comment-stripping \
      --nindent=4 \
      --nindent=4 \
      --quiet \
      -i ${SOURCE}.tmp \
      -i ${SOURCE}.tmp \
      -o ${SOURCE}
      -o ${SOURCE}
  rm ${SOURCE}.tmp
  rm ${SOURCE}.tmp
@@ -28,10 +80,16 @@ function optimize_svg() {


# build icons
# build icons
function build_icon() {
function build_icon() {
  ICON_SIZE=192
  SOURCE="$1"
  SOURCE="$1"
  TARGET="$2"
  TARGET="$2"


  echo "Building ${TARGET}"

  if [ ! -f "${SOURCE}" ]; then
    echo "Missing file: ${SOURCE}"
    exit 1
  fi

  optimize_svg "${SOURCE}"
  optimize_svg "${SOURCE}"


  inkscape \
  inkscape \
@@ -43,36 +101,56 @@ function build_icon() {
  optipng ${OPTIPNG_OPTIONS} ${TARGET}
  optipng ${OPTIPNG_OPTIONS} ${TARGET}
}
}


function build_settings_icons() {
  INPUT_STRING="$1"

  SETTING_NAME="$(echo "${INPUT_STRING}" | cut -d":" -f1)"
  SETTING_VALUES="$(echo "${INPUT_STRING}" | cut -d":" -f2 | tr "," " ")"

  for SETTING_VALUE in ${SETTING_VALUES}
  do
    SETTING_CODE="${SETTING_NAME}_${SETTING_VALUE}"
    build_icon ${CURRENT_DIR}/${SETTING_CODE}.svg ${ASSETS_DIR}/icons/${SETTING_CODE}.png
  done
}

function build_icon_for_skin() {
function build_icon_for_skin() {
  SKIN_CODE="$1"
  SKIN_CODE="$1"


  build_icon ${CURRENT_DIR}/skin_${SKIN_CODE}.svg ${BASE_DIR}/assets/icons/skin_${SKIN_CODE}.png
  # skin main image
  for VALUE in {1..16};
  build_icon ${CURRENT_DIR}/skin_${SKIN_CODE}.svg ${ASSETS_DIR}/icons/skin_${SKIN_CODE}.png

  # skin images
  for SKIN_IMAGE in ${SKIN_IMAGES}
  do
  do
    if [ -f "${CURRENT_DIR}/skins/${SKIN_CODE}/${VALUE}.svg" ]; then
    build_icon ${CURRENT_DIR}/skins/${SKIN_CODE}/${SKIN_IMAGE}.svg ${ASSETS_DIR}/skins/${SKIN_CODE}_${SKIN_IMAGE}.png
      build_icon ${CURRENT_DIR}/skins/${SKIN_CODE}/${VALUE}.svg ${BASE_DIR}/assets/skins/${SKIN_CODE}_${VALUE}.png
    fi
  done
  done
}
}


# Game icons
#######################################################
build_icon ${CURRENT_DIR}/button_back.svg ${BASE_DIR}/assets/icons/button_back.png
build_icon ${CURRENT_DIR}/button_help.svg ${BASE_DIR}/assets/icons/button_help.png
build_icon ${CURRENT_DIR}/button_show_conflicts.svg ${BASE_DIR}/assets/icons/button_show_conflicts.png
build_icon ${CURRENT_DIR}/button_start.svg ${BASE_DIR}/assets/icons/button_start.png
build_icon ${CURRENT_DIR}/difficulty_easy.svg ${BASE_DIR}/assets/icons/difficulty_easy.png
build_icon ${CURRENT_DIR}/difficulty_medium.svg ${BASE_DIR}/assets/icons/difficulty_medium.png
build_icon ${CURRENT_DIR}/difficulty_hard.svg ${BASE_DIR}/assets/icons/difficulty_hard.png
build_icon ${CURRENT_DIR}/difficulty_nightmare.svg ${BASE_DIR}/assets/icons/difficulty_nightmare.png
build_icon ${CURRENT_DIR}/game_win.svg ${BASE_DIR}/assets/icons/game_win.png
build_icon ${CURRENT_DIR}/size_2x2.svg ${BASE_DIR}/assets/icons/size_2x2.png
build_icon ${CURRENT_DIR}/size_3x2.svg ${BASE_DIR}/assets/icons/size_3x2.png
build_icon ${CURRENT_DIR}/size_3x3.svg ${BASE_DIR}/assets/icons/size_3x3.png
build_icon ${CURRENT_DIR}/size_4x4.svg ${BASE_DIR}/assets/icons/size_4x4.png
build_icon ${CURRENT_DIR}/skins/empty.svg ${BASE_DIR}/assets/skins/empty.png


# Skins
# Create output folders
build_icon_for_skin "default"
mkdir -p ${ASSETS_DIR}/icons
build_icon_for_skin "food"
mkdir -p ${ASSETS_DIR}/skins
build_icon_for_skin "monsters"

build_icon_for_skin "nature"
# Delete existing generated images
find ${ASSETS_DIR}/icons -type f -name "*.png" -delete
find ${ASSETS_DIR}/skins -type f -name "*.png" -delete

# build game images
for GAME_IMAGE in ${AVAILABLE_GAME_IMAGES}
do
  build_icon ${CURRENT_DIR}/${GAME_IMAGE}.svg ${ASSETS_DIR}/icons/${GAME_IMAGE}.png
done

# build settings images
for GAME_SETTING in ${AVAILABLES_GAME_SETTINGS}
do
  build_settings_icons "${GAME_SETTING}"
done

# build skins images
for SKIN in ${AVAILABLE_SKINS}
do
  build_icon_for_skin "${SKIN}"
done

icons/placeholder.svg

0 → 100644
+2 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 102 102" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"/>
Original line number Original line Diff line number Diff line
@@ -12,8 +12,8 @@ class Cell {
  bool isAnimated = false;
  bool isAnimated = false;


  Cell(
  Cell(
    @required this.value,
    this.value,
    @required this.isFixed,
    this.isFixed,
  );
  );


  /*
  /*
@@ -40,15 +40,13 @@ class Cell {
          ),
          ),
        ),
        ),
        onTap: () {
        onTap: () {
          if (col != null && row != null) {
          if (col != myProvider.currentCellCol || row != myProvider.currentCellRow) {
          if (col != myProvider.currentCellCol || row != myProvider.currentCellRow) {
            myProvider.selectCell(col, row);
            myProvider.selectCell(col, row);
          } else {
          } else {
            myProvider.selectCell(null, null);
            myProvider.selectCell(null, null);
          }
          }
          }
        },
        },
      )
      ),
    );
    );
  }
  }


@@ -61,19 +59,18 @@ class Cell {
    }
    }


    String imageAsset = this.getImageAssetName(myProvider);
    String imageAsset = this.getImageAssetName(myProvider);
    Color backgroundColor = Colors.grey[200];
    Color backgroundColor = Colors.grey.shade200;


    if (
    if (myProvider.showConflicts &&
      myProvider.showConflicts
        myProvider.currentCellCol != null &&
      && myProvider.currentCellCol != null
        myProvider.currentCellRow != null) {
      && myProvider.currentCellRow != null
    ) {
      List cells = myProvider.cells;
      List cells = myProvider.cells;
      int blockSizeHorizontal = myProvider.blockSizeHorizontal;
      int blockSizeHorizontal = myProvider.blockSizeHorizontal;
      int blockSizeVertical = myProvider.blockSizeVertical;
      int blockSizeVertical = myProvider.blockSizeVertical;


      if (!BoardUtils.isValueAllowed(cells, blockSizeHorizontal, blockSizeVertical, myProvider.currentCellCol, myProvider.currentCellRow, this.value)) {
      if (!BoardUtils.isValueAllowed(cells, blockSizeHorizontal, blockSizeVertical,
        backgroundColor = Colors.pink[100];
          myProvider.currentCellCol, myProvider.currentCellRow, this.value)) {
        backgroundColor = Colors.pink.shade100;
      }
      }
    }
    }


@@ -86,31 +83,29 @@ class Cell {
          ),
          ),
        ),
        ),
        child: GestureDetector(
        child: GestureDetector(
        child: Image(
          child: Image(image: AssetImage(imageAsset), fit: BoxFit.fill),
          image: AssetImage(imageAsset),
          fit: BoxFit.fill
        ),
          onTap: () {
          onTap: () {
            if (myProvider.currentCellCol != null && myProvider.currentCellRow != null) {
            if (myProvider.currentCellCol != null && myProvider.currentCellRow != null) {
            myProvider.updateCellValue(myProvider.currentCellCol, myProvider.currentCellRow, this.value);
              myProvider.updateCellValue(
                  myProvider.currentCellCol, myProvider.currentCellRow, this.value);
            }
            }
            myProvider.selectCell(null, null);
            myProvider.selectCell(null, null);
            if (BoardUtils.checkBoardIsSolved(myProvider)) {
            if (BoardUtils.checkBoardIsSolved(myProvider)) {
              BoardAnimate.startAnimation(myProvider, 'win');
              BoardAnimate.startAnimation(myProvider, 'win');
            }
            }
          },
          },
      )
        ));
    );
  }
  }


  /*
  /*
  * Compute image asset name, from skin and cell value/state
  * Compute image asset name, from skin and cell value/state
  */
  */
  String getImageAssetName(Data myProvider) {
  String getImageAssetName(Data myProvider) {
    String imageAsset = 'assets/skins/empty.png';
    String imageAsset = 'assets/icons/cell_empty.png';
    if (this.value > 0) {
    if (this.value > 0) {
      int cellValue = myProvider.getTranslatedValueForDisplay(this.value);
      int cellValue = myProvider.getTranslatedValueForDisplay(this.value);
      imageAsset = 'assets/skins/' + myProvider.skin + '_' + cellValue.toString() + '.png';
      imageAsset =
          'assets/skins/' + myProvider.parameterSkin + '_' + cellValue.toString() + '.png';
    }
    }


    return imageAsset;
    return imageAsset;
@@ -118,14 +113,14 @@ class Cell {


  // Compute cell background color, from cell state
  // Compute cell background color, from cell state
  Color getBackgroundColor(Data myProvider) {
  Color getBackgroundColor(Data myProvider) {
    Color editableCellColor = Colors.grey[100];
    Color editableCellColor = Colors.grey.shade100;
    Color editableCellColorConflict = Colors.pink[100];
    Color editableCellColorConflict = Colors.pink.shade100;
    Color fixedCellColor = Colors.grey[300];
    Color fixedCellColor = Colors.grey.shade300;
    Color fixedCellColorConflict = Colors.pink[200];
    Color fixedCellColorConflict = Colors.pink.shade200;
    Color editableSelectedValueColor = Colors.green[100];
    Color editableSelectedValueColor = Colors.green.shade100;
    Color fixedSelectedValueColor = Colors.green[300];
    Color fixedSelectedValueColor = Colors.green.shade300;
    Color editableAnimated = Colors.green[200];
    Color editableAnimated = Colors.green.shade200;
    Color fixedAnimated = Colors.green[300];
    Color fixedAnimated = Colors.green.shade300;


    Color backgroundColor = editableCellColor;
    Color backgroundColor = editableCellColor;


@@ -182,7 +177,7 @@ class Cell {
    }
    }


    if (!myProvider.gameIsRunning) {
    if (!myProvider.gameIsRunning) {
      cellBorderColor = Colors.green[700];
      cellBorderColor = Colors.green.shade700;
    }
    }


    Border borders = Border.all(
    Border borders = Border.all(
@@ -193,10 +188,25 @@ class Cell {
    // Update cell borders if not currently selected cell
    // Update cell borders if not currently selected cell
    if (col != myProvider.currentCellCol || row != myProvider.currentCellRow) {
    if (col != myProvider.currentCellCol || row != myProvider.currentCellRow) {
      borders = Border(
      borders = Border(
        top: BorderSide(width: cellBorderWidth, color: ((row % blockSizeVertical) == 0) ? cellBorderDarkColor : cellBorderLightColor),
        top: BorderSide(
        left: BorderSide(width: cellBorderWidth, color: ((col % blockSizeHorizontal) == 0) ? cellBorderDarkColor : cellBorderLightColor),
            width: cellBorderWidth,
        right: BorderSide(width: cellBorderWidth, color: (((col + 1) % blockSizeHorizontal) == 0) ? cellBorderDarkColor : cellBorderLightColor),
            color:
        bottom: BorderSide(width: cellBorderWidth, color: (((row + 1) % blockSizeVertical) == 0) ? cellBorderDarkColor : cellBorderLightColor),
                ((row % blockSizeVertical) == 0) ? cellBorderDarkColor : cellBorderLightColor),
        left: BorderSide(
            width: cellBorderWidth,
            color: ((col % blockSizeHorizontal) == 0)
                ? cellBorderDarkColor
                : cellBorderLightColor),
        right: BorderSide(
            width: cellBorderWidth,
            color: (((col + 1) % blockSizeHorizontal) == 0)
                ? cellBorderDarkColor
                : cellBorderLightColor),
        bottom: BorderSide(
            width: cellBorderWidth,
            color: (((row + 1) % blockSizeVertical) == 0)
                ? cellBorderDarkColor
                : cellBorderLightColor),
      );
      );
    }
    }


Original line number Original line Diff line number Diff line
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import '../provider/data.dart';
import '../provider/data.dart';


class Board {
class Board {

  static Container buildGameBoard(Data myProvider) {
  static Container buildGameBoard(Data myProvider) {
    Color borderColor = Colors.black;
    Color borderColor = Colors.black;


@@ -30,22 +29,12 @@ class Board {
    int boardSize = myProvider.blockSizeHorizontal * myProvider.blockSizeVertical;
    int boardSize = myProvider.blockSizeHorizontal * myProvider.blockSizeVertical;
    List cells = myProvider.cells;
    List cells = myProvider.cells;


    return Table(
    return Table(defaultColumnWidth: IntrinsicColumnWidth(), children: [
      defaultColumnWidth: IntrinsicColumnWidth(),
      children: [
      for (var row = 0; row < boardSize; row++)
      for (var row = 0; row < boardSize; row++)
        TableRow(children: [
        TableRow(children: [
          for (var col = 0; col < boardSize; col++)
          for (var col = 0; col < boardSize; col++)
              Column(children: [
            Column(children: [cells[row][col].widget(myProvider, row, col)]),
                cells[row][col].widget(
                  myProvider,
                  row,
                  col
                )
              ]),
        ]),
        ]),
      ]
    ]);
    );
  }
  }

}
}
Original line number Original line Diff line number Diff line
@@ -9,7 +9,6 @@ import '../utils/board_utils.dart';
import '../utils/game_utils.dart';
import '../utils/game_utils.dart';


class Game {
class Game {

  static Container buildGameWidget(Data myProvider) {
  static Container buildGameWidget(Data myProvider) {
    bool gameIsFinished = BoardUtils.checkBoardIsSolved(myProvider);
    bool gameIsFinished = BoardUtils.checkBoardIsSolved(myProvider);


@@ -31,10 +30,11 @@ class Game {
  static Container buildSelectCellValueBar(Data myProvider) {
  static Container buildSelectCellValueBar(Data myProvider) {
    List cells = myProvider.cells;
    List cells = myProvider.cells;


    Color borderColor = Colors.blue;
    bool isCellSelected =

        (myProvider.currentCellCol != null && myProvider.currentCellRow != null);
    bool isCellSelected = (myProvider.currentCellCol != null && myProvider.currentCellRow != null);
    bool isUpdatableCellSelected = isCellSelected
    bool isUpdatableCellSelected = isCellSelected ? !myProvider.cells[myProvider.currentCellRow][myProvider.currentCellCol].isFixed : false;
        ? !cells[myProvider.currentCellRow ?? 0][myProvider.currentCellCol ?? 0].isFixed
        : false;
    int maxValue = myProvider.blockSizeHorizontal * myProvider.blockSizeVertical;
    int maxValue = myProvider.blockSizeHorizontal * myProvider.blockSizeVertical;


    int maxItemsPerLine = 10;
    int maxItemsPerLine = 10;
@@ -44,35 +44,31 @@ class Game {
    return Container(
    return Container(
      margin: EdgeInsets.all(2),
      margin: EdgeInsets.all(2),
      padding: EdgeInsets.all(2),
      padding: EdgeInsets.all(2),

      child: Table(
      child: Table(
        defaultColumnWidth: IntrinsicColumnWidth(),
        defaultColumnWidth: IntrinsicColumnWidth(),
        children: [
        children: [
          for (var lineIndex = 0; lineIndex < linesCount; lineIndex++)
          for (var lineIndex = 0; lineIndex < linesCount; lineIndex++)
            TableRow(
            TableRow(
              children: [
              children: [
                for (
                for (var value = lineIndex * itemsCountPerLine;
                  var value = lineIndex * itemsCountPerLine;
                    value < (lineIndex + 1) * itemsCountPerLine;
                    value < (lineIndex + 1) * itemsCountPerLine;
                  value++
                    value++)
                )
                  Column(
                  Column(
                    children: [
                    children: [
                      Cell(
                      Cell(isUpdatableCellSelected ? (value <= maxValue ? value : -1) : -1,
                        isUpdatableCellSelected ? (value <= maxValue ? value : -1) : -1,
                              false)
                        false
                          .widgetUpdateValue(myProvider)
                      ).widgetUpdateValue(myProvider)
                    ],
                    ]
                  ),
                  ),
              ]
              ],
            ),
            ),
        ]
        ],
      ),
      ),
    );
    );
  }
  }


  static FlatButton buildRestartGameButton(Data myProvider) {
  static TextButton buildRestartGameButton(Data myProvider) {
    return FlatButton(
    return TextButton(
      child: Container(
      child: Container(
        child: Image(
        child: Image(
          image: AssetImage('assets/icons/button_back.png'),
          image: AssetImage('assets/icons/button_back.png'),
@@ -85,29 +81,35 @@ class Game {


  static Container buildEndGameMessage(Data myProvider) {
  static Container buildEndGameMessage(Data myProvider) {
    Image decorationImage = Image(
    Image decorationImage = Image(
      image: AssetImage(
      image: AssetImage('assets/icons/game_win.png'),
        'assets/icons/game_win.png'
      fit: BoxFit.fill,
      ),
      fit: BoxFit.fill
    );
    );


    return Container(
    return Container(
      margin: EdgeInsets.all(2),
      margin: EdgeInsets.all(2),
      padding: EdgeInsets.all(2),
      padding: EdgeInsets.all(2),

      child: Table(
      child: Table(
        defaultColumnWidth: IntrinsicColumnWidth(),
        defaultColumnWidth: IntrinsicColumnWidth(),
        children: [
        children: [
          TableRow(
          TableRow(
            children: [
            children: [
              Column(children: [ decorationImage ]),
              Column(
              Column(children: [ myProvider.animationInProgress ? decorationImage : buildRestartGameButton(myProvider) ]),
                children: [decorationImage],
              Column(children: [ decorationImage ]),
              ),
              Column(
                children: [
                  myProvider.animationInProgress
                      ? decorationImage
                      : buildRestartGameButton(myProvider)
                ],
              ),
              Column(
                children: [decorationImage],
              ),
            ],
          ),
        ],
        ],
      ),
      ),
        ]
      )
    );
    );
  }
  }

}
}
Original line number Original line Diff line number Diff line
@@ -4,23 +4,43 @@ import '../provider/data.dart';
import '../utils/game_utils.dart';
import '../utils/game_utils.dart';


class Parameters {
class Parameters {
  static double separatorHeight = 2.0;
  static double blockMargin = 3.0;
  static double blockPadding = 2.0;
  static Color buttonBackgroundColor = Colors.white;
  static Color buttonBorderColorActive = Colors.blue;
  static Color buttonBorderColorInactive = Colors.white;
  static double buttonBorderWidth = 10.0;
  static double buttonBorderRadius = 8.0;
  static double buttonPadding = 0.0;
  static double buttonMargin = 0.0;


  static Container buildParametersSelector(Data myProvider) {
  static Container buildParametersSelector(Data myProvider) {
    List<Widget> lines = [];

    List parameters = myProvider.availableParameters;
    for (var index = 0; index < parameters.length; index++) {
      lines.add(Parameters.buildParameterSelector(myProvider, parameters[index]));
      lines.add(SizedBox(height: Parameters.separatorHeight));
    }

    return Container(
    return Container(
      padding: EdgeInsets.all(2),
      child: Column(
      margin: EdgeInsets.all(2),
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          SizedBox(height: Parameters.separatorHeight),
          Expanded(
            child: Column(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              mainAxisSize: MainAxisSize.min,
              mainAxisAlignment: MainAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.center,
        children: [
              children: lines,
          Parameters.buildParameterSelector(myProvider, 'difficulty'),
            ),
          SizedBox(height: 5),
          ),
          Parameters.buildParameterSelector(myProvider, 'size'),
          SizedBox(height: Parameters.separatorHeight),
          SizedBox(height: 5),
          Container(
          Parameters.buildParameterSelector(myProvider, 'skin'),
            child: Parameters.buildStartGameButton(myProvider),
          SizedBox(height: 5),
          ),

          Parameters.buildStartGameButton(myProvider),
        ],
        ],
      ),
      ),
    );
    );
@@ -29,17 +49,13 @@ class Parameters {
  static Container buildStartGameButton(Data myProvider) {
  static Container buildStartGameButton(Data myProvider) {
    Column decorationImage = Column(
    Column decorationImage = Column(
      children: [
      children: [
        Image(
        Image(image: AssetImage('assets/icons/placeholder.png'), fit: BoxFit.fill),
          image: AssetImage('assets/icons/game_win.png'),
      ],
          fit: BoxFit.fill
        ),
      ]
    );
    );


    return Container(
    return Container(
      margin: EdgeInsets.all(2),
      margin: EdgeInsets.all(Parameters.blockMargin),
      padding: EdgeInsets.all(2),
      padding: EdgeInsets.all(Parameters.blockPadding),

      child: Table(
      child: Table(
        defaultColumnWidth: IntrinsicColumnWidth(),
        defaultColumnWidth: IntrinsicColumnWidth(),
        children: [
        children: [
@@ -48,7 +64,7 @@ class Parameters {
              decorationImage,
              decorationImage,
              Column(
              Column(
                children: [
                children: [
                  FlatButton(
                  TextButton(
                    child: Container(
                    child: Container(
                      child: Image(
                      child: Image(
                        image: AssetImage('assets/icons/button_start.png'),
                        image: AssetImage('assets/icons/button_start.png'),
@@ -57,19 +73,23 @@ class Parameters {
                    ),
                    ),
                    onPressed: () => GameUtils.startGame(myProvider),
                    onPressed: () => GameUtils.startGame(myProvider),
                  ),
                  ),
                ]
                ],
              ),
              ),
              decorationImage,
              decorationImage,
            ],
            ],
          ),
          ),
        ]
        ],
      )
      ),
    );
    );
  }
  }


  static Table buildParameterSelector(Data myProvider, String parameterCode) {
  static Widget buildParameterSelector(Data myProvider, String parameterCode) {
    List availableValues = myProvider.getParameterAvailableValues(parameterCode);
    List availableValues = myProvider.getParameterAvailableValues(parameterCode);


    if (availableValues.length == 1) {
      return SizedBox(height: 0.0);
    }

    return Table(
    return Table(
      defaultColumnWidth: IntrinsicColumnWidth(),
      defaultColumnWidth: IntrinsicColumnWidth(),
      children: [
      children: [
@@ -79,7 +99,7 @@ class Parameters {
              Column(
              Column(
                children: [
                children: [
                  _buildParameterButton(myProvider, parameterCode, availableValues[index])
                  _buildParameterButton(myProvider, parameterCode, availableValues[index])
                ]
                ],
              ),
              ),
          ],
          ],
        ),
        ),
@@ -87,21 +107,25 @@ class Parameters {
    );
    );
  }
  }


  static FlatButton _buildParameterButton(Data myProvider, String parameterCode, String parameterValue) {
  static Widget _buildParameterButton(
      Data myProvider, String parameterCode, String parameterValue) {
    String currentValue = myProvider.getParameterValue(parameterCode).toString();
    String currentValue = myProvider.getParameterValue(parameterCode).toString();


    bool isActive = (parameterValue == currentValue);
    bool isActive = (parameterValue == currentValue);
    String imageAsset = 'assets/icons/' + parameterCode + '_' + parameterValue + '.png';
    String imageAsset = 'assets/icons/' + parameterCode + '_' + parameterValue + '.png';


    return FlatButton(
    return TextButton(
      padding: EdgeInsets.all(2),
      child: Container(
      child: Container(
        margin: EdgeInsets.all(Parameters.buttonMargin),
        padding: EdgeInsets.all(Parameters.buttonPadding),
        decoration: BoxDecoration(
        decoration: BoxDecoration(
          color: Colors.white,
          color: Parameters.buttonBackgroundColor,
          borderRadius: BorderRadius.circular(10),
          borderRadius: BorderRadius.circular(Parameters.buttonBorderRadius),
          border: Border.all(
          border: Border.all(
            color: isActive ? Colors.blue : Colors.white,
            color: isActive
            width: 10,
                ? Parameters.buttonBorderColorActive
                : Parameters.buttonBorderColorInactive,
            width: Parameters.buttonBorderWidth,
          ),
          ),
        ),
        ),
        child: Image(
        child: Image(
@@ -112,5 +136,4 @@ class Parameters {
      onPressed: () => myProvider.setParameterValue(parameterCode, parameterValue),
      onPressed: () => myProvider.setParameterValue(parameterCode, parameterValue),
    );
    );
  }
  }

}
}
Original line number Original line Diff line number Diff line
@@ -2,91 +2,100 @@ import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shared_preferences/shared_preferences.dart';


class Data extends ChangeNotifier {
class Data extends ChangeNotifier {

  // Configuration available values
  // Configuration available values
  List _availableDifficultyLevels = ['easy', 'medium', 'hard', 'nightmare'];
  List _availableParameters = ['level', 'size', 'skin'];
  List _availableSizes = ['2x2', '3x2', '3x3', '4x4'];

  List _availableSkins = ['default', 'food', 'nature', 'monsters'];
  List _availableLevelValues = ['easy', 'medium', 'hard', 'nightmare'];
  List _availableSizeValues = ['2x2', '3x2', '3x3', '4x4'];
  List _availableSkinValues = ['default', 'food', 'nature', 'monsters'];
  List _shufflableSkins = ['food', 'nature', 'monsters'];
  List _shufflableSkins = ['food', 'nature', 'monsters'];


  List get availableDifficultyLevels => _availableDifficultyLevels;
  List get availableParameters => _availableParameters;
  List get availableSizes => _availableSizes;
  List get availableLevelValues => _availableLevelValues;
  List get availableSkins => _availableSkins;
  List get availableSizeValues => _availableSizeValues;
  List get availableSkinValues => _availableSkinValues;


  // Application default configuration
  // Application default configuration
  String _level = null;
  String _parameterLevel = '';
  String _levelDefault = 'medium';
  String _parameterLevelDefault = 'medium';
  String _size = null;
  String _parameterSize = '';
  String _sizeDefault = '3x3';
  String _parameterSizeDefault = '3x3';
  String _skin = null;
  String _parameterSkin = '';
  String _skinDefault = 'default';
  String _parameterSkinDefault = 'default';

  // Application current configuration
  String get parameterLevel => _parameterLevel;
  String get parameterSize => _parameterSize;
  String get parameterSkin => _parameterSkin;


  // Game data
  // Game data
  bool _assetsPreloaded = false;
  bool _assetsPreloaded = false;
  bool _gameIsRunning = false;
  bool _gameIsRunning = false;
  bool _animationInProgress = false;
  bool _animationInProgress = false;
  int _blockSizeVertical = null;
  int _blockSizeVertical = 0;
  int _blockSizeHorizontal = null;
  int _blockSizeHorizontal = 0;
  List _cells = [];
  List _cells = [];
  List _cellsSolved = [];
  List _cellsSolved = [];
  List _shuffledCellValues = [];
  List _shuffledCellValues = [];
  int _currentCellCol = null;
  int? _currentCellCol;
  int _currentCellRow = null;
  int? _currentCellRow;
  int _currentCellValue = null;
  int? _currentCellValue;
  bool _showConflicts = false;
  bool _showConflicts = false;
  int _givenTipsCount = 0;
  int _givenTipsCount = 0;


  String get level => _level;
  void updateParameterLevel(String parameterLevel) {
  void updateLevel(String level) {
    _parameterLevel = parameterLevel;
    _level = level;
    notifyListeners();
    notifyListeners();
  }
  }


  String get size => _size;
  int get blockSizeVertical => _blockSizeVertical;
  int get blockSizeVertical => _blockSizeVertical;
  int get blockSizeHorizontal => _blockSizeHorizontal;
  int get blockSizeHorizontal => _blockSizeHorizontal;
  void updateSize(String size) {
  void updateParameterSize(String parameterSize) {
    _size = size;
    _parameterSize = parameterSize;
    _blockSizeHorizontal = int.parse(_size.split('x')[0]);
    _blockSizeHorizontal = int.parse(_parameterSize.split('x')[0]);
    _blockSizeVertical = int.parse(_size.split('x')[1]);
    _blockSizeVertical = int.parse(_parameterSize.split('x')[1]);
    notifyListeners();
    notifyListeners();
  }
  }


  String get skin => _skin;
  void updateParameterSkin(String parameterSkin) {
  void updateSkin(String skin) {
    _parameterSkin = parameterSkin;
    _skin = skin;
    notifyListeners();
    notifyListeners();
  }
  }


  getParameterValue(String parameterCode) {
  String getParameterValue(String parameterCode) {
    switch (parameterCode) {
    switch (parameterCode) {
      case 'difficulty': { return _level; }
      case 'level':
      break;
        return _parameterLevel;
      case 'size': { return _size; }
      case 'size':
      break;
        return _parameterSize;
      case 'skin': { return _skin; }
      case 'skin':
      break;
        return _parameterSkin;
    }
    }
    return '';
  }
  }


  List getParameterAvailableValues(String parameterCode) {
  List getParameterAvailableValues(String parameterCode) {
    switch (parameterCode) {
    switch (parameterCode) {
      case 'difficulty': { return _availableDifficultyLevels; }
      case 'level':
      break;
        return _availableLevelValues;
      case 'size': { return _availableSizes; }
      case 'size':
      break;
        return _availableSizeValues;
      case 'skin': { return _availableSkins; }
      case 'skin':
      break;
        return _availableSkinValues;
    }
    }
    return [];
  }
  }


  setParameterValue(String parameterCode, String parameterValue) async {
  void setParameterValue(String parameterCode, String parameterValue) async {
    switch (parameterCode) {
    switch (parameterCode) {
      case 'difficulty': { updateLevel(parameterValue); }
      case 'level':
        updateParameterLevel(parameterValue);
        break;
        break;
      case 'size': { updateSize(parameterValue); }
      case 'size':
        updateParameterSize(parameterValue);
        break;
        break;
      case 'skin': { updateSkin(parameterValue); }
      case 'skin':
        updateParameterSkin(parameterValue);
        break;
        break;
    }
    }
    final prefs = await SharedPreferences.getInstance();
    final prefs = await SharedPreferences.getInstance();
@@ -95,9 +104,9 @@ class Data extends ChangeNotifier {


  void initParametersValues() async {
  void initParametersValues() async {
    final prefs = await SharedPreferences.getInstance();
    final prefs = await SharedPreferences.getInstance();
    setParameterValue('difficulty', prefs.getString('difficulty') ?? _levelDefault);
    setParameterValue('level', prefs.getString('level') ?? _parameterLevelDefault);
    setParameterValue('size', prefs.getString('size') ?? _sizeDefault);
    setParameterValue('size', prefs.getString('size') ?? _parameterSizeDefault);
    setParameterValue('skin', prefs.getString('skin') ?? _skinDefault);
    setParameterValue('skin', prefs.getString('skin') ?? _parameterSkinDefault);
  }
  }


  bool get gameIsRunning => _gameIsRunning;
  bool get gameIsRunning => _gameIsRunning;
@@ -126,31 +135,32 @@ class Data extends ChangeNotifier {
    int maxCellValue = 16;
    int maxCellValue = 16;
    List values = new List<int>.generate(maxCellValue, (i) => i + 1);
    List values = new List<int>.generate(maxCellValue, (i) => i + 1);


    if (_shufflableSkins.contains(_skin)) {
    if (_shufflableSkins.contains(_parameterSkin)) {
      values.shuffle();
      values.shuffle();
      print('Shuffled tiles values: ' + values.toString());
      print('Shuffled tiles values: ' + values.toString());
    }
    }


    _shuffledCellValues = values;
    _shuffledCellValues = values;
  }
  }

  int getTranslatedValueForDisplay(int originalValue) {
  int getTranslatedValueForDisplay(int originalValue) {
    return _shuffledCellValues[originalValue - 1];
    return _shuffledCellValues[originalValue - 1];
  }
  }


  int get currentCellCol => _currentCellCol;
  int? get currentCellCol => _currentCellCol;
  set updateCurrentCellCol(int currentCellCol) {
  set updateCurrentCellCol(int? currentCellCol) {
    _currentCellCol = currentCellCol;
    _currentCellCol = currentCellCol;
    notifyListeners();
    notifyListeners();
  }
  }


  int get currentCellRow => _currentCellRow;
  int? get currentCellRow => _currentCellRow;
  set updateCurrentCellRow(int currentCellRow) {
  set updateCurrentCellRow(int? currentCellRow) {
    _currentCellRow = currentCellRow;
    _currentCellRow = currentCellRow;
    notifyListeners();
    notifyListeners();
  }
  }


  int get currentCellValue => _currentCellValue;
  int? get currentCellValue => _currentCellValue;
  set updateCurrentCellValue(int currentCellValue) {
  set updateCurrentCellValue(int? currentCellValue) {
    _currentCellValue = currentCellValue;
    _currentCellValue = currentCellValue;
    notifyListeners();
    notifyListeners();
  }
  }
@@ -160,12 +170,13 @@ class Data extends ChangeNotifier {
    _givenTipsCount = _givenTipsCount + 1;
    _givenTipsCount = _givenTipsCount + 1;
    notifyListeners();
    notifyListeners();
  }
  }

  resetGivenTipsCount() {
  resetGivenTipsCount() {
    _givenTipsCount = 0;
    _givenTipsCount = 0;
    notifyListeners();
    notifyListeners();
  }
  }


  selectCell(int col, int row) {
  selectCell(int? col, int? row) {
    _currentCellCol = col;
    _currentCellCol = col;
    _currentCellRow = row;
    _currentCellRow = row;
    _currentCellValue = null;
    _currentCellValue = null;
@@ -177,18 +188,21 @@ class Data extends ChangeNotifier {
    notifyListeners();
    notifyListeners();
  }
  }


  updateCellValue(int col, int row, int value) {
  updateCellValue(int? col, int? row, int value) {
    if ((col != null) && (row != null)) {
      if (!_cells[row][col].isFixed) {
      if (!_cells[row][col].isFixed) {
        _cells[row][col].value = value;
        _cells[row][col].value = value;
      }
      }
      notifyListeners();
      notifyListeners();
    }
    }
  }


  bool get showConflicts => _showConflicts;
  bool get showConflicts => _showConflicts;
  void updateShowConflicts(bool showConflicts) {
  void updateShowConflicts(bool showConflicts) {
    _showConflicts = showConflicts;
    _showConflicts = showConflicts;
    notifyListeners();
    notifyListeners();
  }
  }

  void toggleShowConflicts() {
  void toggleShowConflicts() {
    updateShowConflicts(!showConflicts);
    updateShowConflicts(!showConflicts);
  }
  }
@@ -208,6 +222,7 @@ class Data extends ChangeNotifier {
    }
    }
    notifyListeners();
    notifyListeners();
  }
  }

  void resetAnimatedBackground() {
  void resetAnimatedBackground() {
    int boardSideLength = _blockSizeHorizontal * _blockSizeVertical;
    int boardSideLength = _blockSizeHorizontal * _blockSizeVertical;
    for (var row = 0; row < boardSideLength; row++) {
    for (var row = 0; row < boardSideLength; row++) {
Original line number Original line Diff line number Diff line
@@ -33,30 +33,21 @@ class _HomeState extends State<Home> {
      'button_show_conflicts',
      'button_show_conflicts',
      'button_start',
      'button_start',
      'game_win',
      'game_win',
      'placeholder',
      'cell_empty'
    ];
    ];
    myProvider.availableDifficultyLevels.forEach(
    myProvider.availableLevelValues.forEach((level) => gameImages.add('level_' + level));
      (difficulty) => gameImages.add('difficulty_' + difficulty)
    myProvider.availableSizeValues.forEach((size) => gameImages.add('size_' + size));
    );
    myProvider.availableSizes.forEach(
      (size) => gameImages.add('size_' + size)
    );


    gameImages.forEach(
    gameImages.forEach((image) => assets.add('assets/icons/' + image + '.png'));
      (image) => assets.add('assets/icons/' + image + '.png')
    );


    List skinImages = [];
    List skinImages = [];
    for (int value = 1; value <= 16; value++) {
    for (int value = 1; value <= 16; value++) {
      skinImages.add(value.toString());
      skinImages.add(value.toString());
    }
    }


    myProvider.availableSkins.forEach(
    myProvider.availableSkinValues.forEach((skin) => skinImages
      (skin) => skinImages.forEach(
        .forEach((image) => assets.add('assets/skins/' + skin + '_' + image + '.png')));
        (image) => assets.add('assets/skins/' + skin + '_' + image + '.png')
      )
    );

    assets.add('assets/skins/empty.png');


    return assets;
    return assets;
  }
  }
@@ -67,9 +58,7 @@ class _HomeState extends State<Home> {


    if (!myProvider.assetsPreloaded) {
    if (!myProvider.assetsPreloaded) {
      List assets = getImagesAssets(myProvider);
      List assets = getImagesAssets(myProvider);
      assets.forEach(
      assets.forEach((asset) => precacheImage(AssetImage(asset), context));
        (asset) => precacheImage(AssetImage(asset), context)
      );
      myProvider.updateAssetsPreloaded(true);
      myProvider.updateAssetsPreloaded(true);
    }
    }


@@ -77,7 +66,7 @@ class _HomeState extends State<Home> {


    if (myProvider.gameIsRunning) {
    if (myProvider.gameIsRunning) {
      menuActions = [
      menuActions = [
        FlatButton(
        TextButton(
          child: Container(
          child: Container(
            decoration: BoxDecoration(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(4),
              borderRadius: BorderRadius.circular(4),
@@ -86,17 +75,16 @@ class _HomeState extends State<Home> {
                width: 4,
                width: 4,
              ),
              ),
            ),
            ),
            margin: EdgeInsets.all(8),
            child: Image(
            child: Image(
              image: AssetImage('assets/icons/button_back.png'),
              image: AssetImage('assets/icons/button_back.png'),
              fit: BoxFit.fill
              fit: BoxFit.fill,
            ),
            ),
          ),
          ),
          onPressed: () => toast('Long press to quit game...'),
          onPressed: () => toast('Long press to quit game...'),
          onLongPress: () => GameUtils.resetGame(myProvider),
          onLongPress: () => GameUtils.resetGame(myProvider),
        ),
        ),
        Spacer(flex: 6),
        Spacer(flex: 6),
        FlatButton(
        TextButton(
          child: Container(
          child: Container(
            decoration: BoxDecoration(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(4),
              borderRadius: BorderRadius.circular(4),
@@ -105,31 +93,27 @@ class _HomeState extends State<Home> {
                width: 4,
                width: 4,
              ),
              ),
            ),
            ),
            margin: EdgeInsets.all(8),
            child: Badge(
            child: Badge(
              showBadge: myProvider.givenTipsCount == 0 ? false : true,
              showBadge: myProvider.givenTipsCount == 0 ? false : true,
              badgeColor:
              badgeColor: myProvider.givenTipsCount < 10
                myProvider.givenTipsCount < 10
                  ? Colors.green
                  ? Colors.green
                  : myProvider.givenTipsCount < 20
                  : myProvider.givenTipsCount < 20
                      ? Colors.orange
                      ? Colors.orange
                      : Colors.red,
                      : Colors.red,
              badgeContent: Text(
              badgeContent: Text(
                myProvider.givenTipsCount == 0 ? '' : myProvider.givenTipsCount.toString(),
                myProvider.givenTipsCount == 0 ? '' : myProvider.givenTipsCount.toString(),
                style: TextStyle(
                style: TextStyle(color: Colors.white),
                  color: Colors.white
                )
              ),
              ),
              child: Image(
              child: Image(
                image: AssetImage('assets/icons/button_help.png'),
                image: AssetImage('assets/icons/button_help.png'),
                fit: BoxFit.fill
                fit: BoxFit.fill,
              ),
            ),
            ),
            )
          ),
          ),
          onPressed: () => GameUtils.showTip(myProvider),
          onPressed: () => GameUtils.showTip(myProvider),
        ),
        ),
        Spacer(),
        Spacer(),
        FlatButton(
        TextButton(
          child: Container(
          child: Container(
            decoration: BoxDecoration(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(4),
              borderRadius: BorderRadius.circular(4),
@@ -138,10 +122,9 @@ class _HomeState extends State<Home> {
                width: 4,
                width: 4,
              ),
              ),
            ),
            ),
            margin: EdgeInsets.all(8),
            child: Image(
            child: Image(
              image: AssetImage('assets/icons/button_show_conflicts.png'),
              image: AssetImage('assets/icons/button_show_conflicts.png'),
              fit: BoxFit.fill
              fit: BoxFit.fill,
            ),
            ),
          ),
          ),
          onPressed: () {
          onPressed: () {
@@ -159,9 +142,9 @@ class _HomeState extends State<Home> {
        child: Center(
        child: Center(
          child: myProvider.gameIsRunning
          child: myProvider.gameIsRunning
              ? Game.buildGameWidget(myProvider)
              ? Game.buildGameWidget(myProvider)
            : Parameters.buildParametersSelector(myProvider)
              : Parameters.buildParametersSelector(myProvider),
        ),
      ),
      ),
      )
    );
    );
  }
  }
}
}
+17 −17

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2

File changed.

Preview size limit exceeded, changes collapsed.

test/widget_test.dart

deleted100644 → 0
+0 −14

File deleted.

Preview size limit exceeded, changes collapsed.