Flutter Create submission in 3838 KB of Dart code (after minification).
This app allows you to explore planets of the Solar System (Pluto included). Planets' sizes and distances from the Sun are arbitrary but orbital periods are preserved down to one Earth day (1 second is 1 day initially). You can control the speed of animation by tapping buttons on the bottom of the screen.
App was developed as a submission to Flutter Create contest. At the time of the project I was still learning Flutter and actually this was one of the first apps I made.
It uses custom Flare animations, flutter_hooks and matrix_gesture_detector.
Planet icons were bought on Iconfinder and then animated by me (and some of them were redrawn from scratch) in Flare.
Planetary data was taken from Wikipedia.
- I had to give up on code quality - there are some dirty hacks and workarounds applied to fit in 5 KB limit
- Most of the data is kept in
data.json
file and then accessed from dynamic Map - usually you would use some kind of json serialization mechanism - Minified code fits in single line with no extra spaces, single character names and badly formatted constructors - you wouldn't do this typically in jor day to day job, would you? ;)
- Everything is stored in a single
main.dart
file - No extracted custom widgets etc. and only couple of functions
- flutter_hooks to the rescue - it removed unnecessary boilerplate when using animation controllers
Transform
widget doesn't allow to detect taps (hits) outside its boundaries (see this issue), so I had to fit everything inside- Flare actors (animations) stutter when using Hero with them
- Widget disappears from original spot when animating with Hero - probably you could solve this by keeping two copies of the widget in Stack and apply Hero to one of them
- Some trigonometry knowledge required to revolve planets around the Sun ;)