I'm a QA engineer by day, and in my spare time I build small apps. The latest one is Clickwheel , an offline music player for Android and iPhone with one control: a round click wheel. You drag your thumb around the ring, the list scrolls, and every step clicks.
It sounds like a weekend project. The wheel itself was. Making it feel right took much longer, and almost none of the work was where I expected it. Here are the three parts that mattered, with the real code from the app (Flutter).
1. Turning a finger into steps
A drag gesture gives you x/y positions. A wheel needs "one step forward" or "one step back". The bridge is the angle of the finger around the wheel's center:
double _angleOf ( Offset local , Size size ) { final v = local - _center ( size ) ; return math . atan2 ( v . dy , v . dx ) ; }
Enter fullscreen mode
Exit fullscreen mode
On every update I compare the new angle with the previous one and add the difference to an accumulator.…