Skip to content
Snippets Groups Projects
Commit 61cc90e2 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Create initial empty application

parent 943c90e5
No related branches found
No related tags found
1 merge request!1Resolve "Create empty application"
Pipeline #4023 passed
Showing
with 977 additions and 0 deletions
Synthé MIDI
\ No newline at end of file
Synthé MIDI
\ No newline at end of file
AuthorName: 'Benoît Harrault'
Categories:
- Games
- Music
Name: MIDI Synth
AutoName: MidiSynth
License: GPL-3.0-only
WebSite: 'https://git.harrault.fr/android/org.benoitharrault.midisynth'
SourceCode: https://git.harrault.fr/android/org.benoitharrault.midisynth
IssueTracker: https://git.harrault.fr/android/org.benoitharrault.midisynth/issues
Changelog: https://git.harrault.fr/android/org.benoitharrault.midisynth/-/tags
Summary: MIDI Synth
Description: |-
MIDI Synth.
Play music with external MIDI master keyboard.
RepoType: git
Repo: 'https://git.harrault.fr/android/org.benoitharrault.midisynth.git'
#! /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}")"
ASSETS_DIR="${BASE_DIR}/assets"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
ICON_SIZE=192
#######################################################
# Game images
AVAILABLE_GAME_IMAGES="
button_back
button_start
placeholder
"
# Settings images
AVAILABLES_GAME_SETTINGS="
"
#######################################################
# 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 \
--quiet \
-i ${SOURCE}.tmp \
-o ${SOURCE}
rm ${SOURCE}.tmp
}
# build icons
function build_icon() {
SOURCE="$1"
TARGET="$2"
echo "Building ${TARGET}"
if [ ! -f "${SOURCE}" ]; then
echo "Missing file: ${SOURCE}"
exit 1
fi
optimize_svg "${SOURCE}"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET} \
${SOURCE}
optipng ${OPTIPNG_OPTIONS} ${TARGET}
}
#######################################################
# Create output folders
mkdir -p ${ASSETS_DIR}/icons
# Delete existing generated images
find ${ASSETS_DIR}/icons -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
#! /bin/bash
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
"${CURRENT_DIR}/build_application_icons.sh"
"${CURRENT_DIR}/build_repository_icons.sh"
#! /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}")"
SOURCE_ICON="${CURRENT_DIR}/icon.svg"
SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"
SOURCE_LAUNCH_IMAGE="${CURRENT_DIR}/icon.svg"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
if [ ! -f "${SOURCE_ICON}" ]; then
echo "Missing file: ${SOURCE_ICON}"
fi
if [ ! -f "${SOURCE_FASTLANE}" ]; then
echo "Missing file: ${SOURCE_FASTLANE}"
fi
if [ ! -f "${SOURCE_LAUNCH_IMAGE}" ]; then
echo "Missing file: ${SOURCE_LAUNCH_IMAGE}"
fi
function optimize_svg() {
SVG="$1"
cp ${SVG} ${SVG}.tmp
scour \
--remove-descriptive-elements \
--enable-id-stripping \
--enable-viewboxing \
--enable-comment-stripping \
--nindent=4 \
--quiet \
-i ${SVG}.tmp \
-o ${SVG}
rm ${SVG}.tmp
}
# optimize source svg files
optimize_svg ${SOURCE_ICON}
optimize_svg ${SOURCE_FASTLANE}
optimize_svg ${SOURCE_LAUNCH_IMAGE}
# build icons
function build_application_icon() {
ICON_SIZE="$1"
TARGET="$2"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE_ICON}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
# build fastlane image
function build_fastlane_image() {
WIDTH="$1"
HEIGHT="$2"
TARGET="$3"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${WIDTH} \
--export-height=${HEIGHT} \
--export-filename=${TARGET_PNG} \
${SOURCE_FASTLANE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
# build launch images (splash screen)
function build_launch_image() {
ICON_SIZE="$1"
TARGET="$2"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE_LAUNCH_IMAGE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
build_application_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher
build_application_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher
build_application_icon 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher
build_application_icon 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher
build_application_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher
build_application_icon 512 ${BASE_DIR}/fastlane/metadata/android/en-US/images/icon
build_launch_image 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/launch_image
build_launch_image 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/launch_image
build_launch_image 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/launch_image
build_launch_image 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/launch_image
build_launch_image 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/launch_image
build_fastlane_image 1024 500 ${BASE_DIR}/fastlane/metadata/android/en-US/images/featureGraphic
<?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"><rect x=".44662" y=".89101" width="92.772" height="91.894" ry="11.689" fill="#e41578" stroke="#fff" stroke-width=".238"/><path d="m59.387 71.362c1.1248 1.1302 4.0012 1.1302 4.0012 0v-45.921c0-1.1316-2.8832-1.1316-4.0121 0l-37.693 20.918c-1.1289 1.1248-1.1479 2.9551-0.02171 4.084z" fill="#fefeff" stroke="#930e4e" stroke-linecap="round" stroke-linejoin="round" stroke-width="8.257"/><path d="m57.857 68.048c0.96243 0.96706 3.4236 0.96706 3.4236 0v-39.292c0-0.96825-2.467-0.96825-3.4329 0l-32.252 17.898c-0.96594 0.96243-0.9822 2.5285-0.01858 3.4945z" fill="#fefeff" stroke="#feffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4.314"/></svg>
<?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"><rect x=".44662" y=".89101" width="92.772" height="91.894" ry="11.689" fill="#49a1ee" stroke="#fff" stroke-width=".238"/><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="#fefeff" stroke="#105ca1" stroke-linecap="round" stroke-linejoin="round" stroke-width="8.257"/><path d="m36.382 28.754c-0.96243-0.96706-3.4236-0.96706-3.4236 0v39.292c0 0.96825 2.467 0.96825 3.4329 0l32.252-17.898c0.96594-0.96243 0.9822-2.5285 0.01858-3.4945z" fill="#fefeff" stroke="#feffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4.314"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 1024 500" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="1024" height="500" rx="0" ry="0" fill="#977cff"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 28.747 28.747" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="filter6206-7" x="-.072" y="-.072" width="1.144" height="1.144" color-interpolation-filters="sRGB">
<feGaussianBlur stdDeviation="0.658125"/>
</filter>
</defs>
<g transform="translate(0 -1093.8)">
<path transform="matrix(1.0781 0 0 1.0641 -.093733 2.7509)" d="m4.4177 1028.2v1.6051h-1.6052v18.192h1.6052v2.1402h18.192v-2.1402h2.1402v-18.192h-2.1402v-1.6051z" fill="#1a237e" filter="url(#filter6206-7)" opacity=".2"/>
<rect x="2.9987" y="1096.8" width="22.749" height="22.749" rx="1.1973" ry="1.1974" fill="#9c27b0"/>
<g transform="translate(-22.32 1056.5)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
<g transform="matrix(.33601 0 0 .33601 1.5296 73.043)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
</g>
<g transform="matrix(.37187 0 0 .37187 38.802 63.239)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
<g transform="matrix(2.6891 0 0 2.6891 -82.906 -48.45)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
</g>
</g>
</g>
<path d="m4.1958 1096.8c-0.66332 0-1.1979 0.5346-1.1979 1.1979v0.3334c0-0.6634 0.53459-1.1979 1.1979-1.1979h20.354c0.66332 0 1.1979 0.5345 1.1979 1.1979v-0.3334c0-0.6633-0.5346-1.1979-1.1979-1.1979z" fill="#fff" opacity=".2"/>
<rect x="128" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="128" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="128" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="128" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="128" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="128" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="213.33" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="298.67" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="170.67" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="256" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="589.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="631.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="717.19" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="546.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="674.52" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="341.33" y="759.85" width="42.667" height="42.667" fill="none" stroke-width="1.0667"/>
<rect x="160" y="578.52" width="192" height="192" fill="none" stroke-width="1.0667"/>
<g transform="matrix(.37344 0 0 .37344 4.7333 1097.4)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
</g>
<g transform="matrix(.36471 0 0 .36471 5.1356 1097.4)">
<path d="m0 0h51.2v51.2h-51.2z" fill="none" stroke-width="1.0667"/>
</g>
<g transform="matrix(.41585 0 0 .41585 84.325 1055.9)">
<g transform="matrix(.062269 0 0 .062269 -28.238 185.29)">
<g transform="matrix(38.618 0 0 38.618 14724 -13542)">
<g transform="matrix(.71436 0 0 .71436 -400.52 188.34)">
<path d="m1293.2-120.67c-181.75 0.2763-511.18 0.13525-699.05 0.13998-2.3216 10.413-3.593 21.251-3.593 32.384v114c207.65 0.73695 494.72 0.38136 706.23 0.3733v-114.37c0-11.18-1.2522-22.07-3.593-32.523zm-458.69 295.56c-78.385-4e-3 -158.85 0.17892-243.95 0.55995v138.63c286.34-0.39317 421.73-0.13827 706.23-0.32664v-137.75c-163.2-0.53005-311.22-1.1113-462.28-1.1199z" opacity="0" stroke-width="1.4932"/>
</g>
</g>
</g>
</g>
<path d="m24.549 1119.5c0.66325 0 1.1979-0.5346 1.1979-1.1979v-0.3333c0 0.6632-0.53461 1.1978-1.1979 1.1978h-20.354c-0.66325 0-1.1979-0.5346-1.1979-1.1978v0.3333c0 0.6633 0.53461 1.1979 1.1979 1.1979z" fill="#1a237e" opacity=".2"/>
</g>
<g transform="matrix(.030895 0 0 .030895 3.56 1.0629)" fill="#fff">
<path d="m561.01 391.11h-422.01c-11.246 0-20.406 9.1445-20.406 20.391v128.86c0 11.246 9.1445 20.406 20.406 20.406h422.01c5.9531 0 11.316-2.5664 15.043-6.6445h1.3984v-1.707c2.4844-3.3711 3.9492-7.5508 3.9492-12.051v-128.86c0-11.25-9.1445-20.391-20.391-20.391zm-368.74 154.72h-53.27c-3.0195 0-5.4609-2.457-5.4609-5.4609v-128.87c0-2.0469 1.1289-3.8242 2.7812-4.7539 13.617 0.0156 27.461-0.21094 40.754 0.15625 0.49219 58.039-0.16797 31.211 0.32422 89.261 4.5703 0.53516 10.273-0.16797 14.844 0.35156 0.25391 40.805 0.26953 8.3872 0.0273 49.305zm64.574 0h-62.852c-0.22656-40.922-0.22656-8.5042 0.043-49.305 4.9531-0.53516 11.035 0.18359 15.988-0.35156 0.38281-57.984 0.0547-30.601 0.16797-88.901 0.0859-0.25391 0.25391-0.4375 0.49219-0.53516 10.004 0.11328 20.434-0.23828 30.168 0.18359 0.38281 58.039 0.0547 30.731 0.15625 89.081 4.2344 0.55078 10.895-0.18359 15.664 0.35156 0.60937 40.457 0.33984 8.4652 0.17187 49.465zm63.598 0h-61.75c-0.53516-40.527-0.22656-9.3522-0.0703-49.485 4.5859-0.41016 10.684-0.0547 15-0.18359 0.76172-57.434 0.11328-31.281 0.32422-88.901 0-0.30859 0.12891-0.46484 0.32422-0.53516 15.383 0.11328 31.199-0.23828 46.312 0.18359-0.0977 99.02 0.21484 39.517-0.14062 138.92zm63.953 0h-62.188c-0.25391-99.383-0.25391-39.407 0.0156-138.75 0.11328-0.16797 0.29688-0.26953 0.49219-0.36719 15.227 0.11328 30.875-0.23828 45.832 0.18359 0.38281 57.926 0.0547 30.491 0.16797 88.721 4.5703 0.83203 10.539 0.12891 15.648 0.35156 0.24219 41 0.25781 8.7502 0.0312 49.855zm63.289 0h-61.566c-0.23828-41.09-0.22656-8.8602 0.043-49.855 5.0664-0.11328 10.539 0.23828 15.324-0.18359 0.38281-57.871 0.0547-30.381 0.16797-88.541 0.0977-0.25391 0.25391-0.4375 0.49219-0.53516 9.8359 0.11328 20.109-0.23828 29.676 0.18359 0.49219 58.168-0.16797 31.451 0.32422 89.611 4.8398 0.53516 10.809-0.16797 15.648 0.36719-0.0977 40.344-0.10938 8.1671-0.10938 48.945zm65.051 0h-63.23c-0.52344-40.43-0.22656-8.2662-0.0703-48.945 4.6836-0.53516 10.484 0.16797 15.168-0.36719 0.59375-50.25 0.32422-16.321 0.32422-67.531 0-7.2539-0.12891-15.238 0.16797-21.902 0.11328-0.16797 0.29688-0.26953 0.49219-0.36719 10.273 0.11328 20.984-0.23828 30.988 0.18359 0.38281 57.926 0.0547 31.451 0.15625 89.081 4.2891 0.66406 11.43-0.41016 15.988 0.53516 0.24219 40.816 0.25781 8.3992 0.0156 49.325zm53.734-5.4727c0 3.0195-2.457 5.4609-5.4609 5.4609h-46.539c-0.23828-40.797-0.22656-9.2272 0.043-49.485 4.6289-0.41016 9.9492-0.0547 14.844-0.18359 0.76172-57.434 0.11328-31.281 0.32422-88.901-0.0156-0.30859 0.12891-0.46484 0.32422-0.53516 11.133 0.0859 22.492-0.0859 33.641-0.0156 1.6914 0.92969 2.8359 2.7227 2.8359 4.7969l4e-3 128.86z" fill-rule="evenodd"/>
<path d="m241.58 300.89c-11.246 0-20.407 9.1456-20.407 20.392l1e-3 77.093 257.65 2e-3 2e-3 -77.092c0-11.25-9.1442-20.391-20.391-20.391v-4e-3zm37.444 25.037h15.312l10.625 24.968 10.688-24.968h15.281v46.655h-11.375v-34.125l-10.75 25.157h-7.6245l-10.75-25.157v34.125h-11.405zm60.199 0h12.032v46.655h-12.032zm20.326 0h12.687c3.1042 0 5.7192 0.0824 7.8442 0.24902 2.125 0.14584 4.2599 0.44841 6.4058 0.90674 2.1458 0.4375 4.062 1.1151 5.7495 2.0317 1.7083 0.89583 3.2922 2.0521 4.7505 3.4688 4.3125 4.1667 6.4688 9.7079 6.4688 16.625 0 2.5417-0.29118 4.9067-0.87451 7.0942-0.58334 2.1875-1.3646 4.0724-2.3438 5.6558-0.97917 1.5625-2.1468 2.9688-3.501 4.2188-1.3333 1.25-2.7282 2.2599-4.1865 3.0308-1.4375 0.77084-2.9588 1.3958-4.563 1.875-3.5 1-8.75 1.5-15.75 1.5h-12.687zm49.636 0h12.032v46.655h-12.032zm-37.605 9.0938v28.468h4.3125c4.875 0 8.6151-1.2074 11.219-3.624 2.625-2.4167 3.9375-5.9692 3.9375-10.657 0-4.6666-1.3026-8.1979-3.9067-10.594s-6.3542-3.5933-11.25-3.5933z"/>
</g>
</svg>
<?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"/>
import 'package:flutter/material.dart';
import 'package:midisynth/provider/data.dart';
class Board {
static Container buildGameBoard(Data myProvider, double screenWidth) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(''),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:midisynth/layout/board.dart';
import 'package:midisynth/provider/data.dart';
class Game {
static Container buildGameWidget(Data myProvider, double screenWidth) {
return Container(
child: Board.buildGameBoard(myProvider, screenWidth),
);
}
}
import 'package:flutter/material.dart';
import 'package:midisynth/provider/data.dart';
import 'package:midisynth/utils/game_utils.dart';
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) {
List<Widget> lines = [];
List parameters = myProvider.availableParameters;
for (var index = 0; index < parameters.length; index++) {
lines.add(buildParameterSelector(myProvider, parameters[index]));
lines.add(SizedBox(height: separatorHeight));
}
Widget buttonsBlock = buildStartNewGameButton(myProvider);
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: separatorHeight),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: lines,
),
),
SizedBox(height: separatorHeight),
Container(
child: buttonsBlock,
),
],
),
);
}
static Image buildImageWidget(String imageAssetCode) {
return Image(
image: AssetImage('assets/icons/' + imageAssetCode + '.png'),
fit: BoxFit.fill,
);
}
static Container buildImageContainerWidget(String imageAssetCode) {
return Container(
child: buildImageWidget(imageAssetCode),
);
}
static Column buildDecorationImageWidget() {
return Column(
children: [
TextButton(
child: buildImageContainerWidget('placeholder'),
onPressed: () => null,
),
],
);
}
static Container buildStartNewGameButton(Data myProvider) {
return Container(
margin: EdgeInsets.all(blockMargin),
padding: EdgeInsets.all(blockPadding),
child: Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(
children: [
buildDecorationImageWidget(),
Column(
children: [
TextButton(
child: buildImageContainerWidget('button_start'),
onPressed: () => GameUtils.startNewGame(myProvider),
),
],
),
buildDecorationImageWidget(),
],
),
],
),
);
}
static Widget buildParameterSelector(Data myProvider, String parameterCode) {
List availableValues = myProvider.getParameterAvailableValues(parameterCode);
if (availableValues.length == 1) {
return SizedBox(height: 0.0);
}
return Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(
children: [
for (var index = 0; index < availableValues.length; index++)
Column(
children: [
_buildParameterButton(myProvider, parameterCode, availableValues[index])
],
),
],
),
],
);
}
static Widget _buildParameterButton(
Data myProvider, String parameterCode, String parameterValue) {
String currentValue = myProvider.getParameterValue(parameterCode).toString();
bool isActive = (parameterValue == currentValue);
String imageAsset = parameterCode + '_' + parameterValue;
return TextButton(
child: Container(
margin: EdgeInsets.all(buttonMargin),
padding: EdgeInsets.all(buttonPadding),
decoration: BoxDecoration(
color: buttonBackgroundColor,
borderRadius: BorderRadius.circular(buttonBorderRadius),
border: Border.all(
color: isActive ? buttonBorderColorActive : buttonBorderColorInactive,
width: buttonBorderWidth,
),
),
child: buildImageWidget(imageAsset),
),
onPressed: () => myProvider.setParameterValue(parameterCode, parameterValue),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:midisynth/provider/data.dart';
import 'package:midisynth/screens/home.dart';
import 'package:provider/provider.dart';
import 'package:overlay_support/overlay_support.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((value) => runApp(MyApp()));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (BuildContext context) => Data(),
child: Consumer<Data>(builder: (context, data, child) {
return OverlaySupport(
child: MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Home(),
routes: {
Home.id: (context) => Home(),
},
),
);
}),
);
}
}
import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Data extends ChangeNotifier {
// Configuration available parameters
List _availableParameters = [];
List get availableParameters => _availableParameters;
// Application default configuration
// Application current configuration
String getParameterValue(String parameterCode) {
switch (parameterCode) {
}
return '';
}
List getParameterAvailableValues(String parameterCode) {
switch (parameterCode) {
}
return [];
}
void setParameterValue(String parameterCode, String parameterValue) async {
switch (parameterCode) {
}
final prefs = await SharedPreferences.getInstance();
prefs.setString(parameterCode, parameterValue);
}
// Game data
bool _gameIsRunning = false;
bool _gameIsFinished = false;
bool get isGameRunning => _gameIsRunning;
void updateGameIsRunning(bool gameIsRunning) {
_gameIsRunning = gameIsRunning;
notifyListeners();
}
bool get isGameFinished => _gameIsFinished;
void updateGameIsFinished(bool gameIsFinished) {
_gameIsFinished = gameIsFinished;
notifyListeners();
}
void redraw() {
notifyListeners();
}
void resetGame() {
_gameIsRunning = false;
_gameIsFinished = false;
notifyListeners();
}
}
import 'package:flutter/material.dart';
import 'package:midisynth/layout/game.dart';
import 'package:midisynth/layout/parameters.dart';
import 'package:midisynth/provider/data.dart';
import 'package:midisynth/utils/game_utils.dart';
import 'package:provider/provider.dart';
import 'package:overlay_support/overlay_support.dart';
class Home extends StatefulWidget {
static const String id = 'home';
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Data myProvider = Provider.of<Data>(context);
double screenWidth = MediaQuery.of(context).size.width;
List<Widget> menuActions = [];
if (myProvider.isGameRunning) {
menuActions = [
TextButton(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
border: Border.all(
color: Colors.blue,
width: 4,
),
),
child: Image(
image: AssetImage('assets/icons/button_back.png'),
fit: BoxFit.fill,
),
),
onPressed: () => toast('Long press to quit game...'),
onLongPress: () => GameUtils.quitGame(myProvider),
),
];
}
return Scaffold(
appBar: AppBar(
actions: menuActions,
),
body: SafeArea(
child: myProvider.isGameRunning
? Game.buildGameWidget(myProvider, screenWidth)
: Parameters.buildParametersSelector(myProvider),
),
);
}
}
import 'package:midisynth/provider/data.dart';
class GameUtils {
static Future<void> quitGame(Data myProvider) async {
myProvider.updateGameIsRunning(false);
}
static Future<void> startNewGame(Data myProvider) async {
print('Starting new game');
myProvider.resetGame();
myProvider.updateGameIsRunning(true);
}
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
overlay_support:
dependency: "direct main"
description:
name: overlay_support
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.8"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
provider:
dependency: "direct main"
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.5"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.17"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
sdks:
dart: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"
name: midisynth
description: MIDI Synth
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.16.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^6.0.2
shared_preferences: ^2.0.6
overlay_support: ^2.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/icons/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment