Skip to content

Commit 7c3dd07

Browse files
authored
Merge pull request #42 from koji-1009/release/v1.2.0
chore(release): 1.2.0
2 parents 8f8ee69 + 77ea3b8 commit 7c3dd07

31 files changed

Lines changed: 690 additions & 186 deletions

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.2.0
4+
5+
Shots drawn as iOS, a `--widget` at its own size, and a way to clear old runs.
6+
7+
* `shutter shot --platform ios` (and `semantics`) draws every preview as iOS instead of Android, the platform `flutter test` runs as: `defaultTargetPlatform` is `iOS` while each preview is shot, so a theme without its own `platform`, the back button, page transitions, adaptive widgets, and the app's own `defaultTargetPlatform` checks draw as on an iPhone. `shot` prints it, `manifest.json` records it, and `diff` prints both runs' when they differ. It is not part of shot ids.
8+
* `shutter shot --widget <expression> --size unbounded` lays the widget out with neither dimension bounded and shoots it at its own size, however wide; without `--size`, its width still stops at the viewport's 800.
9+
* `shutter prune --keep <n>` deletes every run under `.dart_tool/shutter/runs/` but the newest n, and prints the run directories it removed and kept. A run still being shot is left as it is.
10+
311
## 1.1.1
412

513
Host fallback fonts for any script the host has a font for, and in text whose style keeps them out.

‎README.md‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,20 @@ shutter shot lib/preview/login_preview.dart --enter 'label:Email=example@example
152152
Each is followed by `--settle` milliseconds; shoot again with another `--settle` for another point of an animation.
153153
`--capture screen` holds the whole viewport, with the menus, dialogs, and tooltips the app draws above the preview.
154154
`--keyboard <height>` lays a screen out as with its on-screen keyboard up, which `--enter` does not raise; the keyboard itself is not drawn, and `--keyboard-tint 9E9E9E` paints its area gray.
155+
`--platform ios` draws the app as iOS instead of Android, the platform `flutter test` runs as: the theme, the back button, page transitions, and adaptive widgets follow.
155156

156157
## Subcommands
157158

158-
| Command | Purpose |
159-
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
160-
| `agent` | The step-by-step playbook for AI agents. |
161-
| `manual` | The reference: preview files, drawing model, engine, runs, ids, diff, output, exit codes. |
162-
| `doctor` | Check the Flutter SDK version, its font cache, and the project's shell (`--shell`). |
163-
| `init` | Write `<preview dir>/shell.dart`, or the `--shell` file. |
164-
| `shot` | Render the named preview files, or one `--widget`, into a new run (`--widget`/`--import`/`--size`, `--settle`, `--shell`, `--tap`/`--enter`/`--press`/`--hover`/`--focus`, `--capture`/`--viewport`, `--keyboard`/`--keyboard-tint`, `--network-image`). |
165-
| `semantics` | Draw the semantics tree of the same subjects into a new run, with the options of `shot` except `--keyboard-tint`. |
166-
| `diff <a> <b>` | Compare two runs (`--images`, `--composite`). |
159+
| Command | Purpose |
160+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
161+
| `agent` | The step-by-step playbook for AI agents. |
162+
| `manual` | The reference: preview files, drawing model, engine, runs, ids, diff, output, exit codes. |
163+
| `doctor` | Check the Flutter SDK version, its font cache, and the project's shell (`--shell`). |
164+
| `init` | Write `<preview dir>/shell.dart`, or the `--shell` file. |
165+
| `shot` | Render the named preview files, or one `--widget`, into a new run (`--widget`/`--import`/`--size`, `--settle`, `--shell`, `--tap`/`--enter`/`--press`/`--hover`/`--focus`, `--capture`/`--viewport`, `--keyboard`/`--keyboard-tint`, `--network-image`, `--platform`). |
166+
| `semantics` | Draw the semantics tree of the same subjects into a new run, with the options of `shot` except `--keyboard-tint`. |
167+
| `diff <a> <b>` | Compare two runs (`--images`, `--composite`). |
168+
| `prune` | Delete every run but the newest `--keep <n>`. |
167169

168170
## Exit codes
169171

‎doc/agent.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ It makes no judgement; what to shoot, how to prepare the before state, whether a
1616
9. `diff --composite` writes one image per entry holding its before, diff and after panels, which is the one to post when you want a single attachment; `--title <text>` puts a line of your own above them, in any script. Check it before posting: it is what the reviewer sees.
1717
10. The images are files under `.dart_tool/shutter/`; where to post them is up to you. A path alone renders nothing: `gh pr comment <number> --attach '<png>#<alt text>'` (gh 2.99+) uploads them into a GitHub comment, `glab mr note create <mr> --attach <png>` (glab 1.117+, experimental) into a GitLab one.
1818
11. Keep the preview files: the next change is shot against the same subjects, and the Flutter Widget Previewer draws them too.
19+
12. Runs accumulate under `.dart_tool/shutter/runs/`. `shutter prune --keep <n>` deletes every run but the newest n, the user's own included, so prune when the user asks for it, or once the images you posted no longer need their runs.
1920

2021
## Preview files
2122

@@ -44,6 +45,7 @@ Widget settingsSignedOut() => const SettingsPage(user: null);
4445
* HTTP is blocked while shooting, so an `Image.network` is an `error` shot. Fetch the image first and serve it with `--network-image <url>=<file>` (repeatable), the same in the before and after shots: `curl --create-dirs -o .dart_tool/shutter/images/avatar.png <url>`, then `shutter shot <preview-file> --network-image <url>=.dart_tool/shutter/images/avatar.png`. Only `NetworkImage` is served, not `package:http`.
4546
* `shutter shot` shoots only the files it is given: `shutter shot lib/preview/settings_page_preview.dart`.
4647
* Top-level functions, static methods, and constructors without required arguments are all valid targets; `MultiPreview` and `Preview` subclasses work too.
48+
* Shots are drawn as Android, the platform `flutter test` runs as. For an app that ships on iOS, or a change to iOS-only code, pass `--platform ios` to the before and after shots alike: the theme, the back button, page transitions, adaptive widgets, and the app's own `defaultTargetPlatform` checks then draw as on an iPhone. `diff` prints `platform:` when the two runs differ in it.
4749

4850
## Shell
4951

@@ -67,7 +69,7 @@ shutter shot --widget 'PrimaryButton(label: "OK")' --import lib/ui/button.dart -
6769
* `--widget` is any Dart expression of type `Widget`; `--import` is a file under `lib/` (or a `package:` URI) it needs imported, repeatable. `package:flutter/widgets.dart` is always imported, so Material widgets need the Material library the project uses as an `--import` (`package:material_ui/material_ui.dart` or `package:flutter/material.dart`).
6870
* Only that widget is shot, wrapped in the shell; nothing is written to the project outside `.dart_tool/shutter/`.
6971
* The generated test is compiled inside the project, so `--import` reaches only what the project's `pubspec.yaml` already resolves: add the package first, then shoot it.
70-
* Without `--size` the widget is shot at its own size; `--size` fixes both dimensions and stretches the widget to them.
72+
* Without `--size` the widget is shot at its own height and its own width up to 800; `--size` fixes both dimensions and stretches the widget to them. `--size unbounded` shoots it at its own size with neither dimension bounded, so the image is exactly as large as the widget, however wide; text then wraps only at its own line breaks.
7173
* The same `--widget` and `--import` give the same shot id in every run, so before and after line up in `diff`.
7274

7375
## Pressed, hovered, focused, opened, typed

0 commit comments

Comments
 (0)