Draw the Flutter composer's picture button on its own tile
The Delight 2 tile was a window-only thing because jolt reads it out of the source tree it runs from, and the ClojureDart half is launched from `flutter/` and carries no src/. So bundle a copy: `flutter/assets/insert-image.png`, in pubspec's assets, asked for as `asset:assets/insert-image.png`. That means a third kind of `:src` for `frq.hiccup`'s `:image` — `asset:`, for a picture the bundle carries rather than one the reader chose or the network holds; a file path cannot name it, since the bundle is not the filesystem. Both halves now draw the tile. A terminal has no pixels for one and keeps 🖼. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5b62aea parent: 5ba9382 modified
common/frq/screens/chat.cljc +14 -14 | @@ -1386,20 +1386,20 @@ | ||
| 1386 | 1386 | ;; something else on it". |
| 1387 | 1387 | ;; And the same picture chosen rather than pasted, for a phone — which has |
| 1388 | 1388 | ;; no Ctrl+V, and no clipboard of pictures to read if it had. |
| 1389 | - ;; In a window, a picture on a Delight 2 tile (src/frq/icons, on the | |
| 1390 | - ;; geometry delight-icons generates its tiles with): grey frame, dark | |
| 1391 | - ;; square, cream glyph — where the emoji was a colour photo that matched | |
| 1392 | - ;; nothing else in the bar. Its path is read from the working directory, | |
| 1393 | - ;; which is the tree under `just run` and `just cosmic` and the store | |
| 1394 | - ;; copy under the flake's launcher. A terminal has no pixels to put | |
| 1395 | - ;; it in, and an APK carries no src/ to read it from — both keep the glyph. | |
| 1396 | - ;; `:jolt` and not `desktop?`: the tile is a file read out of the working | |
| 1397 | - ;; directory, which is the source tree jolt runs from. Flutter's desktop | |
| 1398 | - ;; target is a window with a pointer like libcosmic's — `desktop?` is | |
| 1399 | - ;; true there now — but it is launched from `flutter/` and bundles no | |
| 1400 | - ;; src/, so it keeps the glyph the APK keeps. | |
| 1401 | - (if #?(:jolt (and (actions/desktop?) (not @terminal?)) :cljd false) | |
| 1402 | - [:image {:src "src/frq/icons/insert-image.png" | |
| 1389 | + ;; The same picture on both halves: a Delight 2 tile (src/frq/icons, on | |
| 1390 | + ;; the geometry delight-icons generates its tiles with) — grey frame, | |
| 1391 | + ;; dark square, cream glyph, where the emoji was a colour photo that | |
| 1392 | + ;; matched nothing else in the bar. Only where the tile can be found, | |
| 1393 | + ;; which is not the same place twice. jolt reads it out of the working | |
| 1394 | + ;; directory, which is the source tree under `just run` and `just | |
| 1395 | + ;; cosmic` and the store copy under the flake's launcher. ClojureDart is | |
| 1396 | + ;; launched from `flutter/` and bundles no src/, on the phone and the | |
| 1397 | + ;; desktop target alike, so it asks for the copy in `flutter/assets/` | |
| 1398 | + ;; that `pubspec.yaml` bundles — hence `asset:` rather than a path. | |
| 1399 | + ;; A terminal has no pixels to put a picture in and keeps the glyph. | |
| 1400 | + (if #?(:jolt (and (actions/desktop?) (not @terminal?)) :cljd true) | |
| 1401 | + [:image {:src #?(:jolt "src/frq/icons/insert-image.png" | |
| 1402 | + :cljd "asset:assets/insert-image.png") | |
| 1403 | 1403 | :size [36 36] |
| 1404 | 1404 | ;; On the middle of the field rather than the top of it: the |
| 1405 | 1405 | ;; box grows downwards as a message is typed, and a button |
| @@ -1386,20 +1386,20 @@ | |||
| 1386 | ;; something else on it". | 1386 | ;; something else on it". |
| 1387 | ;; And the same picture chosen rather than pasted, for a phone — which has | 1387 | ;; And the same picture chosen rather than pasted, for a phone — which has |
| 1388 | ;; no Ctrl+V, and no clipboard of pictures to read if it had. | 1388 | ;; no Ctrl+V, and no clipboard of pictures to read if it had. |
| 1389 | - ;; In a window, a picture on a Delight 2 tile (src/frq/icons, on the | 1389 | + ;; The same picture on both halves: a Delight 2 tile (src/frq/icons, on |
| 1390 | - ;; geometry delight-icons generates its tiles with): grey frame, dark | 1390 | + ;; the geometry delight-icons generates its tiles with) — grey frame, |
| 1391 | - ;; square, cream glyph — where the emoji was a colour photo that matched | 1391 | + ;; dark square, cream glyph, where the emoji was a colour photo that |
| 1392 | - ;; nothing else in the bar. Its path is read from the working directory, | 1392 | + ;; matched nothing else in the bar. Only where the tile can be found, |
| 1393 | - ;; which is the tree under `just run` and `just cosmic` and the store | 1393 | + ;; which is not the same place twice. jolt reads it out of the working |
| 1394 | - ;; copy under the flake's launcher. A terminal has no pixels to put | 1394 | + ;; directory, which is the source tree under `just run` and `just |
| 1395 | - ;; it in, and an APK carries no src/ to read it from — both keep the glyph. | 1395 | + ;; cosmic` and the store copy under the flake's launcher. ClojureDart is |
| 1396 | - ;; `:jolt` and not `desktop?`: the tile is a file read out of the working | 1396 | + ;; launched from `flutter/` and bundles no src/, on the phone and the |
| 1397 | - ;; directory, which is the source tree jolt runs from. Flutter's desktop | 1397 | + ;; desktop target alike, so it asks for the copy in `flutter/assets/` |
| 1398 | - ;; target is a window with a pointer like libcosmic's — `desktop?` is | 1398 | + ;; that `pubspec.yaml` bundles — hence `asset:` rather than a path. |
| 1399 | - ;; true there now — but it is launched from `flutter/` and bundles no | 1399 | + ;; A terminal has no pixels to put a picture in and keeps the glyph. |
| 1400 | - ;; src/, so it keeps the glyph the APK keeps. | 1400 | + (if #?(:jolt (and (actions/desktop?) (not @terminal?)) :cljd true) |
| 1401 | - (if #?(:jolt (and (actions/desktop?) (not @terminal?)) :cljd false) | 1401 | + [:image {:src #?(:jolt "src/frq/icons/insert-image.png" |
| 1402 | - [:image {:src "src/frq/icons/insert-image.png" | 1402 | + :cljd "asset:assets/insert-image.png") |
| 1403 | :size [36 36] | 1403 | :size [36 36] |
| 1404 | ;; On the middle of the field rather than the top of it: the | 1404 | ;; On the middle of the field rather than the top of it: the |
| 1405 | ;; box grows downwards as a message is typed, and a button | 1405 | ;; box grows downwards as a message is typed, and a button |
added
flutter/assets/insert-image.png +0 -0 | new file mode 100644 | ||
| Binary files /dev/null and b/flutter/assets/insert-image.png differ | ||
| new file mode 100644 | |||
| Binary files /dev/null and b/flutter/assets/insert-image.png differ | Binary files /dev/null and b/flutter/assets/insert-image.png differ | ||
modified
flutter/pubspec.yaml +6 -4 | @@ -67,10 +67,12 @@ flutter: | ||
| 67 | 67 | # the material Icons class. |
| 68 | 68 | uses-material-design: true |
| 69 | 69 | |
| 70 | - # To add assets to your application, add an assets section, like this: | |
| 71 | - # assets: | |
| 72 | - # - images/a_dot_burr.jpeg | |
| 73 | - # - images/a_dot_ham.jpeg | |
| 70 | + # The Delight 2 tiles the composer draws its buttons with. jolt reads them | |
| 71 | + # out of the source tree it runs from; this half is launched from `flutter/` | |
| 72 | + # and carries no src/, so the ones it needs are bundled here and asked for | |
| 73 | + # as `asset:` sources — see `frq.hiccup`'s `:image`. | |
| 74 | + assets: | |
| 75 | + - assets/insert-image.png | |
| 74 | 76 | |
| 75 | 77 | # An image asset can refer to one or more resolution-specific "variants", see |
| 76 | 78 | # https://flutter.dev/to/resolution-aware-images |
| @@ -67,10 +67,12 @@ flutter: | |||
| 67 | # the material Icons class. | 67 | # the material Icons class. |
| 68 | uses-material-design: true | 68 | uses-material-design: true |
| 69 | 69 | ||
| 70 | - # To add assets to your application, add an assets section, like this: | 70 | + # The Delight 2 tiles the composer draws its buttons with. jolt reads them |
| 71 | - # assets: | 71 | + # out of the source tree it runs from; this half is launched from `flutter/` |
| 72 | - # - images/a_dot_burr.jpeg | 72 | + # and carries no src/, so the ones it needs are bundled here and asked for |
| 73 | - # - images/a_dot_ham.jpeg | 73 | + # as `asset:` sources — see `frq.hiccup`'s `:image`. |
| 74 | + assets: | ||
| 75 | + - assets/insert-image.png | ||
| 74 | 76 | ||
| 75 | # An image asset can refer to one or more resolution-specific "variants", see | 77 | # An image asset can refer to one or more resolution-specific "variants", see |
| 76 | # https://flutter.dev/to/resolution-aware-images | 78 | # https://flutter.dev/to/resolution-aware-images |
modified
flutter/src/frq/hiccup.cljd +9 -0 | @@ -1035,6 +1035,15 @@ | ||
| 1035 | 1035 | oops (fn [_ _ _] (m/SizedBox .width 0.0 .height 0.0)) |
| 1036 | 1036 | img (cond |
| 1037 | 1037 | (nil? src) (m/SizedBox .width 0.0 .height 0.0) |
| 1038 | + ;; A picture the bundle carries rather than one the reader | |
| 1039 | + ;; chose or the network holds: `pubspec.yaml`'s assets, | |
| 1040 | + ;; named `asset:<path>` so the three sources stay one | |
| 1041 | + ;; `:src`. A file path could not do this job — the bundle | |
| 1042 | + ;; is not the filesystem on Android, and the desktop build | |
| 1043 | + ;; is launched from wherever it was installed. | |
| 1044 | + (.startsWith (str src) "asset:") | |
| 1045 | + (m/Image.asset (subs (str src) 6) .fit m/BoxFit.contain | |
| 1046 | + .errorBuilder oops) | |
| 1038 | 1047 | (or (.startsWith (str src) "http://") |
| 1039 | 1048 | (.startsWith (str src) "https://")) |
| 1040 | 1049 | (m/Image.network (str src) .fit m/BoxFit.contain |
| @@ -1035,6 +1035,15 @@ | |||
| 1035 | oops (fn [_ _ _] (m/SizedBox .width 0.0 .height 0.0)) | 1035 | oops (fn [_ _ _] (m/SizedBox .width 0.0 .height 0.0)) |
| 1036 | img (cond | 1036 | img (cond |
| 1037 | (nil? src) (m/SizedBox .width 0.0 .height 0.0) | 1037 | (nil? src) (m/SizedBox .width 0.0 .height 0.0) |
| 1038 | + ;; A picture the bundle carries rather than one the reader | ||
| 1039 | + ;; chose or the network holds: `pubspec.yaml`'s assets, | ||
| 1040 | + ;; named `asset:<path>` so the three sources stay one | ||
| 1041 | + ;; `:src`. A file path could not do this job — the bundle | ||
| 1042 | + ;; is not the filesystem on Android, and the desktop build | ||
| 1043 | + ;; is launched from wherever it was installed. | ||
| 1044 | + (.startsWith (str src) "asset:") | ||
| 1045 | + (m/Image.asset (subs (str src) 6) .fit m/BoxFit.contain | ||
| 1046 | + .errorBuilder oops) | ||
| 1038 | (or (.startsWith (str src) "http://") | 1047 | (or (.startsWith (str src) "http://") |
| 1039 | (.startsWith (str src) "https://")) | 1048 | (.startsWith (str src) "https://")) |
| 1040 | (m/Image.network (str src) .fit m/BoxFit.contain | 1049 | (m/Image.network (str src) .fit m/BoxFit.contain |