Skip to content

About

Kettle sample app in Flutter for Scry capture

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

scry-sample-flutter

Kettle, a small coffee-order app in Flutter, wired so Scry can capture its screens. Clone it, capture on an emulator, a simulator or with no device at all, and get four screens and two components into your own Scry project in five steps. Search, the Scry MCP server and the Figma link then work on your Flutter screens the way they do on web.

No code of yours is uploaded. Scry receives PNG screenshots and a small manifest (scf.json), nothing else.

The app is the example. To do the same for your own app, jump to Make it your own.

Before you start

  • The Flutter SDK, version 3.47.6 (the version this sample is pinned to; flutter --version).
  • Node 20 or newer (the bundle writer and the Scry CLI).
  • For the device paths: an Android emulator (JDK 17, the Android SDK, adb devices lists one) or, on a Mac, a booted iOS simulator. The headless path needs neither.
  • A Scry project and a project API key (dashboard, Settings, API keys). Keep the key in your shell or CI secrets, never in a file you commit. Placeholders below: proj_xxxxxxxx, sk_live_xxxxxxxx.

The five steps

1. Get the sample app

git clone https://github.com/scryorg/scry-sample-flutter.git
cd scry-sample-flutter
flutter pub get
flutter test          # the app's own test, plus a headless render of every screen

flutter run starts Kettle: Menu, tap a drink for its detail, "View order", "Place order".

2. Capture your screens

Pick one. All three write the same bundle format to .scry/capture/ (scf.json plus images/, gitignored).

Command Where it runs What you get
bash scripts/capture.sh android a running Android emulator the emulator's real screen size and density; the same Flutter Material widgets and Inter font; source chip "Flutter · Android"
bash scripts/capture.sh ios a booted iOS simulator (macOS) the simulator's screen size and pixel density; the same Flutter Material widgets and bundled Inter font as the other paths (not native iOS controls); source chip "Flutter · iOS"
bash scripts/capture.sh headless the host, no device, a few seconds the same Flutter Material widgets and bundled Inter font, rendered at 390 x 844 @3x; platform "other"

Expected: scf: 6/6 captured, 0 skipped -> .scry/capture.

If several simulators are booted, capture.sh ios stops and asks you to pick one: IOS_UDID=<udid> bash scripts/capture.sh ios (xcrun simctl list devices booted shows the ids). Other simulators are not touched. Components are captured full-frame (the manifest says crop: none), so a component image is mostly background.

On a device path the screenshots show the Flutter surface only (no status bar). capture.sh turns the device animations off and marks Android's "Viewing full screen" confirmation as seen for the run (a fresh emulator would otherwise stop on it), and puts both back on exit; it refuses a physical Android phone unless you set ALLOW_PHYSICAL=1.

A brand-new emulator keeps doing first-boot work for a minute or two after Android says it has booted. That work can destroy and relaunch the running app, and flutter drive then waits forever on an app that no longer exists. capture.sh android therefore waits until the device has settled (uptime of at least 150 s and no activity relaunches for 25 s) before it starts, watches the drive, retries it once if the app was relaunched, and never hangs silently: if the second attempt fails it exits 4 with the likely causes and the exact retry command. Tuning knobs (seconds): CAPTURE_SETTLE_QUIET, CAPTURE_SETTLE_UPTIME, CAPTURE_SETTLE_MAX, CAPTURE_DONE_GRACE, CAPTURE_DRIVE_TIMEOUT, CAPTURE_BOOT_TIMEOUT, and CAPTURE_RETRIES (default 1).

The headless path refuses to produce a bundle if the fonts did not load. Without fonts, flutter test draws every letter as a black square; the script stops with a message that names the problem and writes nothing.

3. Check the bundle

npx @scrymore/scry-deployer upload .scry/capture --dry-run

Expected, and nothing is sent:

Validating .scry/capture ...
✅ Bundle valid: 6 captures, source flutter-golden:android.
Dry run: not uploading. Bundle ZIP: /tmp/scry-bundle-XXXXXX/bundle.zip

(flutter-golden:ios or flutter-golden:other for the other two paths.)

4. Upload

export SCRY_PROJECT_ID=proj_xxxxxxxx
export SCRY_API_KEY=sk_live_xxxxxxxx
npx @scrymore/scry-deployer upload .scry/capture

Expected: the CLI ends with build #N for your project.

5. See it in Scry

Open the project in the dashboard. The new build shows the source chip "Flutter" with its platform and the device card; click a screen to see it in the editor with its source file and line (menu_screen.dart:8). Search for "quantity stepper", or ask the Scry MCP server for it: the result names the source.

What is in the app

Piece Where
4 screens: Menu, Item Detail, Order, Order placed lib/ui/*_screen.dart
2 components: QuantityStepper, Button states (plus the menu row) lib/ui/quantity_stepper.dart, lib/ui/button.dart, integration_test/scry/screens.dart
Fixed data and copy (same as scryorg/scry-sample-rn) lib/fixtures.dart, lib/tokens.dart
Screen registry (dev-only) integration_test/scry/screens.dart
Device capture test, run by flutter drive (dev-only) integration_test/scry_capture_test.dart, test_driver/integration_test.dart
Headless capture test and its font loader (dev-only) test/scry_capture_test.dart, test/scry_fonts.dart
Capture, bundle writer scripts/capture.sh, scripts/make-scf.mjs, scripts/screens.json
Checks behind the guarantees scripts/guarantees.sh
The same app without any capture file scripts/make-bare.sh <dest> (generated, not committed)
CI .github/workflows/ci.yml, .github/workflows/scry-capture.yml

Nothing in lib/ knows about Scry. The registry and the tests live in integration_test/ and test/, and integration_test and flutter_test are dev_dependencies that ship inside the Flutter SDK, so a release build has none of it (bash scripts/guarantees.sh guarantee-2-release-clean builds a release APK and checks it). The app has no dependencies beyond Flutter itself, and nothing from Scry.

Put it in CI

.github/workflows/scry-capture.yml captures headless on a Linux runner (no emulator, which keeps it fast and steady) and uploads only on a push to main. Set a repository variable SCRY_PROJECT_ID and a repository secret SCRY_API_KEY. ci.yml analyzes, tests, captures, validates and checks the guarantees on every pull request and uses no secrets. Three rules hold for the workflows and scripts/check-workflows.sh fails if any breaks: no pull_request_target, no self-hosted runner; only scry-capture.yml may read the key, on a push to the default branch; and every uses: is pinned to a full 40-character commit SHA with a # vN comment (local ./ actions excepted). scripts/check-workflows-test.sh tests the guard. To bump an action, resolve the new tag to its commit (gh api repos/<owner>/<repo>/git/ref/tags/<tag>). Headless pixels can differ across Flutter versions and operating systems, so the Flutter version is pinned (3.47.6).

Make it your own

To add one of your own screens, add one entry to integration_test/scry/screens.dart:

ScryScreen('screens-settings', 'Settings', 'screen', 'lib/ui/settings_screen.dart', 12, () => const SettingsScreen()),

and the matching entry to scripts/screens.json (flutter test fails if the two lists differ). Give each screen fixed data (no clock, no network, no sign-in) so it captures the same twice. If your app has its own fonts, declare them under fonts: in pubspec.yaml; the headless capture loads every declared family.

To see the "before" picture, bash scripts/make-bare.sh ../kettle-bare writes the app without any capture file; it passes flutter analyze and flutter test and is what the skill below starts from.

Use the Scry skill

For an existing app, the supported way is the Scry skill, which does the wiring above for you and checks the result:

npx skills add scryorg/scry-node --skill scry-native-capture-setup

Then ask your assistant: "set up Scry capture for this app". It inspects the project, adds the registry, the capture tests, fixtures, scripts/capture.sh and scripts/make-scf.mjs, and optionally the CI workflow; it runs the capture and upload --dry-run, shows you the screenshots, and never uploads or reads your key without your go.

License

MIT, see LICENSE. The Inter font in assets/fonts/ is under the SIL Open Font License (licenses/Inter-OFL.txt).

About

Kettle sample app in Flutter for Scry capture

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages