Implement flet extension

From flet-dev/flet · View interactive version

Implement flet extension is an AI agent skill from the GitHub repository flet-dev/flet. Implement a new Flet extension/control that wraps a third-party Flutter package end-to-end, including dependency selection, version pinning, compatibility checks, Python/Flutter integration, docs, examples, tests, and CI updates. Use when adding any flet_* package backed by an external pub.dev packa

How to use this skill

Skill file

Implement a Flet extension around an external Flutter package using existing flet_* packages as implementation templates.

Inputs

Third-party Dependency Gate

  1. Confirm package health: maintenance activity, null-safety, platform support, and open issue risk.
  2. Confirm license is compatible with Flet distribution.
  3. Confirm that the parts of the package the extension uses don't build widgets from the Flutter SDK's package:flutter/material.dart or package:flutter/cupertino.dart, or take or return their types. Parts it doesn't use don't matter: shadcn_ui's ShadApp is built on the SDK MaterialApp, but flet-shadcn-ui never uses it. Flet renders with the material_ui and cupertino_ui packages, so SDK TextField, InkWell, ListTile and similar widgets fail at runtime ("No Material widget found"), and SDK ThemeData/ButtonStyle values don't type-check against Flet's helpers. Prefer a release built on material_ui/cupertino_ui or on widgets.dart only.
  4. Select a conservative version strategy:
  1. Record key constraints and reasons in PR notes/commit message.

Control/Service Classification

  1. LayoutControl for visual controls that participate in page/layout positioning.
  2. Base Control for simple visual controls that do not require page positioning or define their own positioning rules/props (for example Draggable, Divider, MenuBar, NavigationRail).
  3. Non-visual Service when functionality is not a renderable UI control.

API Mapping Rules

Python-side Rules

Flutter-side Rules

Default Value Matching (Critical)

Properties with default values on the Python side are not sent to Flutter when unchanged from the default. Every Dart property read must provide the same default as its Python counterpart:

Without matching defaults, Dart receives null and either crashes or silently uses the wrong value. This applies to all property types: bools, numbers, strings, enums, durations, collections, and nested @ft.value types.

Integration Checklist

1. client/pubspec.yaml: add flet_<ext>: path: ../sdk/python/packages/flet-<ext>/src/flutter/flet_<ext> under dependencies.

2. client/lib/main.dart: add import 'package:flet_<ext>/flet_<ext>.dart' as flet_<ext>; and flet_<ext>.Extension() to the extensions list.

Docs, Examples, Tests

Example Tests and Docs Images

Every example gets an integration test, and the goldens it produces are the docs images. Follow sdk/python/packages/flet/integration_tests/examples/controls/material/test_checkbox.py.

Every docs image must be light and opaque. Screenshots are transparent by default: on the website's dark mode dark text becomes unreadable, and create_gif flattens transparency to black, so flow GIFs come out dark. For every screenshot used in docs:

  1. Create one test file per control in sdk/python/packages/flet/integration_tests/examples/extensions/<name>/test_<control>.py. The file stem picks the golden folder (golden/macos/<control>/), so each control's images stay together.
  2. In each file:
  1. Generate goldens from sdk/python: FLET_TEST_GOLDEN=1 uv run pytest -s packages/flet/integration_tests/examples/extensions/<name>. Open and review every PNG and GIF (dark or transparent background, stretched rows, cramped spacing, oversized icons, clipping), fix the test or example, regenerate, then re-run without FLET_TEST_GOLDEN to confirm the comparisons pass. Commit the golden/macos/<control>/* files.
  2. Reference the images in each control page:
  1. Run uv --directory ./tools/crocodocs run crocodocs generate from the repo root and check that the images appear under website/static/docs/test-images/... (generated, not committed).

Upgrade and Compatibility Guardrails

Validation

Temporary CI narrowing on the feature branch

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.