diff --git a/android/gradle.properties b/android/gradle.properties index 663881258a10822c0b4abc064b6e0bc0ccf48833..81949dfd2077495aaea8a6bc81ad9c75442f9ebb 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.13 -app.versionCode=13 +app.versionName=0.0.14 +app.versionCode=14 diff --git a/assets/images/blank.png b/assets/images/blank.png new file mode 100644 index 0000000000000000000000000000000000000000..71f46e2afe84d6655d32e85d164c463cdfc5dabc Binary files /dev/null and b/assets/images/blank.png differ diff --git a/assets/images/left-foot.png b/assets/images/left-foot.png new file mode 100644 index 0000000000000000000000000000000000000000..fd46c1a8ac871945c801a6a353ebb0b70639df7f Binary files /dev/null and b/assets/images/left-foot.png differ diff --git a/assets/images/left-hand.png b/assets/images/left-hand.png new file mode 100644 index 0000000000000000000000000000000000000000..34d676bb3985fe6479e20d003c1be4370d20857d Binary files /dev/null and b/assets/images/left-hand.png differ diff --git a/assets/images/right-foot.png b/assets/images/right-foot.png new file mode 100644 index 0000000000000000000000000000000000000000..d0eff85495b7b8910389f948a712b02cde1909ef Binary files /dev/null and b/assets/images/right-foot.png differ diff --git a/assets/images/right-hand.png b/assets/images/right-hand.png new file mode 100644 index 0000000000000000000000000000000000000000..e730e5f4c58c8bdf3444ae7ff7ad45fe3e32e3e3 Binary files /dev/null and b/assets/images/right-hand.png differ diff --git a/fastlane/metadata/android/en-US/changelogs/14.txt b/fastlane/metadata/android/en-US/changelogs/14.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a040981bf91c71612092814c8dcf11ea80566f --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/14.txt @@ -0,0 +1 @@ +Improve layout, add images. diff --git a/fastlane/metadata/android/fr-FR/changelogs/14.txt b/fastlane/metadata/android/fr-FR/changelogs/14.txt new file mode 100644 index 0000000000000000000000000000000000000000..679e3e204b041c178a2e30cd0b77554afd33712d --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/14.txt @@ -0,0 +1 @@ +Amélioration de l'affichage, ajout d'images. diff --git a/images/blank.svg b/images/blank.svg new file mode 100644 index 0000000000000000000000000000000000000000..762c431a753905186f524427fdcf8f0f706ec896 --- /dev/null +++ b/images/blank.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="512" height="512" version="1.1" viewBox="0 0 1.707 1.707" xmlns="http://www.w3.org/2000/svg"/> diff --git a/images/build_game_images.sh b/images/build_game_images.sh new file mode 100755 index 0000000000000000000000000000000000000000..4d7f1be1f63651c82db63cbd8217cde60fa2bd3f --- /dev/null +++ b/images/build_game_images.sh @@ -0,0 +1,80 @@ +#! /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=512 + +####################################################### + +# Game images +AVAILABLE_GAME_IMAGES=" + blank + left-hand + right-hand + left-foot + right-foot +" +####################################################### + +# 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 folder +mkdir -p ${ASSETS_DIR}/images + +# Delete existing generated images +find ${ASSETS_DIR}/images -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}/images/${GAME_IMAGE}.png +done + diff --git a/images/left-foot.svg b/images/left-foot.svg new file mode 100644 index 0000000000000000000000000000000000000000..77b20cb7636e770375b15d685d9774f7fe974757 --- /dev/null +++ b/images/left-foot.svg @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="512" height="512" version="1.1" viewBox="0 0 1.707 1.707" xmlns="http://www.w3.org/2000/svg"> + <g transform="matrix(-.018646 0 0 .018646 1.7858 -.078555)"> + <path d="m60.3 28.6c-2.7-1.4-5.7-2.5-8.7-3.2-6.4-1.4-14.2 0.1-17.9 5.9-3.5 5.5-1.6 11.6 1.8 16.6 2.6 4 6.9 8 7.4 13 0.1 1.5-0.2 3-0.8 4.3-1.5 3.2-2.7 7-3 10.6-0.7 7.5 6.5 15.8 14.3 13.9 3.3-0.8 6.5-3.3 8.5-7.3 1.3-2.6 2.1-5.7 2.9-8.5 2-6.6 2.9-13.5 3.5-20.3 0.6-6.9 1.4-14.5-2.2-20-1.3-2-3.1-3.7-5.8-5z"/> + <ellipse cx="67.5" cy="26.8" rx="2.8" ry="4.2"/> + <ellipse cx="61.4" cy="21.6" rx="2.9" ry="4.3"/> + <ellipse cx="54.3" cy="18.7" rx="3.3" ry="5"/> + <ellipse cx="45.9" cy="17.4" rx="3.8" ry="5.6"/> + <ellipse cx="35.1" cy="18.1" rx="5.4" ry="8.1"/> + </g> +</svg> diff --git a/images/left-hand.svg b/images/left-hand.svg new file mode 100644 index 0000000000000000000000000000000000000000..3f23f946eba8d232adc7bcdca0f91c23f35de690 --- /dev/null +++ b/images/left-hand.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="512" height="512" version="1.1" viewBox="0 0 1.707 1.707" xmlns="http://www.w3.org/2000/svg"> + <path d="m0.46238 0.46639v0.68163a0.34131 0.34131 0 0 0 0.66514 0.10834 0.68839 0.68839 0 0 1 0.056047-0.12444l0.12961-0.22463a0.085326 0.085326 0 1 0-0.1477-0.085477l-0.093031 0.16042v-0.59079a0.065997 0.065997 0 0 0-0.077923-0.065002 0.067985 0.067985 0 0 0-0.0539 0.067983v0.39062a0.013716 0.013716 0 0 1-0.013714 0.013892 0.013716 0.013716 0 0 1-0.013713-0.013892v-0.50153a0.066196 0.066196 0 0 0-0.079312-0.065002 0.067985 0.067985 0 0 0-0.053662 0.067983v0.49855a0.013915 0.013915 0 0 1-0.013892 0.013892 0.013716 0.013716 0 0 1-0.013713-0.013892v-0.42957a0.065997 0.065997 0 0 0-0.077726-0.065002 0.067985 0.067985 0 0 0-0.0539 0.067983v0.42659a0.013716 0.013716 0 0 1-0.013713 0.013892 0.013716 0.013716 0 0 1-0.013714-0.013892v-0.32164a0.066196 0.066196 0 0 0-0.077726-0.065002 0.067985 0.067985 0 0 0-0.053483 0.067983z" stroke-width=".019878"/> +</svg> diff --git a/images/right-foot.svg b/images/right-foot.svg new file mode 100644 index 0000000000000000000000000000000000000000..43df43458cb24faf50ac4205d261c3dec7f207d7 --- /dev/null +++ b/images/right-foot.svg @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="512" height="512" version="1.1" viewBox="0 0 1.707 1.707" xmlns="http://www.w3.org/2000/svg"> + <g transform="matrix(.018646 0 0 .018646 -.078787 -.078555)"> + <path d="m60.3 28.6c-2.7-1.4-5.7-2.5-8.7-3.2-6.4-1.4-14.2 0.1-17.9 5.9-3.5 5.5-1.6 11.6 1.8 16.6 2.6 4 6.9 8 7.4 13 0.1 1.5-0.2 3-0.8 4.3-1.5 3.2-2.7 7-3 10.6-0.7 7.5 6.5 15.8 14.3 13.9 3.3-0.8 6.5-3.3 8.5-7.3 1.3-2.6 2.1-5.7 2.9-8.5 2-6.6 2.9-13.5 3.5-20.3 0.6-6.9 1.4-14.5-2.2-20-1.3-2-3.1-3.7-5.8-5z"/> + <ellipse cx="67.5" cy="26.8" rx="2.8" ry="4.2"/> + <ellipse cx="61.4" cy="21.6" rx="2.9" ry="4.3"/> + <ellipse cx="54.3" cy="18.7" rx="3.3" ry="5"/> + <ellipse cx="45.9" cy="17.4" rx="3.8" ry="5.6"/> + <ellipse cx="35.1" cy="18.1" rx="5.4" ry="8.1"/> + </g> +</svg> diff --git a/images/right-hand.svg b/images/right-hand.svg new file mode 100644 index 0000000000000000000000000000000000000000..b825b281b7d61de4cc72ff6dd804340a73299f71 --- /dev/null +++ b/images/right-hand.svg @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="512" height="512" version="1.1" viewBox="0 0 1.707 1.707" xmlns="http://www.w3.org/2000/svg"> + <path d="m1.2446 0.46639v0.68163a0.34131 0.34131 0 0 1-0.66514 0.10834 0.68839 0.68839 0 0 0-0.056047-0.12444l-0.12961-0.22463a0.085326 0.085326 0 1 1 0.1477-0.085477l0.093031 0.16042v-0.59079a0.065997 0.065997 0 0 1 0.077923-0.065002 0.067985 0.067985 0 0 1 0.0539 0.067983v0.39062a0.013716 0.013716 0 0 0 0.013714 0.013892 0.013716 0.013716 0 0 0 0.013714-0.013892v-0.50153a0.066196 0.066196 0 0 1 0.079312-0.065002 0.067985 0.067985 0 0 1 0.053662 0.067983v0.49855a0.013915 0.013915 0 0 0 0.013892 0.013892 0.013716 0.013716 0 0 0 0.013713-0.013892v-0.42957a0.065997 0.065997 0 0 1 0.077726-0.065002 0.067985 0.067985 0 0 1 0.0539 0.067983v0.42659a0.013716 0.013716 0 0 0 0.013713 0.013892 0.013716 0.013716 0 0 0 0.013714-0.013892v-0.32164a0.066196 0.066196 0 0 1 0.077726-0.065002 0.067985 0.067985 0 0 1 0.053483 0.067983z" stroke-width=".019878"/> +</svg> diff --git a/lib/ui/widgets/game.dart b/lib/ui/widgets/game.dart index a88bae4728e2e7c228cc2be262cd81bdf9768fec..51d9077828e4d5d409d419cb4f29a743705834a4 100644 --- a/lib/ui/widgets/game.dart +++ b/lib/ui/widgets/game.dart @@ -1,7 +1,6 @@ import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:unicons/unicons.dart'; import 'package:twister/cubit/game_cubit.dart'; import 'package:twister/models/move.dart'; @@ -17,32 +16,21 @@ class Game extends StatefulWidget { class _GameState extends State<Game> { final player = AudioPlayer(); - Widget pickNewMove() { - return BlocBuilder<GameCubit, GameState>(builder: (BuildContext context, GameState state) { - return TextButton( - onPressed: () { - Move newMove = Move.pickRandom(); - - BlocProvider.of<GameCubit>(context).setValues( - move: newMove, - ); - - player.play(AssetSource(newMove.toSoundAsset())); - }, - child: Icon(UniconsSolid.refresh), - ); - }); - } - @override Widget build(BuildContext context) { return BlocBuilder<GameCubit, GameState>( - builder: (context, gameState) { - return Column( - children: [ - ShowMove(move: gameState.move ?? Move.createNull()), - pickNewMove(), - ], + builder: (BuildContext context, GameState gameState) { + return GestureDetector( + child: ShowMove(move: gameState.move ?? Move.createNull()), + onTap: () { + Move newMove = Move.pickRandom(); + + BlocProvider.of<GameCubit>(context).setValues( + move: newMove, + ); + + player.play(AssetSource(newMove.toSoundAsset())); + }, ); }, ); diff --git a/lib/ui/widgets/show_move.dart b/lib/ui/widgets/show_move.dart index adead4b605b53ab8619ac84183ae01cd79df1342..b1250a3ce0e96591b7b408bed7e1cc727106b5fe 100644 --- a/lib/ui/widgets/show_move.dart +++ b/lib/ui/widgets/show_move.dart @@ -26,7 +26,13 @@ class ShowMove extends StatelessWidget { } } - Widget getWidget(Move move) { + Widget getImageWidget(Move move) { + String imageAsset = 'assets/images/' + (move.member?.toString() ?? 'blank') + '.png'; + + return Image.asset(imageAsset); + } + + Widget getTextWidget(Move move) { TextStyle style = TextStyle( color: Colors.black, fontSize: 30, @@ -47,23 +53,39 @@ class ShowMove extends StatelessWidget { } } - @override - Widget build(BuildContext context) { + Widget buildWidget(Move move, double maxWidth) { Color color = getColor(move); - return Container( - child: Padding( - padding: EdgeInsets.all(20), - child: getWidget(move), - ), - decoration: BoxDecoration( - color: color, - borderRadius: BorderRadius.all(Radius.circular(50)), - border: Border.all( - color: color.darken(20), - width: 10, + double containerSize = maxWidth * 0.8; + + return AnimatedSwitcher( + duration: const Duration(milliseconds: 200), + transitionBuilder: (Widget child, Animation<double> animation) { + return ScaleTransition(child: child, scale: animation); + }, + child: Container( + width: containerSize, + height: containerSize, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.all(Radius.circular(containerSize)), + border: Border.all( + color: color.darken(15), + width: 15, + ), ), + child: getImageWidget(move), ), ); } + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, constraints) { + final double maxWidth = constraints.maxWidth; + return buildWidget(move, maxWidth); + }, + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 360af894b750f87461cc8ed84086ca4460371f86..f751a47966215180a7290db6e9d97bd72f109777 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: twister game companion publish_to: 'none' -version: 0.0.13+13 +version: 0.0.14+14 environment: sdk: '^3.0.0' @@ -23,6 +23,7 @@ dependencies: flutter: uses-material-design: false assets: + - assets/images/ - assets/translations/ - assets/voices/