mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
* add package:http dependency in dad_jokes * add package:http dependency in filipino_cuisine * don't build package:http demos until flutter/flutter#34858 is resolved * update gallery * update github_dataviz * update particle_background * don't build github_dataviz (uses package:http) * update slide_puzzle * update spinning_square * update timeflow * update vision_challenge * update charts * update dad_jokes * update filipino cuisine * ignore build output * update timeflow and vision_challenge * update slide_puzzle * don't commit build/ directory * move preview.png images to assets * fix path url join * update readme * update web/readme.md
A fun game to test your color perception abilities.
Contributed as part of the Flutter Create 5K challenge by Yukkei Choi.
How to play
Tap the unique color block as fast as possible.
Features
- Each round when user taps the unique color block, score will be increased by one.
- Timer: 30 seconds countdown.
- Color difference will be stepwise reduced when user reached a higher score.
- If it is difficult to distinguish the unique color block, user can "SHAKE" the device to shift to another theme color, while the position of the unique color block still keep the same.
- Provide a restart button at the end, user can infinitely play again without relaunching the app.
- After each replay, game board's theme color will be different from the previous play.
- Give user a grade based on the final score:
| score range | grade |
|---|---|
| 0 - 9 | Fail |
| 10 - 19 | D |
| 20 - 29 | C |
| 30 - 34 | B |
| 35 - 39 | B+ |
| 40 - 44 | A |
| 45 or above | A+ |
Graphics
- I created all graphics used on the app by using Photoshop.
- Flutter is great and now I'm able to demonstrate my artwork on the app into practice.
Techniques used
- Use stateful widget to run the timer countdown animation.
- Since only 5kb is allowed, the grade is calculated by using math, instead of writing if-else statement.
- Use redux to store the game states:
| state | description | data type |
|---|---|---|
| score | Store the player score | int |
| board | Locate the position of unique color block | [[int],[int],...] |
| count | Count the no. of replay, for switching the theme color | int |
| page | Current page / game status | int |
| page | description |
|---|---|
| -1 | First launch the app, show the welcome screen with instruction |
| 0 | Game in progress |
| 1 | Game end, show result |
Limitation
Limited to portrait view.