Skip to content

feat(shot): shoot a --widget at a width and its own height with --size <width>x - #53

Merged
koji-1009 merged 2 commits into
feat/localefrom
feat/widget-width
Nov 5, 2026
Merged

koji-1009 merged 2 commits into
feat/localefrom
feat/widget-width

Conversation

@koji-1009

@koji-1009 koji-1009 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #52.

A preview shoots a list item at the list's width and its own height with Size(360, double.infinity), which the agent playbook recommends for widgets. A --widget shot could not: --size took both dimensions or unbounded, and without --size the width stopped at the 800-wide fallback viewport, so a list item shot without a preview file was either stretched to a fixed height or laid out far wider than on a phone, with its text wrapping in other places.

How it works

  • shutter shot --widget ... --size <width>x shoots the widget at that width and its own height; from Dart, WidgetExpression(size: LogicalSize(390, double.infinity)), as a preview's Size(390, double.infinity). --size still takes <width>x<height> and unbounded. No new WidgetSize subtype: the class is sealed and public, so one would break a tool that switches over it.
  • shoot passes it to the engine as (width, double.infinity), which the harness already lays out with an unbounded height. Such a size prints as 390x.
  • shoot rejects a width that is not > 0 and finite with exit 64. --viewport now has a parser of its own and still takes both dimensions, so --viewport 390x is a usage error.
  • The width is not part of the shot id, as no --size is.

Tests

  • test/e2e/widget_test.dart: a Text of ten words shot with --size 120x is 120 wide and more than twice as tall as the same text on one line.

Docs

  • doc/manual.md (One widget without a preview file), doc/agent.md, and the CHANGELOG cover it.

🤖 Generated with Claude Code

…e <width>x

shot --widget ... --size <width>x (and WidgetExpression(size:
WidgetWidth(...))) lays the widget out at that width with its height
left unbounded, as Size(360, double.infinity) does in a preview, so a
list item is shot at the list's width with its text wrapping there and
the image as tall as the widget. --size still takes <width>x<height>
and unbounded; --viewport keeps both dimensions. The width is not part
of shot ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koji-1009

koji-1009 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner Author

A ListTile shot with --widget (the 800-wide shot at half its logical width so the two fit side by side, the 360-wide one at its logical width): without --size it takes the 800-wide fallback viewport and its subtitle stays on one line (800x72); with --size 360x it is 360 wide, as in a list on a phone, and its subtitle wraps, the image growing to 80 high.

without --size (800x72) --size 360x (360x80)
ListTile without --size ListTile with --size 360x

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

WidgetSize is sealed and public, so a new subtype breaks a tool that
switches over it. A width with the height left to the widget is now
LogicalSize(width, double.infinity), as a preview's Size(360,
double.infinity) is, and prints as `360x`. The manual's sentence on it
moves after `--size unbounded`, whose "that limit" again follows the
sentence that sets the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koji-1009
koji-1009 marked this pull request as ready for review November 5, 2026 00:16
@koji-1009
koji-1009 added this pull request to stack #54 November 5, 2026 00:34
@koji-1009
koji-1009 merged commit b695199 into main Nov 5, 2026
5 checks passed
@koji-1009
koji-1009 deleted the feat/widget-width branch November 5, 2026 00:55
@koji-1009 koji-1009 mentioned this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants