Agent Skillsflet-dev/flet › update-flet-control-doc-gifs

update-flet-control-doc-gifs

GitHub

用于生成和更新Flet控件文档所需的截图与GIF,通过集成测试捕获视觉状态并替换旧媒体资产。

.agents/skills/update-flet-control-doc-gifs/SKILL.md flet-dev/flet

Trigger Scenarios

需要为文档生成控件截图或GIF 刷新静态或交互式黄金截图 用生成的测试资产替换旧的示例媒体图片

Install

npx skills add flet-dev/flet --skill update-flet-control-doc-gifs -g -y
More Options

Non-standard path

npx skills add https://github.com/flet-dev/flet/tree/main/.agents/skills/update-flet-control-doc-gifs -g -y

Use without installing

npx skills use flet-dev/flet@update-flet-control-doc-gifs

指定 Agent (Claude Code)

npx skills add flet-dev/flet --skill update-flet-control-doc-gifs -a claude-code -g -y

安装 repo 全部 skill

npx skills add flet-dev/flet --all -g -y

预览 repo 内 skill

npx skills add flet-dev/flet --list

SKILL.md

Frontmatter
{
    "name": "update-flet-control-doc-gifs",
    "description": "Create or update Flet control screenshots and GIFs that are generated from integration tests and shown in docs. Use when working on `sdk\/python\/packages\/flet\/integration_tests\/examples`, refreshing static or interactive golden screenshots, or replacing old example media images or GIFs with generated test assets."
}

Update Flet Control Doc Gifs

Use this skill after the integration test structure is already in place and the task is to capture doc-ready screenshots or interactive GIF states from integration tests.

Workflow

  1. Locate the example-backed integration test under sdk/python/packages/flet/integration_tests/examples.
  2. Prefer extending an existing interaction test instead of creating a second flow test.
  3. Build the visual sequence with deterministic states:
  • set page.enable_screenshots = True
  • set theme_mode when visuals matter
  • set fixed page size before screenshots
  • prefer finding controls by visible text or other stable user-facing content; add a key only when there is no reliable human-facing locator
  • call pump_and_settle() after each interaction
  1. Capture only states that are visually meaningful:
  • before interaction
  • hover state
  • popup/menu/dialog open
  • reopened state that proves persistence
  • single static screenshots when one frame is enough for docs
  • do not keep screenshots taken after a click if the UI closes and the state is not visible
  1. Use assert_screenshot(...) for regular golden screenshots and create_gif([...], "<flow_name>", duration=...) only when the docs benefit from an animated flow.
  • Prefer storing only asserted or docs-facing states as named screenshots; keep intermediate hover/click frames in memory and pass them directly to create_gif(...) when they do not need standalone golden files.
  1. Update docs to use the generated screenshot or GIF, not an old media asset from examples/.../media, when the integration-test asset is now the better docs artifact.
  2. Update docs references to point at the intended generated screenshot or GIF path, but do not copy generated assets into website/static/docs/test-images/... as part of this workflow.

Naming

  • Use short screenshot names that describe visible states, for example before_click, hover_popup, popup_open, checked_item_reopened.
  • Use one flow GIF name per control/example, for example app_bar_flow.
  • Use descriptive static screenshot names when the asset is docs-facing, for example image_for_docs, popup_open, or checked_item_reopened.
  • Give the integration test a behavior-based name such as test_actions_and_popup_menu; avoid placeholder names like test_basic when the test covers a specific flow.
  • Keep screenshot names stable because they become golden filenames.

Docs Update Rules

  • Control docs usually point to generated assets through frontMatter.example_images.
  • If a docs page still has example_images pointing at example media instead of generated test images, update that front matter first so the page has a single source of truth for screenshots and GIFs.
  • When a docs page has multiple example sections, add the generated screenshot or GIF directly under the matching CodeExample block so each visual stays paired with the example it demonstrates.
  • If a docs page still uses frontMatter.example_media + '/old.png' or frontMatter.example_media + '/old.gif', replace it with frontMatter.example_images + '/<asset>' when the generated integration-test asset is the new source of truth.
  • Generated screenshots and GIFs from integration tests are commonly stored at sdk/python/packages/flet/integration_tests/examples/.../golden/macos/<control>/.
  • Do not copy generated screenshots or GIFs into website/static/docs/test-images/... as part of this skill. Keep the work limited to tests and docs references unless the user explicitly asks for a copy.

Verification Checklist

  • The interaction test still reflects the example behavior.
  • Every screenshot included in a GIF is visibly different and useful.
  • The GIF duration is intentional; prefer shorter loops for hover/click flows unless the interaction needs more time.
  • The docs front matter points to the generated test-images location rather than stale example media paths.
  • The docs page references the new screenshot or GIF path.
  • The generated screenshot or GIF exists in the integration-test golden directory at the path implied by the test names.
  • Remove or stop referencing obsolete media screenshots or GIFs only when the new generated asset fully replaces them.

References

  • sdk/python/packages/flet/integration_tests/examples
  • sdk/python/packages/flet/integration_tests/examples/controls/material/test_alert_dialog.py
  • sdk/python/packages/flet/integration_tests/examples/controls/material/test_app_bar.py
  • website/docs/controls

Version History

  • 8f74fe9 Current 2026-08-20 12:12

Same Skill Collection

.agents/skills/create-flet-control-integration-tests/SKILL.md
.agents/skills/create-flet-example-projects/SKILL.md
.agents/skills/docs-build-and-verify/SKILL.md
.agents/skills/docs-conventions/SKILL.md
.agents/skills/fix-members-short-description/SKILL.md
.agents/skills/flet-deprecation/SKILL.md
.agents/skills/imperative-to-declarative-flet/SKILL.md
.agents/skills/implement-flet-extension/SKILL.md
.agents/skills/prepare-flet-release/SKILL.md
.agents/skills/test-flet-apps-dev/SKILL.md
.agents/skills/write-changelog-entry/SKILL.md
website/.agents/skills/flet-release-announcement/SKILL.md
.agents/skills/run-unit-tests/SKILL.md
.agents/skills/run-integration-tests/SKILL.md

Metadata

Files
0
Version
8f74fe9
Hash
926c34fa
Indexed
2026-08-20 12:12

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 08:12
浙ICP备14020137号-1 $방문자$