| The last of the Clojure 284b59c nandi 19h ago | 1 | # The Flutter half |
| Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago | 2 | |
| The last of the Clojure 284b59c nandi 19h ago | 3 | The renderer, and the window it runs in. Everything else is Nim. |
| Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago | 4 | |
| 5 | ``` |
| The last of the Clojure 284b59c nandi 19h ago | 6 | lib/main.dart the entry point: reads FRQ_AUTOCONNECT, then runs the app |
| 7 | lib/nim_renderer.dart the widget tree from Nim, as Flutter widgets |
| 8 | lib/nim_theme.dart the design tokens |
| 9 | test/nim_layout_test.dart every screen laid out for real, at three sizes |
| Split the tree three ways, and let the phone be Flutter's 7070931 nandi 8d ago | 10 | ``` |
| 11 | |
| The last of the Clojure 284b59c nandi 19h ago | 12 | ## What the renderer knows |
| 13 | |
| 14 | The tag vocabulary, and nothing else — no screens, no state, no idea what |
| 15 | "connect" means. Nim decides what the screen is; this decides what a `vbox` |
| 16 | looks like. The measure of whether the split is honest is how boring this file |
| 17 | is: if a feature ever needs a change here AND in Nim, the boundary is in the |
| 18 | wrong place. |
| 19 | |
| 20 | Three rules in it are worth knowing before changing any of it, because each |
| 21 | cost a screenful of `Cannot hit test a render box that has never been laid |
| 22 | out` to find: |
| 23 | |
| 24 | * **`Expanded` only inside a Flex.** The renderer threads the axis it is |
| 25 | building into, because Flutter offers no way to ask after the fact. An |
| 26 | `Expanded` in a `Wrap` fails the layout, and every box under it is then |
| 27 | hit-tested having never been laid out. |
| 28 | * **A paragraph is one `RichText`, not a row of words.** Children of a `Wrap` |
| 29 | are given unbounded width, so a long URL can never wrap — it overflows and |
| 30 | takes the screen with it. |
| 31 | * **`expand` is stated by the node that expands.** A row that fills the |
| 32 | remaining height stretches on its cross axis, and stretch needs a bounded |
| 33 | height to stretch to. |
| 34 | |
| 35 | `test/nim_layout_test.dart` is what enforces all three. It renders every screen |
| 36 | at phone, desktop and a deliberately cramped size, headless, and fails on |
| 37 | anything that reaches `FlutterError` — which is where a layout error goes |
| 38 | instead of to the caller, so a test that only pumps and asserts on widgets |
| 39 | passes while the screen is in pieces. |
| 40 | |
| 41 | ## Building |
| Paint the desktop with Flutter too, beside libcosmic fc5f63c nandi 8d ago | 42 | |
| Build the APK, out of ClojureDart and Flutter e2b0e6b nandi 8d ago | 43 | ```bash |
| The last of the Clojure 284b59c nandi 19h ago | 44 | just build desktop # the debug bundle |
| 45 | just run desktop # and open it |
| 46 | just test layout # the widget tests, headless |
| Build the APK, out of ClojureDart and Flutter e2b0e6b nandi 8d ago | 47 | ``` |
| 48 | |
| The last of the Clojure 284b59c nandi 19h ago | 49 | `just` builds `libfrqcore.so` first: the app dlopens it at startup, and a |
| 50 | missing one is a blank window with a `StateError` behind it. The core resolves |
| 51 | OpenSSL through dynlib at run time, which is why the recipe puts the host's |
| 52 | library on the loader path. |
| Draw frq.app's own connect screen on the phone 0bc64b5 nandi 8d ago | 53 | |
| The last of the Clojure 284b59c nandi 19h ago | 54 | ## What used to be here |
| Draw frq.app's own connect screen on the phone 0bc64b5 nandi 8d ago | 55 | |
| The last of the Clojure 284b59c nandi 19h ago | 56 | `src/`, 5,500 lines of ClojureDart: the screens, the host implementations, and |
| 57 | a `frq.hiccup` that did what `nim_renderer.dart` does now. It compiled to |
| 58 | three targets — Android, Linux and the web — and both of the others went with |
| 59 | it. A browser has no `dart:ffi`, so the web needs the Nim core built to wasm |
| 60 | rather than ClojureDart brought back; Android needs `libfrqcore.so` for its |
| 61 | ABIs, which is a build problem rather than a design one. |
| Draw frq.app's own connect screen on the phone 0bc64b5 nandi 8d ago | 62 | |
| The last of the Clojure 284b59c nandi 19h ago | 63 | The `android/` and `web/` directories are still here and still describe real |
| 64 | targets. Nothing builds them today. |