Skip to content

ADFA-3857: Flutter Template plugin (community submission, rebuilt)#44

Open
hal-eisen-adfa wants to merge 5 commits into
mainfrom
ADFA-3857-review-flutter-template
Open

ADFA-3857: Flutter Template plugin (community submission, rebuilt)#44
hal-eisen-adfa wants to merge 5 commits into
mainfrom
ADFA-3857-review-flutter-template

Conversation

@hal-eisen-adfa

@hal-eisen-adfa hal-eisen-adfa commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the Flutter Template plugin (flutter-template/) — a community submission from Telegram user Ali (ADFA-3857), rebuilt on Code on the Go's template system.

Instead of the original submission's approach (writing hardcoded Dart files to external storage from a UI fragment — which fails under scoped storage on modern devices), this is a headless installer modeled on pebble-custom-function-template-installer: on activate() it registers five Flutter templates via IdeTemplateService so they appear on the New Project screen alongside the core templates; on deactivate() it unregisters and cleans up.

The five templates

Template State management
Flutter Basic none (setState)
Flutter BLoC flutter_bloc
Flutter Provider provider
Flutter GetX get
Flutter Riverpod flutter_riverpod

Each is authored as a Pebble (.peb) skeleton following the dev-assets core.cgt pattern, with APP_NAME/PACKAGE_NAME substitution. Custom Flutter-logo thumbnails (per-variant accent bar) and day/night plugin icons.

Why a rebuild, not a patch

Ali's bundled plugin-api.jar predated the template API (IdeTemplateService/CgtTemplateBuilder), which is why he fell back to raw /sdcard writes. The repo's template-API-capable jars make the correct installer pattern possible. The submission's committed release.keystore + plaintext signing passwords were deliberately excluded (flagged as compromised on the Jira ticket).

Out of scope

Scaffolds project files only — does not install the Flutter SDK. CoGo has no Dart/Flutter awareness today and the SDK (~500 MB) would need the ndk-installer-style download-on-demand pattern in its own plugin. Recommend a separate ticket + feasibility spike.

Verification

  • ./gradlew clean assemblePluginfluttertemplate.cgp
  • /plugin-review: build ✅, security clean ✅, rubric green (6.7 N/A — headless installer has no UI element to tooltip, matching the PCFInstaller precedent).
  • Device-verified on an emulator (CoGo C-d-0626): installed via Plugin Manager, all 5 templates register and appear on New Project beside the core templates with Flutter thumbnails; generated a project and confirmed APP_NAME/PACKAGE_NAME substitution with no leftover ${{}} tokens; plugin icon renders.

Two bugs caught during device testing (fixed in this PR)

  1. Invalid pubspec YAML — a bare ${{APP_NAME | lower}} at end-of-line lost its trailing newline to Pebble's newline-trimming, merging name:/description:. Fixed by quoting the value (dev-assets convention); re-verified valid on-device.
  2. Icons — replaced placeholder art with Flutter-branded thumbnails + day/night plugin icons.

Note (not blocking): CoGo's Plugin Manager loads icons via Glide, whose image_manager_disk_cache is keyed by path without mtime invalidation — so reinstalling a plugin under the same id shows a stale icon until that cache is cleared. The .cgp is correct; a fresh install is unaffected. Possibly worth a separate CoGo ticket.

Credit: contributed by Ali via the community submission process.

hal-eisen-adfa and others added 2 commits July 9, 2026 19:17
Rebuild Ali's Flutter Template community submission on the IDE's template
system. Instead of writing hardcoded Dart files to external storage (broken
under scoped storage), this is a headless installer modeled on
pebble-custom-function-template-installer: on activate() it registers five
Flutter templates (Basic, BLoC, Provider, GetX, Riverpod) via
IdeTemplateService so they appear on the New Project screen alongside the core
templates; on deactivate() it unregisters and cleans up.

Templates are authored as Pebble (.peb) skeletons following the dev-assets
core.cgt pattern, with APP_NAME/PACKAGE_NAME substitution. Adds the required
HTML doc, README, IDE version range (26.22-26.28), and repo wiring (README
table + update-libs deploy MAP).

The submission's committed release.keystore + plaintext signing passwords were
deliberately excluded. Flutter SDK install is out of scope (separate ticket).

Co-authored-by: Ali <rjali3232@gmail.com>
- Replace the placeholder PCF thumbnails/icons with Flutter-logo artwork:
  each of the 5 template thumbnails now shows the Flutter logo with a
  per-variant accent app-bar (Basic=blue, BLoC=purple, Provider=teal,
  GetX=orange, Riverpod=indigo); new day/night plugin icons (night uses a
  brighter palette to read on dark Plugin Manager cards).
- Fix pubspec.yaml 'name:' rendering: a bare ${{APP_NAME | lower}} at end of
  line had its trailing newline consumed by Pebble's newline-trimming, merging
  name: and description: into invalid YAML. Quote the value so a character
  follows the tag (matches the dev-assets convention). Verified on-device:
  generated pubspec now has name/description on separate lines.

Device-verified on emulator (CoGo C-d-0626): 5 templates register and appear
on New Project beside the core templates with Flutter thumbnails; generated
projects substitute APP_NAME/PACKAGE_NAME correctly; plugin icon renders.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@hal-eisen-adfa hal-eisen-adfa requested a review from a team July 10, 2026 03:23
Comment thread gradle/wrapper/gradle-wrapper.jar
Comment thread flutter-template/libs/plugin-api.jar Outdated
Point build.gradle.kts (compileOnly) and settings.gradle.kts (buildscript
classpath) at ../libs/*.jar and delete flutter-template's local libs/ copy,
so the plugin tracks the repo-root plugin-api/gradle-plugin jars instead of a
snapshot that can drift.

Promote the Gradle 8.14.3 wrapper to the repo root (gradlew, gradlew.bat,
gradle/wrapper/) and remove flutter-template's local wrapper. Build the plugin
with `cd flutter-template && ../gradlew assemblePlugin`; the resulting
classes.dex is byte-identical to the device-verified build. README updated.
Retrospective for the ADFA-3857 session: log time breakdown, observations,
and actions. Record cross-session learnings and conventions surfaced this run:

- CLAUDE.md: repo-root libs + single shared gradle wrapper convention;
  Pebble .cgt template-installer subsection with the newline-trim gotcha;
  Verification note on launching CoGo via SplashActivity (not monkey/LeakCanary)
  and the Glide plugin-icon disk-cache staleness.
- learnings.md: LeakCanary launch trap, Glide icon cache, Pebble bare-tag
  newline-trim, and the IdeTemplateService-vs-/sdcard registration pattern.
- retrospective.md: session entry + drafted CoGo Glide icon-cache bug ticket.
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