Repository navigation
Add flutterflow_live_activity: Live Activities from a typed spec - #2
Conversation
A new package next to flutterflow_native_layout. LiveActivityApp lists an app's Live Activities: fixed templates (progress, ETA timer, score, queue status) and Custom cards with their own values and one NativeLayoutModel per surface. generateLiveActivityFiles writes the ff_live_activity plugin (Dart, Swift, Kotlin), the iOS widget extension and, for Custom cards, their SwiftUI views, Android card specs and RemoteViews drawing. The pbxproj fragments and Info.plist entries add the extension to an app. The spec carries specVersion so a JSON form can map onto it later. native_layout.dart re-exports the layout core for code that reaches it through this package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spec getters (Android slots, defaults, image fallbacks, keychain groups), the channel contract in the generated Swift and Dart, the source checks that no contract name is retyped, Custom card views, pictures, Android card specs and drawing, and the Xcode project fragments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
LGTM. Compared every generator file against flutterflow_codegen/lib/components/live_activities/ on main: the changes are the ProjectInfo to spec swap and doc wording. Wire names and the pbxproj device family come out the same. CI steps pass locally for all three packages.
Non-blocking, mostly for the codegen adapter that builds the spec:
- The expanded island no longer falls back to the Lock Screen layout here. The adapter must put that (dark-read) copy in
surfaces[islandExpanded], or the island renders empty. - The generator clears the root fill and refits stage label colours on the caller's expanded model. If that model were shared with
lockScreen, Android (generated after iOS) would lose the card background. A copy or anidentical()assert would make the "must not be shared" note safe. - The old Android code skipped Image values with an empty default.
imageFallbackskeeps'', so the adapter should pass null for "no default".
On the question: I'd keep flutterflow_home_widget/native_layout.dart, so home-widget-only consumers don't need the Live Activity package to reach the core.
Question: where does the codegen adapter that builds LiveActivityApp from the project live? The 58-app identical-output check depends on it, and it isn't in this PR. Can you link the branch, so points 1 to 3 can be checked against it before codegen switches over?
The generator drops the top fill of the expanded island's model in place, so a model shared with the Lock Screen would lose its fill there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, all three checked. The code that builds
Keeping |
Follows #1. This PR adds only the new package.
What this does
Adds
flutterflow_live_activityunderpackages/flutterflow_live_activity/. It generates every file an app needs for Live Activities (iOS) and Live Updates (Android) from a typed Dart spec, built onflutterflow_native_layoutthe same way this repo's home widget package is.lib/src/spec.dart):LiveActivityAppholdsLiveActivityDefinitions. Each one has a key, name, description, template, accent colour, icon, Android channel name, values, one layout per surface, and the Android presentation and slots.progress,etaTimer,score,queueStatus) are presets with hand-written SwiftUI and Kotlin.customdraws a layout per surface.image.androidDefaults: an optional override, because Android shows some default values differently from iOS today.lib/flutterflow_live_activity.dartexports the spec, the channel contract,generateLiveActivityFilesand the per-platform generators, and re-exports the core.native_layout.dartre-exports just the core.A JSON form of the spec with
validate,generateandapplycommands, plus a typed app API, comes in a follow-up PR.How it was tested
flutterflow_live_activitytestsflutterflow_native_layoutandflutterflow_home_widgettestsdart analyzeQuestion
With this package in place, a consumer that only needs the core API can import it from
flutterflow_live_activity/native_layout.dart. That makesflutterflow_home_widget/native_layout.dartfrom #1 (the 68-nameshowlist) optional. Keep it for people who use only the home widget package, or drop it?🤖 Generated with Claude Code