design-system(mobile): SureSpacing + SureTypography scale tokens#2438
Conversation
Introduce hand-authored spacing and type-scale constants mirroring the Tailwind defaults the web design system relies on, so widgets reference a named step instead of a raw numeric EdgeInsets/SizedBox/fontSize. - SureSpacing: xs..huge mapping to Tailwind space-1..space-8 (4..32px). - SureTypography: xs..xxl mapping to Tailwind text-xs..text-2xl font sizes. Both are hand-written rather than generated from sure.tokens.json because spacing and the type ramp come from Tailwind's built-in scale, not the canonical token file (consistent with the tracker's guidance). Adopt them in the existing primitives (card padding, button metrics + gap, chip/segmented/list-group gaps and padding, text-field padding + label gap). All migrations are value-preserving — each token equals the literal it replaces — so there is no layout change; off-scale one-offs (control heights, hairlines, deliberate 14px field padding) stay literal. flutter analyze: no new issues; full suite (166) green.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughTwo new design token classes ( ChangesDesign Token Scale and Widget Adoption
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
jjmata
left a comment
There was a problem hiding this comment.
Clean primitives, well-documented with Tailwind step references. A few observations:
SureChip horizontal padding stays as 14 — SureChip uses EdgeInsets.symmetric(horizontal: 14, ...) after this PR. 14 doesn't map to any SureSpacing constant (closest are lg=12 and xl=16). The class docstring says "component-specific dimensions intentionally stay as literals", so this is presumably intentional — but a brief inline comment on that line noting it's deliberately off-scale would help future readers who might otherwise try to "fix" it.
SureTypography missing line-height pairing — The class documents paired line-heights in the comments (/// 14 / 20 — Tailwind text-sm), but doesn't expose them as constants. If Flutter widgets ever need the line-height value (e.g., TextStyle(height: x)), they'll need to reach for raw numbers. That's fine for now, but worth noting if the scale is extended.
Otherwise, the mechanical replacement of raw 16, 12, 8 etc. with named constants throughout the widgets is exactly the right kind of migration.
Generated by Claude Code
…ne heights Address review feedback (jjmata): - SureChip: add an inline comment explaining the horizontal:14 content inset is deliberately off the SureSpacing scale (between lg=12 and xl=16) — a tuned FilterChip-parity dimension, not a spacing step — so it isn't "fixed" to a token later. - SureTypography: expose the paired line heights (xsLineHeight … xxlLineHeight, logical px matching the Tailwind text-* defaults) that were previously only in doc comments, with a note on deriving Flutter's TextStyle.height multiplier (lineHeight / fontSize). No behavior change.
|
Thanks @jjmata — both addressed in 0ba950f:
|
Summary
Adds named spacing and type-scale constants mirroring the Tailwind defaults the web design system uses, so widgets reference a DS step instead of a raw
EdgeInsets/SizedBox/fontSizeliteral.Closes #2437. Part of the mobile design-system roadmap #2235.
Change
sure_spacing.dart—SureSpacing.xs..huge→ Tailwindspace-1..space-8(4..32px).sure_typography.dart—SureTypography.xs..xxl→ Tailwindtext-xs..text-2xlfont sizes.sure.tokens.json/the generator) because spacing + the type ramp come from Tailwind's built-in scale, not the canonical token file.Every migration is value-preserving (each token equals the literal it replaces), so there is no rendered layout change; off-scale one-offs (control heights, hairlines, the deliberate 14px field padding) stay literal.
Screenshots
Before – raw literals
After – SureSpacing/SureTypography tokens
Before – raw literals
After – SureSpacing/SureTypography tokens
Test plan
flutter analyze --no-fatal-infos— no new issuesflutter test— green (166), including the primitive geometry/chrome tests (unchanged because values are identical)Summary by CodeRabbit