# screenCatalog: Full Reference > Render every screen of a Flutter app to PNG inside `flutter test` in ~15 seconds: themes, states, devices, locales, a contact sheet, pixel diffs, an offline HTML gallery, and App Store / Google Play store sizes. Save coding-agent vision tokens with one contact sheet and compact `manifest.json`. Zero simulator, zero external package dependencies (Flutter SDK only). - Repository: https://github.com/krishnac7/screenCatalog - Documentation & Live 48-Frame Demo: https://screencatalog.krishnac7.com/ - Demo Gallery: https://screencatalog.krishnac7.com/demo/ - License: BSD-3-Clause ## 1. Installation & Quickstart Try the bundled example app right away: ```sh git clone https://github.com/krishnac7/screenCatalog.git cd screenCatalog/example flutter pub get dart run screen_catalog --state all --frame ``` Output is written to `build/screen_catalog/`: - `contact_sheet.png`: overview grid of rendered frames - `index.html`: self-contained offline HTML gallery with split/diff viewer - `manifest.json`: machine-readable run metadata, timings, warnings, errors, and media provenance - `frames/*.png` and `framed/*.png`: individual frame PNGs ## 2. CLI Reference (`dart run screen_catalog` / `dart run sc`) ### Screen Selection - `[screen ...]` or `--screens a,b`: screen selectors (`home`, `settings/*`, `tag:onboarding`) - `--set FILE`: screen set and interaction requests (JSON or restricted YAML) - `--theme light|dark|both`: brightness variants (default `both`) - `--state a,b | all`: state variants (default: first state in catalog) - `--device a,b`: target devices (default `phone`; see `--devices`) - `--locale en-US,de-DE`: locales (default: test locale) - `--text-scale 1,1.3`: text scale factors in `(0, 10]` (default `1`) - `--changed`: only screens affected by files changed in git - `--base REF`: git ref for `--changed` (default `HEAD`) ### Output & Visual Comparison - `--out DIR`: output directory (default `build/screen_catalog`) - `--full-page`: expand vertical scrollable content (up to 6 attempts, 20,000 logical px, 40M physical px cap) - `--frame`: draw device bezel and status bar - `--status-bar`: draw status bar only - `--json`: print one JSON object to stdout and nothing else - `--baseline DIR`: compare with earlier frames and write magenta difference PNGs - `--update-baseline`: copy this run's frames into the baseline directory - `--fail-on-diff`: exit `4` when any frame differs from baseline - `--threshold 0.001`: allowed differing pixel ratio (default `0`) ### Store Screenshots - `--store ios,play`: render required store sizes (or `all`, or specific ids from `--stores`) - `--caption-position top|bottom` - `--store-background '#101418,#26323F'`: solid colour or gradient ### Flavours & Defines - `--target lib/main_dev.dart`: entry file whose `runApp(...)` starter discovery reads - `--catalog PATH`: catalog path (default `test/screen_catalog.dart`) - `--dart-define KEY=VALUE` and `--dart-define-from-file F`: forwarded to `flutter test` (values redacted from `manifest.json`) ### Other Flags - `--init`: write starter `test/screen_catalog.dart` and stop - `--incremental`: reuse unchanged screens (tracked source closures only) - `--jobs N|auto`: experimental parallel shards (default `1`, max `16`) - `--list`: list registered screens and stop - `--images auto|off|fetch`: resolve network images via fixtures/placeholders (`auto`) or opt-in disk cache (`fetch`, suppressed in CI) - `--image-cache DIR`: cached image directory - `--network`: allow real HTTP (network images and fetched fonts) - `--no-stub-plugins`: let calls to unregistered plugins fail instead of empty reply - `--flutter PATH`: explicit flutter executable - `--devices`, `--stores`, `--version`, `--help` ### Exit Codes - `0`: every planned frame rendered without errors - `1`: at least one frame has errors (exception, error widget, redirect mismatch, unfinished frame) - `2`: invalid command-line arguments - `3`: nothing to render (empty catalog, empty filter match, or starter catalog needs dependency fakes) - `4`: `--fail-on-diff` and a frame differs from baseline - `5`: `flutter test` could not compile or run the catalog ## 3. Catalog Authoring API (`test/screen_catalog.dart`) ```dart import 'package:flutter_test/flutter_test.dart'; import 'package:my_app/main.dart'; import 'package:screen_catalog/screen_catalog.dart'; final catalog = ScreenCatalog( app: () => const MyApp(), screens: [ const Screen.route('home', '/'), const Screen.route('settings', '/settings'), Screen.route( 'filter-sheet', '/', act: (tester) async => tester.tap(find.byTooltip('Filter')), ), Screen.widget('paywall', (context) => const PaywallPage()), ], states: [ ScreenState.base, ScreenState('empty', wrap: (child) => ProviderScope(overrides: [...], child: child)), ScreenState('signed-in', afterMount: (tester) async => tester.tap(find.text('Sign in'))), ], ); void main() => runScreenCatalog(catalog); ``` ## 4. Machine-Readable JSON Output (`--json`) `dart run screen_catalog settings --theme dark --json` prints a single JSON object: ```json { "ok": true, "exit_code": 0, "contact_sheet": "/abs/build/screen_catalog/contact_sheet.png", "frames": [ { "id": "settings__default__dark__phone", "status": "ok", "file": "/abs/build/screen_catalog/frames/settings__default__dark__phone.png", "errors": [], "warnings": [] } ] } ``` ## 5. Honest Limits & Test-Renderer Boundaries - **Not a device capture:** Renders run in `flutter_tester` (software rasterizer), not Impeller on physical iOS/Android hardware. - **Platform views & media:** Native maps (`GoogleMap`), `WebView`, camera, video, Rive, and fragment shaders cannot render natively in `flutter test`; `screen_catalog` renders labelled or generated stand-ins and records provenance in `manifest.json`. `CachedNetworkImage` is not claimed supported without custom storage setup. - **Plugins & `main()`:** Missing plugin channels receive empty stub replies unless overridden; dependencies initialized inside `main()` before `runApp` must be faked via `wrap`, `setUp`, or `afterMount`. - **Host-specific fonts & baselines:** Text rasterization varies between macOS and Linux; keep baselines per OS and Flutter version. - **No external dependencies:** Depends only on `flutter` and `flutter_test` from the Flutter SDK (`flutter_lints` for development).