Flutter Clock - Submission Follow Up
Feb 25, 2020
I’m very sad to see that my Flutter Clock didn’t even make it to the Honorable Mentions section of the Flutter Clock contest. I’m thinking maybe I made some mistake, like they could not test it somehow. Looking on the positive side, I’ll use the experience I gathered to rewrite the Deal-O-RoundPlayN game with Flutter.
In the first part I emphasized how I modularized the widget hierarchy, and how I used InheritedWidget to communicate information between widgets. That post became big enough that I concentrated on the practices I actually used. However, I went through some thinking and iterations before I arrived at the end result.
One principle I follow when I design and implement solutions is to discover existing solutions and possibly not reinvent the wheel unnecessarily. I described how I examined many fonts that could be good candidates for the Nixie or the VFD part. That is also one form of the "do not reinvent the wheel" principle: by using a font, I can save a lot of time instead of designing every digit and letter from scratch; I can simply display the information using the font.
I also have to talk about the hexagonal grid, which is part of the Nixie tube illumination physics. I did not want to develop my own hexagonal grid drawing logic if I didn’t have to, so I looked for a package that could help. Flutter package repository (pub.dev) contains many thousands of packages. These cover every kind of use case you could ever imagine. For example, if my clock needed GPS coordinates to pull weather data or other location-based information, there are multiple packages for that, some of which cover all three platforms: Android, iOS, and web. If my clock wanted to pull weather information on its own, there are packages for that as well, such as the weather package. If I want to display sunset and daylight information, there’s a package for that.
Regarding drawing hexagonal patterns, I first came across a package capable of drawing all kinds of geometric shapes: the geo pattern package. However that package focuses on the coloring, and filled patterns. In my case I only needed the grid; I didn’t need a fill or color palette. At most I’d need to change the color of the grid structure as a whole in a gradient manner mimicking the illumination at the center. I focused on hexagonal patterns and found hexagonal_grid and the accompanying hexagonal_grid_widget. Unfortunately, these still didn’t fully satisfy my needs, so I ended up spinning off and debugging my own grid drawing logic. But the bottom line is that I first looked for existing packages, because oftentimes it’s a good idea to rely on a tested package instead of spending time debugging your own.