feat(design): research-grounded token system + flagship HomeScreen#16
Open
feat(design): research-grounded token system + flagship HomeScreen#16
Conversation
- Onboarding flow + Selector-based first-launch routing in main.dart - 5 new screens: add_habit, analytics, onboarding, premium, settings - AdService (banner-only, --dart-define gated, premium-aware) - OnboardingService (settings-box backed, no new HiveType) - 5 new test files (30 pass, 2 documented skips) - Android: AGP/Gradle/desugaring + USE_EXACT_ALARM + minSdk 26 - iOS: Info.plist privacy strings + Time Sensitive Notifications hint - pubspec: add google_mobile_ads ^5.3.1; description -> Invisible Habit Builder Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
12-task plan with phase batching for pipeline execution. Maps every spec section to a concrete task; no placeholders. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 assertions, all passing. Resolved 3 stop adjustments needed during test development: * dark.streakChipBg: amber.500 @ 0.16 -> opaque #352D25 (pre-resolved over slate.900) so the contrast test evaluates the chip independently. * inkNavy.streakChipBg: amber.500 @ 0.16 -> opaque #342F26 (pre-resolved over navy) for the same reason. * paper.warning: amber.700 -> amber.800 (lifts paper-on-warning from 4.42:1 to ~6.2:1 while preserving warm-amber identity). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Habit cards: minHeight 80dp + full-card tap (Fitts's Law) - Identity vote line: forest dot + success-tinted copy when voted today (Lichtenfeld 2012 brief-glimpse priming at confirmation) - Streak chip: amber-on-amber via tokens.streakChipBg/streakChipFg; JetBrains Mono digits with tabular figures (no width jitter on 9->10) - Bottom-center FilledButton replaces bottom-right FAB per M3 2025 expressive guidelines for single-primary-action screens Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a research-grounded design system and applies it to the app theme/Home UI, but the actual diff is broader than the title alone: it also adds the surrounding onboarding, monetization, settings, analytics, and platform wiring needed for the current app shell.
Changes:
- Adds
lib/design/tokens, typography, spacing, and motion, then rebuildsAppThemeand the heatmap/Home UI around those semantic tokens. - Wires a fuller app flow into
main.dart: onboarding routing, ads, premium, add-habit, analytics, settings, and related services/screens. - Updates platform config, dependencies, tests, docs, and changelog to support ads, health, notifications, and design-token validation.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
test/onboarding_routing_test.dart |
Adds widget coverage for onboarding route selection. |
test/graceful_degradation_test.dart |
Adds boot test for empty --dart-define config. |
test/design_tokens_test.dart |
Adds WCAG contrast assertions for semantic tokens. |
test/analytics_screen_test.dart |
Adds (skipped) analytics empty-state test scaffold. |
test/add_habit_screen_test.dart |
Adds add-habit form validation/submission tests. |
test/ad_service_gating_test.dart |
Adds pure-Dart AdService gating tests. |
pubspec.yaml |
Updates app description and adds design/ads deps. |
pubspec.lock |
Locks new dependency graph and SDK floor. |
lib/widgets/skip_pattern_heatmap.dart |
Rebinds heatmap colors to semantic tokens. |
lib/services/onboarding_service.dart |
Adds persisted onboarding-complete flag service. |
lib/services/ad_service.dart |
Adds banner-ad service with graceful gating. |
lib/screens/settings_screen.dart |
Adds settings UI for theme, health, data, subscription, and intentions. |
lib/screens/premium_screen.dart |
Adds lifetime-IAP paywall screen. |
lib/screens/onboarding_screen.dart |
Adds four-page onboarding flow. |
lib/screens/home_screen.dart |
Refactors Home into flagship token-driven stateful screen with ads/nav/actions. |
lib/screens/analytics_screen.dart |
Adds analytics UI, premium gating, and IF-THEN creation flow. |
lib/screens/add_habit_screen.dart |
Adds create/edit habit form with scheduling and health metadata. |
lib/models/app_theme.dart |
Replaces seed-based theming with semantic-token theme construction. |
lib/main.dart |
Wires new services/providers and onboarding-based home routing. |
lib/design/typography.dart |
Defines app typography via Google Fonts. |
lib/design/tokens.dart |
Defines reference ramps, semantic colors, and theme extension. |
lib/design/spacing.dart |
Adds shared spacing/radius constants. |
lib/design/motion.dart |
Adds shared motion timing/curve constants. |
ios/Runner/Info.plist |
Renames app and adds notification/health/ads plist entries. |
docs/superpowers/plans/2026-05-04-research-grounded-design-system.md |
Adds implementation plan for the design system work. |
CLAUDE.md |
Updates repo memory/current-state docs. |
CHANGELOG.md |
Documents the new design system work. |
android/app/src/main/AndroidManifest.xml |
Adds permissions, branding, and AdMob metadata. |
android/app/build.gradle.kts |
Adds Android AdMob manifest placeholder wiring. |
Comment on lines
+506
to
+519
|
|
||
| @override | ||
| void didChangeDependencies() { | ||
| super.didChangeDependencies(); | ||
| final ads = context.read<AdService>(); | ||
| if (_banner == null && !ads.adsRemoved) { | ||
| final banner = ads.createBanner(); | ||
| banner?.load(); | ||
| setState(() => _banner = banner); | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| void dispose() { |
Comment on lines
+187
to
+197
| onToggle: () async { | ||
| final nowCompleted = await provider.toggleCompletion( | ||
| habit.id, | ||
| wasTwoMinuteVersion: | ||
| version == HabitVersionToSurface.twoMinute, | ||
| ); | ||
| // Pavlovian celebration only on completion (not un-toggle). | ||
| if (nowCompleted) { | ||
| await HapticFeedback.lightImpact(); | ||
| } | ||
| }, |
Comment on lines
+279
to
+284
| // Schedule the reminder. NotificationService doesn't expose a per- | ||
| // habit cancel API in v1.0 — only cancel(int) by id and cancelAll(). | ||
| // For edits the audit log will show the old + new schedule rows; | ||
| // acceptable for v1.0 (see task spec). | ||
| final when = _nextOccurrence(persisted, DateTime.now()); | ||
| await notifications.scheduleHabitReminder(habit: persisted, when: when); |
| proposal: proposal, | ||
| whenClause: whenText, | ||
| thenClause: thenText, | ||
| ); |
Comment on lines
+187
to
+192
| final proposal = intentions.propose( | ||
| habit: habit, | ||
| pattern: pattern, | ||
| dayOfWeek: cell.dayOfWeek, | ||
| hour: cell.hour, | ||
| ); |
Comment on lines
+171
to
+175
| home: Selector<OnboardingService, bool>( | ||
| selector: (_, service) => service.hasOnboarded, | ||
| builder: (_, done, _) => | ||
| done ? const HomeScreen() : const OnboardingScreen(), | ||
| ), |
| collection: ^1.19.1 # groupBy, partition for skip-pattern math | ||
| path_provider: ^2.1.5 # Hive box + delivery-audit log location | ||
| google_mobile_ads: ^5.3.1 # Banner ads for free tier; AdService gracefully no-ops when unit IDs unset. | ||
| google_fonts: ^6.2.1 # Plus Jakarta Sans + JetBrains Mono via OFL 1.1; runtime-fetched, no asset bundling |
Comment on lines
+138
to
+139
| 'Come back after a week of data — your skip pattern needs ' | ||
| 'at least 4 occurrences in a window before it shows.', |
Comment on lines
+537
to
+540
| // Completions are scoped per-habit on disk (composite key); pull a | ||
| // generous trailing window for each habit. 365 days gives a year of | ||
| // history without iterating the full Hive box. | ||
| for (final c in habitProvider.completionsFor(h.id, windowDays: 365)) { |
Comment on lines
+549
to
+562
| for (final i in intentions.activeFor(h.id)) { | ||
| intentionJson.add({ | ||
| 'id': i.id, | ||
| 'habitId': i.habitId, | ||
| 'whenClause': i.whenClause, | ||
| 'thenClause': i.thenClause, | ||
| 'targetDayOfWeek': i.targetDayOfWeek, | ||
| 'targetHour': i.targetHour, | ||
| 'createdAt': i.createdAt.toIso8601String(), | ||
| 'windowsObserved': i.windowsObserved, | ||
| 'windowsAdhered': i.windowsAdhered, | ||
| 'isArchived': i.isArchived, | ||
| }); | ||
| } |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ColorScheme.fromSeedbaseline with a 3-layer research-grounded token system inlib/design/.sky → crimsonsemantic stops.Spec:
docs/superpowers/specs/2026-05-04-research-grounded-design-system-design.mdPlan:
docs/superpowers/plans/2026-05-04-research-grounded-design-system.mdTest plan
flutter analyze --fatal-infos— cleanflutter test— 62 pass / 2 skip (added 27 contrast tests on top of the 35/2 baseline)flutter build apk --debug— Builtbuild/app/outputs/flutter-apk/app-debug.apkflutter run -d chrome— onboard, complete a habit, confirm forest bloom + amber streak chip + sky primarySequencing
Independent of PRs #12 / #13 / #14 / #15 at the file level. Branched from
main(commit6e4896d feat(v1.0): land store-ready release). After those merge this PR rebases cleanly (verified: file overlap is empty except forlib/main.dartwhich we don't touch in this PR).Out of scope
AddHabit / Analytics / Premium / Settings / Onboarding screens — deferred to a follow-up PR. They will continue to consume the rebuilt
ThemeData(which is API-compatible — only the underlying values change), but won't yet readcontext.tokens.Xdirectly.🤖 Generated with Claude Code