diff --git a/android/gradle.properties b/android/gradle.properties index bc2d95e8567abcfd41c26ebeb95fced48f43e773..818e87b23b224ced309ae5c147e5ed827826e237 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.1 -app.versionCode=1 +app.versionName=0.0.2 +app.versionCode=2 diff --git a/assets/icons/.gitkeep b/assets/icons/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/assets/icons/button_start.png b/assets/icons/button_start.png new file mode 100644 index 0000000000000000000000000000000000000000..fc68a389653da8a866ee8f94847a0227aa030995 Binary files /dev/null and b/assets/icons/button_start.png differ diff --git a/assets/icons/difficulty_easy.png b/assets/icons/difficulty_easy.png new file mode 100644 index 0000000000000000000000000000000000000000..0bde256ef61a433321973f3b714cb13a5a76ae36 Binary files /dev/null and b/assets/icons/difficulty_easy.png differ diff --git a/assets/icons/difficulty_hard.png b/assets/icons/difficulty_hard.png new file mode 100644 index 0000000000000000000000000000000000000000..087591fa02fcb21b57b47ebddaeb35b01261b05d Binary files /dev/null and b/assets/icons/difficulty_hard.png differ diff --git a/assets/icons/difficulty_medium.png b/assets/icons/difficulty_medium.png new file mode 100644 index 0000000000000000000000000000000000000000..67364276383e39456f05791a88fabd3001513b4b Binary files /dev/null and b/assets/icons/difficulty_medium.png differ diff --git a/assets/icons/size_2.png b/assets/icons/size_2.png new file mode 100644 index 0000000000000000000000000000000000000000..91f7fd436c51769ed22cfd97d9e297de827f17ee Binary files /dev/null and b/assets/icons/size_2.png differ diff --git a/assets/icons/size_3.png b/assets/icons/size_3.png new file mode 100644 index 0000000000000000000000000000000000000000..d69c0a2df9a253d4a593a380198e56c297e35e3c Binary files /dev/null and b/assets/icons/size_3.png differ diff --git a/assets/icons/skin_default.png b/assets/icons/skin_default.png new file mode 100644 index 0000000000000000000000000000000000000000..a00d6d50e91f04029d6d58b747f3644298504fa2 Binary files /dev/null and b/assets/icons/skin_default.png differ diff --git a/assets/skins/.gitkeep b/assets/skins/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/assets/skins/default_1.png b/assets/skins/default_1.png new file mode 100644 index 0000000000000000000000000000000000000000..81fedf0ce0a6e139a2700780f36b8424ece903ef Binary files /dev/null and b/assets/skins/default_1.png differ diff --git a/assets/skins/default_2.png b/assets/skins/default_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a1d9df5390311feb5d6b28039dad1a193f84d613 Binary files /dev/null and b/assets/skins/default_2.png differ diff --git a/assets/skins/default_3.png b/assets/skins/default_3.png new file mode 100644 index 0000000000000000000000000000000000000000..a3144a8b0d4d17e48613cc769ad52dc28a98bb21 Binary files /dev/null and b/assets/skins/default_3.png differ diff --git a/assets/skins/default_4.png b/assets/skins/default_4.png new file mode 100644 index 0000000000000000000000000000000000000000..e442b9ae5e570c37c2c9f1c219faadfa2ef7fa90 Binary files /dev/null and b/assets/skins/default_4.png differ diff --git a/assets/skins/default_5.png b/assets/skins/default_5.png new file mode 100644 index 0000000000000000000000000000000000000000..d3942e1bc9cd01718d0f47a94095227f74c123b7 Binary files /dev/null and b/assets/skins/default_5.png differ diff --git a/assets/skins/default_6.png b/assets/skins/default_6.png new file mode 100644 index 0000000000000000000000000000000000000000..e881400e5c205a5e94549bd9e6748f8aac30b4ce Binary files /dev/null and b/assets/skins/default_6.png differ diff --git a/assets/skins/default_7.png b/assets/skins/default_7.png new file mode 100644 index 0000000000000000000000000000000000000000..96abfbd8ea239500ceb0b2725ead7011398f12df Binary files /dev/null and b/assets/skins/default_7.png differ diff --git a/assets/skins/default_8.png b/assets/skins/default_8.png new file mode 100644 index 0000000000000000000000000000000000000000..b1cda45df085155374036546e26d02b8436dccaf Binary files /dev/null and b/assets/skins/default_8.png differ diff --git a/assets/skins/default_9.png b/assets/skins/default_9.png new file mode 100644 index 0000000000000000000000000000000000000000..c08765ae77b7c80a72f4bdb44f1c33f067ebffda Binary files /dev/null and b/assets/skins/default_9.png differ diff --git a/assets/skins/empty.png b/assets/skins/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..af78d03efb01bbb072eb1de50a10daf05ebb670a Binary files /dev/null and b/assets/skins/empty.png differ diff --git a/icons/build_icons.sh b/icons/build_application_icons.sh similarity index 92% rename from icons/build_icons.sh rename to icons/build_application_icons.sh index fefc393e2f601cd671938068d23247d6bfb1682b..336359e558b98d28963e09e0ff3d05ab1cab26b4 100755 --- a/icons/build_icons.sh +++ b/icons/build_application_icons.sh @@ -4,7 +4,6 @@ command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; } command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; } command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } -command -v convert >/dev/null 2>&1 || { echo >&2 "I require convert (imagemagick) but it's not installed. Aborting."; exit 1; } CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" BASE_DIR="$(dirname "${CURRENT_DIR}")" diff --git a/icons/build_game_icons.sh b/icons/build_game_icons.sh new file mode 100755 index 0000000000000000000000000000000000000000..7fac92095ffe903f5174d8c022e8615222d87d1e --- /dev/null +++ b/icons/build_game_icons.sh @@ -0,0 +1,66 @@ +#! /bin/bash + +# Check dependencies +command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; } +command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; } +command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } + +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +BASE_DIR="$(dirname "${CURRENT_DIR}")" + +OPTIPNG_OPTIONS="-preserve -quiet -o7" + +# optimize svg +function optimize_svg() { + SOURCE="$1" + + cp ${SOURCE} ${SOURCE}.tmp + scour \ + --remove-descriptive-elements \ + --enable-id-stripping \ + --enable-viewboxing \ + --enable-comment-stripping \ + --nindent=4 \ + -i ${SOURCE}.tmp \ + -o ${SOURCE} + rm ${SOURCE}.tmp +} + +# build icons +function build_icon() { + ICON_SIZE=192 + SOURCE="$1" + TARGET="$2" + + optimize_svg "${SOURCE}" + + inkscape \ + --export-width=${ICON_SIZE} \ + --export-height=${ICON_SIZE} \ + --export-filename=${TARGET} \ + ${SOURCE} + + optipng ${OPTIPNG_OPTIONS} ${TARGET} +} + +function build_icon_for_skin() { + SKIN_CODE="$1" + + for VALUE in {1..9}; + do + build_icon ${CURRENT_DIR}/skins/${SKIN_CODE}/${VALUE}.svg ${BASE_DIR}/assets/skins/${SKIN_CODE}_${VALUE}.png + done +} + +# Game icons +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}/size_2.svg ${BASE_DIR}/assets/icons/size_2.png +build_icon ${CURRENT_DIR}/size_3.svg ${BASE_DIR}/assets/icons/size_3.png +build_icon ${CURRENT_DIR}/skin_default.svg ${BASE_DIR}/assets/icons/skin_default.png +build_icon ${CURRENT_DIR}/skins/empty.svg ${BASE_DIR}/assets/skins/empty.png + +# Skins +build_icon_for_skin "default" diff --git a/icons/button_start.svg b/icons/button_start.svg new file mode 100644 index 0000000000000000000000000000000000000000..52e7fcf0206b8f89b43706a650c68061e4d2c259 --- /dev/null +++ b/icons/button_start.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m46.835 0c-25.826 0-46.835 21.009-46.835 46.841 0 25.826 21.009 46.835 46.835 46.835s46.83-21.009 46.83-46.835c0-25.832-21.004-46.841-46.83-46.841zm0 83.709c-20.36 0-36.875-16.508-36.875-36.868 0-20.369 16.515-36.874 36.875-36.874 20.361 0 36.873 16.505 36.873 36.874 0 20.36-16.512 36.868-36.873 36.868z"/><path d="m34.852 25.44c-1.1248-1.1302-4.0012-1.1302-4.0012 0v45.921c0 1.1316 2.8832 1.1316 4.0121 0l37.693-20.918c1.1289-1.1248 1.1479-2.9551 0.02171-4.084z" fill="#479fee" stroke-width="1.3568"/></svg> diff --git a/icons/difficulty_easy.svg b/icons/difficulty_easy.svg new file mode 100644 index 0000000000000000000000000000000000000000..204ea0bed899457a41dac60bbf390a6d3fd98d09 --- /dev/null +++ b/icons/difficulty_easy.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#41ff6a"/><path d="m22.408 52.415 20.8 13.7c0.2 0.1 0.3 0.2 0.5 0.3 1.3 0.5 2.8-0.1 3.3-1.3 0.5-1.3-0.1-2.8-1.3-3.3l-23.2-9.6c-0.2 0-0.3 0.2-0.1 0.2zm23.7 11.6c0.1 0.8-0.5 1.4-1.3 1.5s-1.4-0.5-1.5-1.3 0.5-1.4 1.3-1.5c0.8 0 1.5 0.5 1.5 1.3z"/><path d="m40.708 35.515c0.1 0.4 0.6 0.7 1 0.7 0.9-0.1 1.9-0.1 2.8-0.1 1.5 0 2.9 0.1 4.3 0.3 0.6 0.1 1.2-0.4 1.2-1v-6.9c0-0.6-0.5-1-1-1-3.2 0.1-6.4 0.7-9.3 1.6-0.5 0.2-0.8 0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1z"/><path d="m12.808 53.815 6 2c0.5 0.2 1-0.1 1.2-0.6 1.1-2.6 2.2-4.3 3.9-6.4 0.4-0.4 0.3-1.1-0.2-1.4l-5.9-4.2c-0.5-0.3-1.1-0.2-1.4 0.3-1.6 2.5-3.2 6.1-4.1 9-0.3 0.6 0 1.2 0.5 1.3z"/><path d="m74.808 59.915c0.4 1.7 0.7 3.5 0.9 5.3 0 0.5 0.5 0.9 1 0.9h10.2c0.6 0 1-0.5 1-1-0.1-3.1-0.5-6-1.3-8.9-0.1-0.6-0.7-0.9-1.3-0.7l-9.8 3.2c-0.6 0.2-0.9 0.7-0.7 1.2z"/><path d="m14.808 66.115c0.1-3.2 0.7-6.3 1.7-9.2 0.2-0.5-0.1-1.1-0.6-1.3l-0.4-0.1c-0.5-0.2-1.1 0.1-1.3 0.7-0.8 3.2-1.3 6.5-1.3 9.9z"/></svg> diff --git a/icons/difficulty_hard.svg b/icons/difficulty_hard.svg new file mode 100644 index 0000000000000000000000000000000000000000..b9fac20d5f1bcc68f1a74befb480627ccc791eb9 --- /dev/null +++ b/icons/difficulty_hard.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#d31158"/><path d="m68.154 58.254-24.4 5.1c-0.2 0-0.4 0.1-0.5 0.1-1.3 0.6-1.9 2-1.4 3.3 0.6 1.3 2 1.9 3.3 1.4l23-9.7c0.2 0 0.1-0.2 0-0.2zm-25 8.7c-0.6-0.5-0.6-1.4-0.1-2s1.4-0.6 2-0.1 0.6 1.4 0.1 2c-0.5 0.5-1.4 0.6-2 0.1z"/><path d="m40.054 37.354c0.1 0.4 0.6 0.7 1 0.7 0.9-0.1 1.9-0.1 2.8-0.1 1.5 0 2.9 0.1 4.3 0.3 0.6 0.1 1.2-0.4 1.2-1v-6.9c0-0.6-0.5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0.2 1.1 0.2 1.4l1.4 1c0.4 0.4 1 0.3 1.3-0.1z"/><path d="m14.954 56.654 0.5 0.2c0.5 0.2 1-0.1 1.2-0.6 1.1-2.6 2.5-5 4.2-7.1 0.4-0.4 0.3-1.1-0.2-1.4l-1.2-0.8c-0.3-0.4-1-0.2-1.3 0.3-1.6 2.5-2.9 5.3-3.8 8.2-0.2 0.5 0.1 1.1 0.6 1.2z"/><path d="m74.054 61.754c0.4 1.7 0.7 3.5 0.9 5.3 0 0.5 0.5 0.9 1 0.9h10.2c0.6 0 1-0.5 1-1-0.1-3.1-0.5-6-1.3-8.9-0.1-0.6-0.7-0.9-1.3-0.7l-9.8 3.2c-0.5 0.2-0.8 0.7-0.7 1.2z"/><path d="m14.054 67.954c0.1-3.2 0.7-6.3 1.7-9.2 0.2-0.5-0.1-1.1-0.6-1.3l-0.3-0.1c-0.5-0.2-1.1 0.1-1.3 0.7-0.8 3.2-1.3 6.5-1.3 9.9z"/></svg> diff --git a/icons/difficulty_medium.svg b/icons/difficulty_medium.svg new file mode 100644 index 0000000000000000000000000000000000000000..e71cd188d178627dfba5d7cb2c450d38cf1f02e8 --- /dev/null +++ b/icons/difficulty_medium.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#eeb517"/><path d="m52.928 42.009-11 21.7c-0.1 0.2-0.1 0.3-0.2 0.5-0.4 1.4 0.4 2.7 1.7 3.2 1.4 0.4 2.7-0.4 3.2-1.7l6.6-23.7c0-0.1-0.2-0.2-0.3 0zm-8.5 24.3c-0.8 0.1-1.5-0.4-1.6-1.1-0.1-0.8 0.4-1.5 1.1-1.6 0.8-0.1 1.5 0.4 1.6 1.1 0.1 0.8-0.4 1.5-1.1 1.6z"/><path d="m40.128 36.409c0.1 0.4 0.6 0.7 1 0.7 0.9-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0.6-1 0.3-1.4l-1.8-2.4c-0.3-0.5-1-0.6-1.5-0.2-2.3 2-4.4 4.3-6.2 6.8-0.3 0.4-0.2 1.1 0.2 1.4l1.4 1c0.5 0.4 1 0.3 1.4-0.1z"/><path d="m15.128 55.709 0.5 0.2c0.5 0.2 1-0.1 1.2-0.6 1.1-2.6 2.5-5 4.2-7.1 0.4-0.4 0.3-1.1-0.2-1.4l-1.2-0.8c-0.5-0.3-1.1-0.2-1.4 0.3-1.6 2.5-2.9 5.3-3.8 8.2-0.1 0.5 0.2 1.1 0.7 1.2z"/><path d="m74.228 60.809c0.4 1.7 0.7 3.5 0.9 5.3 0 0.5 0.5 0.9 1 0.9h10.2c0.6 0 1-0.5 1-1-0.1-3.1-0.5-6-1.3-8.9-0.1-0.6-0.7-0.9-1.3-0.7l-9.8 3.2c-0.6 0.2-0.8 0.7-0.7 1.2z"/><path d="m14.228 67.009c0.1-3.2 0.7-6.3 1.7-9.2 0.2-0.5-0.1-1.1-0.6-1.3l-0.3-0.1c-0.5-0.2-1.1 0.1-1.3 0.7-0.8 3.2-1.3 6.5-1.3 9.9z"/></svg> diff --git a/icons/size_2.svg b/icons/size_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..6772a5fc4c487a11067c6dbbdbded3c74d3fbca8 --- /dev/null +++ b/icons/size_2.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#6afffe"/><path d="m8.016 8.1944v83.701h83.701v-83.701zm60.683 60.683h-14.648v-14.648h14.648zm0 4.185v14.648h-14.648v-14.648zm4.185 0h14.648v14.648h-14.648zm0-4.185v-14.648h14.648v14.648zm0-23.018v-14.648h14.648v14.648zm-4.185 0h-14.648v-14.648h14.648zm-23.018 0h-14.648v-14.648h14.648zm0 8.3701v14.648h-14.648v-14.648zm0 18.833v14.648h-14.648v-14.648zm41.85-46.035h-14.648v-14.648h14.648zm-18.833-14.648v14.648h-14.648v-14.648zm-23.018 14.648h-14.648v-14.648h14.648zm-33.48-14.648h14.648v14.648h-14.648zm0 18.833h14.648v14.648h-14.648zm0 23.018h14.648v14.648h-14.648zm0 18.833h14.648v14.648h-14.648z" stroke-width="2.0925"/></svg> diff --git a/icons/size_3.svg b/icons/size_3.svg new file mode 100644 index 0000000000000000000000000000000000000000..727e31a570e4acb2d8eb816e44652fd5341b2bee --- /dev/null +++ b/icons/size_3.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#6afffe"/><path d="m65.824 4.0024h-62v90h90v-90zm9 79v-8h8v8zm8 2v7h-8v-7zm-38-2v-8h8v8zm8 2v7h-8v-7zm-38-2v-8h8v8zm8 2v7h-8v-7zm0-70v8h-8v-8zm-8-2v-7h8v7zm38 2v8h-8v-8zm-8-2v-7h8v7zm0 30v-7h8v7zm8 2v8h-8v-8zm-10-2h-7v-7h7zm0 2v8h-7v-8zm0 10v7h-7v-7zm2 0h8v7h-8zm10 0h7v7h-7zm0-2v-8h7v8zm0-10v-7h7v7zm0-11v-7h7v7zm-2 0h-8v-7h8zm-10 0h-7v-7h7zm-11 0h-7v-7h7zm0 4v7h-7v-7zm0 9v8h-7v-8zm0 10v7h-7v-7zm0 11v7h-7v-7zm4 0h7v7h-7zm9 0h8v7h-8zm10 0h7v7h-7zm11 0h7v7h-7zm0-4v-7h7v7zm0-9v-8h7v8zm0-10v-7h7v7zm0-11v-7h7v7zm0-9v-8h7v8zm-4 0h-7v-8h7zm-19 0h-7v-8h7zm-11 0h-7v-8h7zm-9 2v7h-8v-7zm0 11v7h-8v-7zm0 9v8h-8v-8zm0 10v7h-8v-7zm0 11v7h-8v-7zm2 9h7v8h-7zm11 0h7v8h-7zm19 0h7v8h-7zm11 0h7v8h-7zm9-2v-7h8v7zm0-11v-7h8v7zm0-9v-8h8v8zm0-10v-7h8v7zm0-11v-7h8v7zm0-9v-8h8v8zm0-10v-7h8v7zm-2-7v7h-7v-7zm-11 7h-7v-7h7zm-19-7v7h-7v-7zm-11 7h-7v-7h7zm-26-7h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm0 11h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm0 11h7v7h-7zm0 9h7v8h-7zm0 10h7v7h-7zm19 7v-7h7v7zm11-7h7v7h-7zm19 7v-7h7v7zm11-7h7v7h-7zm26 7h-7v-7h7zm0-9h-7v-8h7zm0-10h-7v-7h7zm0-11h-7v-7h7zm0-9h-7v-8h7zm0-10h-7v-7h7zm0-11h-7v-7h7zm0-9h-7v-8h7zm-7-10v-7h7v7z"/></svg> diff --git a/icons/skin_default.svg b/icons/skin_default.svg new file mode 100644 index 0000000000000000000000000000000000000000..76c40c28ff55b5317aaa804f3bd1b50e8e98160b --- /dev/null +++ b/icons/skin_default.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#f3ff6a"/><path class="st0" d="m56.096 53.176 26.479-4.2576c2.3483-0.37629 4.5851 1.2404 4.9614 3.5887l3.8395 23.859c0.37628 2.3483-1.2404 4.5851-3.5887 4.9614l-26.479 4.2576c-2.3483 0.37629-4.5851-1.2404-4.9614-3.5887l-3.8395-23.859c-0.37629-2.3483 1.2404-4.5851 3.5887-4.9614zm13.567 11.198-5.1217-0.05575c0.1533-1.6515 0.73864-2.9964 1.7769-4.0416 1.0313-1.0383 2.627-1.7421 4.7733-2.0975 2.4737-0.41113 4.3273-0.25086 5.5886 0.48778 1.2543 0.73864 1.9999 1.8048 2.2298 3.1984 0.13937 0.81529 0.03484 1.5957-0.29964 2.3344-0.33448 0.73864-0.90588 1.4285-1.7281 2.0765 0.75954 0.05575 1.3588 0.17421 1.7839 0.35538 0.69683 0.2857 1.2682 0.71076 1.7212 1.2891 0.45294 0.57837 0.75954 1.3031 0.90588 2.1811 0.18118 1.101 0.07665 2.2089-0.33448 3.3239-0.41113 1.108-1.108 2.0278-2.1044 2.7525-0.99646 0.7247-2.3762 1.2404-4.1461 1.533-1.7212 0.2857-3.1148 0.31357-4.174 0.06968-1.0661-0.23692-1.979-0.69683-2.7525-1.3658-0.76651-0.67592-1.4285-1.5748-1.972-2.7037l5.1496-1.5818c0.38326 1.0313 0.82923 1.7142 1.3309 2.0556 0.50172 0.34145 1.0871 0.45294 1.763 0.34145 0.7038-0.11846 1.2473-0.47384 1.6306-1.0731 0.38326-0.5923 0.50172-1.324 0.35538-2.188-0.14633-0.878-0.48778-1.5191-1.0174-1.9302-0.52959-0.40416-1.1846-0.54353-1.9581-0.4181-0.41113 0.06968-0.96162 0.26479-1.6445 0.5923l-0.35538-3.8117c0.29267-7e-3 0.52262-0.0209 0.68289-0.04878 0.68289-0.11149 1.2125-0.43203 1.5957-0.94072 0.38326-0.51565 0.52262-1.0661 0.42506-1.6654-0.09756-0.57837-0.34841-1.0104-0.73864-1.2891-0.40416-0.2857-0.89891-0.38326-1.4982-0.27873-0.62018 0.10452-1.0871 0.36932-1.4146 0.80832-0.32054 0.439-0.47384 1.1358-0.45294 2.0905zm-20.117-45.663 3.2193 19.316-5.3307 0.89194-2.1044-12.633c-0.75258 0.80135-1.4982 1.4633-2.2438 1.9999-0.73864 0.53656-1.6933 1.094-2.8431 1.6654l-0.71773-4.2994c1.7003-0.88497 2.9755-1.8118 3.8326-2.7943 0.8571-0.98253 1.4703-2.1184 1.8327-3.4145zm-31.357 31.748 25.727 7.5815c2.2856 0.67592 3.6026 3.0939 2.9267 5.3795l-6.8289 23.177c-0.67592 2.2856-3.0939 3.6026-5.3795 2.9267l-25.72-7.5745c-2.2856-0.67592-3.6026-3.0939-2.9267-5.3795l6.8289-23.177c0.66896-2.2856 3.087-3.6026 5.3725-2.9336zm18.612 20.229-3.526-0.50172c-0.19511 0.22298-0.41113 0.439-0.64805 0.64108-0.89194 0.76651-2.3135 1.4842-4.2646 2.1462-1.1567 0.37629-1.9302 0.65502-2.3344 0.82226-0.40416 0.17421-0.88497 0.40416-1.4494 0.7038l7.4421 2.202-1.1498 3.8744-14.292-4.2228c0.57837-1.3588 1.4703-2.5434 2.6689-3.5329 1.1985-0.99646 3.1845-2.0069 5.9718-3.0242 0.52959-0.19511 0.99646-0.37629 1.4146-0.55049 0.93375-0.39022 1.5888-0.7247 1.972-1.0174 0.5505-0.42507 0.89891-0.878 1.0383-1.3588 0.1533-0.52262 0.09756-1.0243-0.18118-1.5121-0.27873-0.48778-0.71076-0.81529-1.2961-0.9895-0.60624-0.18118-1.1637-0.1324-1.6585 0.1324-0.50172 0.27176-0.96162 0.87104-1.3797 1.8048l-4.6478-1.7978c0.58534-1.2891 1.2404-2.2299 1.9581-2.8361 0.7247-0.60624 1.5957-0.97556 2.6201-1.108 1.0313-0.1324 2.3413 0.03484 3.951 0.51565 1.6724 0.49475 2.9197 1.0731 3.742 1.7281 0.81529 0.65502 1.3797 1.4564 1.6724 2.4041 0.29964 0.95466 0.3066 1.9163 0.01394 2.8988-0.22995 0.76651-0.61321 1.4564-1.1567 2.0835zm-5.5677-55.614 26.479-4.2576c2.3483-0.37629 4.5851 1.2404 4.9614 3.5887l3.8395 23.859c0.37629 2.3483-1.2404 4.5851-3.5887 4.9614l-26.479 4.2576c-2.3483 0.37629-4.5851-1.2404-4.9614-3.5887l-3.8395-23.859c-0.37629-2.3483 1.2404-4.5851 3.5887-4.9614z" clip-rule="evenodd" fill-rule="evenodd" stroke-width=".69683"/></svg> diff --git a/icons/skins/default/1.svg b/icons/skins/default/1.svg new file mode 100644 index 0000000000000000000000000000000000000000..4ae157f20d06f9cd7d538a7e4d394f0a4fc8282c --- /dev/null +++ b/icons/skins/default/1.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/> + <g stroke-width="2.8975" aria-label="1"><path d="m28.274 82.939h18.675v-64.458l-20.316 4.0746v-10.413l20.203-4.0746h11.432v74.871h18.675v9.6206h-48.669z"/></g> +</svg> diff --git a/icons/skins/default/2.svg b/icons/skins/default/2.svg new file mode 100644 index 0000000000000000000000000000000000000000..ebfcf152c8340fba414ecb89f3fdfc312fb2a8ef --- /dev/null +++ b/icons/skins/default/2.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">2</tspan></text></svg> diff --git a/icons/skins/default/3.svg b/icons/skins/default/3.svg new file mode 100644 index 0000000000000000000000000000000000000000..784ea45137247ff8962ac0e2dac6b8b71099a5f9 --- /dev/null +++ b/icons/skins/default/3.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">3</tspan></text></svg> diff --git a/icons/skins/default/4.svg b/icons/skins/default/4.svg new file mode 100644 index 0000000000000000000000000000000000000000..7f95225e66faf5d28f68713ee0e50d4025becd94 --- /dev/null +++ b/icons/skins/default/4.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">4</tspan></text></svg> diff --git a/icons/skins/default/5.svg b/icons/skins/default/5.svg new file mode 100644 index 0000000000000000000000000000000000000000..59aa9bf73cfd6fd23716644c79ac25377532c538 --- /dev/null +++ b/icons/skins/default/5.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">5</tspan></text></svg> diff --git a/icons/skins/default/6.svg b/icons/skins/default/6.svg new file mode 100644 index 0000000000000000000000000000000000000000..1251bc34dadb5e42ee8fc1a3019b8a97a7e74013 --- /dev/null +++ b/icons/skins/default/6.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">6</tspan></text></svg> diff --git a/icons/skins/default/7.svg b/icons/skins/default/7.svg new file mode 100644 index 0000000000000000000000000000000000000000..8ed4b06d79f92edf536ecc5db785c2e6763caa06 --- /dev/null +++ b/icons/skins/default/7.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><text x="13.899673" y="92.559296" fill="#000000" font-family="sans-serif" font-size="115.9px" letter-spacing="0px" stroke-width="2.8975" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="13.899673" y="92.559296" stroke-width="2.8975">7</tspan></text></svg> diff --git a/icons/skins/default/8.svg b/icons/skins/default/8.svg new file mode 100644 index 0000000000000000000000000000000000000000..b563d7539f86e6578f69463b5b230d3938da1bc4 --- /dev/null +++ b/icons/skins/default/8.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><g stroke-width="2.8975" aria-label="8"><path d="m50.741 52.436q-8.1492 0-12.846 4.3576-4.6405 4.3576-4.6405 11.997 0 7.6399 4.6405 11.997 4.6971 4.3576 12.846 4.3576t12.846-4.3576q4.6971-4.4142 4.6971-11.997 0-7.6399-4.6971-11.997-4.6405-4.3576-12.846-4.3576zm-11.432-4.8669q-7.3569-1.8109-11.488-6.8476-4.0746-5.0367-4.0746-12.28 0-10.13 7.1872-16.015 7.2438-5.8855 19.807-5.8855 12.62 0 19.807 5.8855 7.1872 5.8855 7.1872 16.015 0 7.2438-4.1312 12.28-4.0746 5.0367-11.375 6.8476 8.2624 1.9241 12.846 7.5267 4.6405 5.6026 4.6405 13.695 0 12.28-7.5267 18.845-7.4701 6.5646-21.448 6.5646t-21.505-6.5646q-7.4701-6.5646-7.4701-18.845 0-8.0926 4.6405-13.695 4.6405-5.6026 12.903-7.5267zm-4.1878-18.053q0 6.5646 4.0746 10.243 4.1312 3.6785 11.545 3.6785 7.3569 0 11.488-3.6785 4.1878-3.6785 4.1878-10.243 0-6.5646-4.1878-10.243-4.1312-3.6785-11.488-3.6785-7.4135 0-11.545 3.6785-4.0746 3.6785-4.0746 10.243z"/></g></svg> diff --git a/icons/skins/default/9.svg b/icons/skins/default/9.svg new file mode 100644 index 0000000000000000000000000000000000000000..974bae0c18e620dd2d1d7827ec6dbde2845b8b5c --- /dev/null +++ b/icons/skins/default/9.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/><g stroke-width="2.8975" aria-label="9"><path d="m26.633 90.805v-10.413q4.301 2.0373 8.7151 3.1125t8.6585 1.0752q11.318 0 17.26-7.5833 5.9987-7.6399 6.8476-23.146-3.2823 4.8669-8.319 7.4701t-11.149 2.6032q-12.677 0-20.09-7.6399-7.3569-7.6965-7.3569-20.996 0-13.016 7.6965-20.882 7.6965-7.8663 20.486-7.8663 14.657 0 22.354 11.262 7.7531 11.205 7.7531 32.597 0 19.977-9.5074 31.918-9.4508 11.884-25.466 11.884-4.301 0-8.7151-0.84888t-9.1679-2.5466zm22.75-35.823q7.6965 0 12.167-5.263 4.5273-5.263 4.5273-14.431 0-9.1113-4.5273-14.374-4.4708-5.3196-12.167-5.3196-7.6965 0-12.224 5.3196-4.4708 5.263-4.4708 14.374 0 9.1679 4.4708 14.431 4.5273 5.263 12.224 5.263z"/></g></svg> diff --git a/icons/skins/empty.svg b/icons/skins/empty.svg new file mode 100644 index 0000000000000000000000000000000000000000..5cb26d72018dad1fe762c5e76dfc013a4dc1cd5c --- /dev/null +++ b/icons/skins/empty.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 98.851 99.618" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="98.851" height="99.618" ry="1.795" fill="#e5e5e5"/></svg> diff --git a/lib/entities/cell.dart b/lib/entities/cell.dart new file mode 100644 index 0000000000000000000000000000000000000000..f5ae94258b8689efb6ce2a68e991941fb7cf025e --- /dev/null +++ b/lib/entities/cell.dart @@ -0,0 +1,95 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../provider/data.dart'; + +class Cell { + int value; + final int col; + final int row; + + Cell( + @required this.value, + @required this.col, + @required this.row, + ); + + Container widget(Data myProvider) { + String imageAsset = 'assets/skins/empty.png'; + if (this.value > 0) { + imageAsset = 'assets/skins/' + myProvider.skin + '_' + this.value.toString() + '.png'; + } + + int size = myProvider.size; + + double borderWidth = 3; + Color borderDarkColor = Colors.black; + Color borderLightColor = Colors.grey; + Color borderSelectedColor = Colors.red; + + Border borders = Border( + top: BorderSide(width: borderWidth, color: ((this.row % size) == 0) ? borderDarkColor : borderLightColor), + left: BorderSide(width: borderWidth, color: ((this.col % size) == 0) ? borderDarkColor : borderLightColor), + right: BorderSide(width: borderWidth, color: (((this.col + 1) % size) == 0) ? borderDarkColor : borderLightColor), + bottom: BorderSide(width: borderWidth, color: (((this.row + 1) % size) == 0) ? borderDarkColor : borderLightColor), + ); + + if (this.col == myProvider.currentCellCol && this.row == myProvider.currentCellRow) { + borders = Border.all( + color: borderSelectedColor, + width: borderWidth, + ); + } + + return Container( + decoration: BoxDecoration( + color: Colors.white, + border: borders, + ), + child: GestureDetector( + child: Image( + image: AssetImage(imageAsset), + fit: BoxFit.fill + ), + onTap: () { + if (this.col != null && this.row != null) { + if (this.col != myProvider.currentCellCol || this.row != myProvider.currentCellRow) { + myProvider.selectCell(this.col, this.row); + } else { + myProvider.selectCell(null, null); + } + } + }, + ) + ); + } + + Container widgetUpdateValue(Data myProvider) { + String imageAsset = 'assets/skins/empty.png'; + if (this.value > 0) { + imageAsset = 'assets/skins/' + myProvider.skin + '_' + this.value.toString() + '.png'; + } + + return Container( + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.black, + width: 2, + ), + ), + child: GestureDetector( + child: Image( + image: AssetImage(imageAsset), + fit: BoxFit.fill + ), + onTap: () { + if (this.col != null && this.row != null) { + myProvider.updateCellValue(this.col, this.row, this.value); + } + myProvider.selectCell(null, null); + }, + ) + ); + } +} diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 4cc589c9909302b9db1c6aee006128755da24337..da43d26d92bd73f661d30f944e538a27d945995b 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -2,26 +2,109 @@ import 'package:flutter/foundation.dart'; class Data extends ChangeNotifier { - // randomization - bool _searchingImage = false; - String _image = ''; + // Configuration available values + List _availableDifficultyLevels = ['easy', 'medium', 'hard']; + List _availableSizes = [2, 3]; + List _availableSkins = ['default']; - bool get searchingImage => _searchingImage; + List get availableDifficultyLevels => _availableDifficultyLevels; + List get availableSizes => _availableSizes; + List get availableSkins => _availableSkins; - set searchingImage(bool value) { - _searchingImage = value; + // Application default configuration + String _level = 'medium'; + int _size = 3; + String _skin = 'default'; + + // Game data + bool _stateRunning = false; + List _cells = []; + int _currentCellCol = null; + int _currentCellRow = null; + + String get level => _level; + set updateLevel(String level) { + _level = level; notifyListeners(); } - String get image => _image; + int get size => _size; + set updateSize(int size) { + _size = size; + notifyListeners(); + } + + String get skin => _skin; + set updateSkin(String skin) { + _skin = skin; + notifyListeners(); + } + + getParameterValue(String parameterCode) { + switch(parameterCode) { + case 'difficulty': { return _level; } + break; + case 'size': { return _size; } + break; + case 'skin': { return _skin; } + break; + } + } + + List getParameterAvailableValues(String parameterCode) { + switch(parameterCode) { + case 'difficulty': { return _availableDifficultyLevels; } + break; + case 'size': { return _availableSizes; } + break; + case 'skin': { return _availableSkins; } + break; + } + } + + setParameterValue(String parameterCode, var parameterValue) { + switch(parameterCode) { + case 'difficulty': { updateLevel = parameterValue; } + break; + case 'size': { updateSize = parameterValue; } + break; + case 'skin': { updateSkin = parameterValue; } + break; + } + } + + List get cells => _cells; + set updateCells(List cells) { + _cells = cells; + notifyListeners(); + } + + int get currentCellCol => _currentCellCol; + set updateCurrentCellCol(int currentCellCol) { + _currentCellCol = currentCellCol; + notifyListeners(); + } + + int get currentCellRow => _currentCellRow; + set updateCurrentCellRow(int currentCellRow) { + _currentCellRow = currentCellRow; + notifyListeners(); + } + + selectCell(int col, int row) { + _currentCellCol = col; + _currentCellRow = row; + notifyListeners(); + } - set updateImage(String value) { - _image = value; + updateCellValue(int col, int row, int value) { + _cells[row][col].value = value; notifyListeners(); } - void resetGame() { - _image = ''; + bool get stateRunning => _stateRunning; + set updateStateRunning(bool stateRunning) { + _stateRunning = stateRunning; notifyListeners(); } } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index de5b013cbc5546929f28bc30f755ce563138a686..62d21550892ca04a9545ac231631aaa930bf856b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,57 +1,235 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../entities/cell.dart'; import '../provider/data.dart'; class Home extends StatelessWidget { static const String id = 'home'; - @override - Widget build(BuildContext context) { - Data _myProvider = Provider.of<Data>(context); + static const double _parameterButtonSize = 70; + static const double _startButtonSize = 150; - return Scaffold( - appBar: AppBar( - title: Text('Sudoku'), + Future<void> resetGame(Data myProvider) async { + myProvider.updateStateRunning = false; + } + + Future<void> startGame(Data myProvider) async { + myProvider.updateStateRunning = true; + myProvider.updateCells = createEmptyBoard(myProvider.size); + } + + List createEmptyBoard(int size) { + int index = 0; + List cells = []; + for (var rowIndex = 0; rowIndex < (size * size); rowIndex++) { + List row = []; + for (var colIndex = 0; colIndex < (size * size); colIndex++) { + row.add( + Cell( + (index++ % ((size * size) + 1)), // for debug purpose only :') + colIndex, + rowIndex + ) + ); + } + cells.add(row); + } + + return cells; + } + + Container _buildParametersSelector(Data myProvider) { + return Container( + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _buildParameterSelector(myProvider, 'difficulty'), + _buildParameterSelector(myProvider, 'size'), + _buildParameterSelector(myProvider, 'skin'), + + _buildStartGameButton(myProvider), + ], ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: <Widget>[ - Container( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.all(4), - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(4), - border: Border.all( - color: Colors.green, - width: 4, - ), - ), - child: FlatButton( - child: Text( - '🎲', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 50, - fontWeight: FontWeight.w600, - color: Colors.black, - ), - ), - ), + ); + } + + Column _buildStartGameButton(Data myProvider) { + return Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + child: Image( + image: AssetImage('assets/icons/button_start.png'), + width: _startButtonSize, + height: _startButtonSize, + fit: BoxFit.fill + ), + onPressed: () => startGame(myProvider), + ) + ], + ); + } + + Column _buildParameterSelector(Data myProvider, String parameterCode) { + List availableValues = myProvider.getParameterAvailableValues(parameterCode); + + return Column( + children: [ + Table( + defaultColumnWidth: IntrinsicColumnWidth(), + children: [ + TableRow( + children: [ + for (var index = 0; index < availableValues.length; index++) + Column( + children: [ + _buildParameterButton(myProvider, parameterCode, availableValues[index]) + ] ), - ], - ), + ], ), ], ), + SizedBox(height: 20), + ] + ); + } + + FlatButton _buildParameterButton(Data myProvider, String parameterCode, var parameterValue) { + String currentValue = myProvider.getParameterValue(parameterCode).toString(); + + bool isActive = (parameterValue.toString() == currentValue); + String imageAsset = 'assets/icons/' + parameterCode + '_' + parameterValue.toString() + '.png'; + + return FlatButton( + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + border: Border.all( + color: isActive ? Colors.blue : Colors.white, + width: 10, + ), + ), + child: Image( + image: AssetImage(imageAsset), + width: _parameterButtonSize, + height: _parameterButtonSize, + fit: BoxFit.fill + ), + ), + onPressed: () => myProvider.setParameterValue(parameterCode, parameterValue), + ); + } + + Container _buildGameWidget(Data myProvider) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildGameBoard(myProvider), + SizedBox(height: 2), + _buildSelectCellValueBar(myProvider) + ], + ), + ); + } + + Container _buildGameBoard(Data myProvider) { + List cells = myProvider.cells; + int size = myProvider.size; + + Color borderColor = _checkBoardIsSolved(cells) ? Colors.green : Colors.orange; + + return Container( + margin: EdgeInsets.all(2), + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: borderColor, + borderRadius: BorderRadius.circular(2), + border: Border.all( + color: borderColor, + width: 2, + ), + ), + + child: Table( + defaultColumnWidth: IntrinsicColumnWidth(), + children: [ + for (var row = 0; row < (size * size); row++) + TableRow(children: [ + for (var col = 0; col < (size * size); col++) + Column(children: [ + cells[row][col].widget(myProvider) + ]), + ]), + ] + ), + ); + } + + Container _buildSelectCellValueBar(Data myProvider) { + List cells = myProvider.cells; + int size = myProvider.size; + + Color borderColor = Colors.blue; + + bool isCellSelected = (myProvider.currentCellCol != null && myProvider.currentCellRow != null); + + return Container( + margin: EdgeInsets.all(2), + padding: EdgeInsets.all(2), + + child: Table( + defaultColumnWidth: IntrinsicColumnWidth(), + children: [ + TableRow( + children: [ + for (var value = 0; value < ((size * size) + 1); value++) + Column( + children: [ + Cell( + isCellSelected ? value : 0, + isCellSelected ? myProvider.currentCellCol : null, + isCellSelected ? myProvider.currentCellRow : null + ).widgetUpdateValue(myProvider) + ] + ), + ] + ), + ] ), ); } + + bool _checkBoardIsSolved(List cells) { + return false; + } + + @override + Widget build(BuildContext context) { + Data myProvider = Provider.of<Data>(context); + + return Scaffold( + appBar: AppBar( + title: Text('🔢'), + actions: [ + if (myProvider.stateRunning) + FlatButton( + child: Text('◀️'), + onPressed: () => resetGame(myProvider), + ), + ], + ), + body: SafeArea( + child: Center( + child: myProvider.stateRunning ? _buildGameWidget(myProvider) : _buildParametersSelector(myProvider) + ), + ) + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index dc063f6077c552206d6227c1ccf605db77b3a4a2..bbdc44266459b33a8a7cffbeed5bac5f1790b02d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,4 +18,5 @@ dev_dependencies: flutter: uses-material-design: true assets: - - assets/files/ + - assets/icons/ + - assets/skins/