Skip to content

feat: Implement theme system and shared text styles for Button and Navigation Components#37

Merged
xkaper001 merged 1 commit intodevfrom
xkaper001/issue17
Oct 26, 2025
Merged

feat: Implement theme system and shared text styles for Button and Navigation Components#37
xkaper001 merged 1 commit intodevfrom
xkaper001/issue17

Conversation

@xkaper001
Copy link
Copy Markdown
Owner

@xkaper001 xkaper001 commented Oct 26, 2025

Overview

This PR implements a comprehensive theme system and shared text styles as foundational work for creating button and navigation components.

Changes Made

Shared Core Theme System (docpilot_core)

  • ✅ Created TextStyle class with comprehensive text style variants:
    • Display styles (display1, display2, display3)
    • Headline styles (headline1-6)
    • Title styles (title1-6)
    • Body styles (body1-6)
    • Label styles (label1-6)
    • Support for regular, medium, semi-bold, and bold weights
  • ✅ Enhanced ThemeHelper for centralized theme access across all apps
  • ✅ Exported theme utilities through docpilot_core.dart

DocPilot Doctor App

  • ✅ Integrated shared theme system
  • ✅ Updated AppTheme to use ThemeHelper
  • ✅ Added navigation icon assets (home, calendar, patients, prescribe)
  • ✅ Updated palette for consistency
  • ✅ Added flutter_svg dependency for icon rendering

DocPilot Patient App

  • ✅ Integrated shared theme system
  • ✅ Updated palette for consistency
  • ✅ Added necessary dependencies

Technical Details

  • Theme Architecture: Centralized theme management through docpilot_core
  • Text Styles: Full typographic system matching design specifications
  • Icon Support: SVG icons for navigation elements
  • Cross-Platform: Consistent theming across doctor and patient apps

Related Issue

Closes #17

Testing

  • Theme system correctly provides text styles
  • Both apps compile successfully with integrated theme
  • Text styles render correctly across different variants

Next Steps

This PR sets the foundation for:

  • Creating button components (primary, secondary, tertiary)
  • Building navigation components (bottom nav bar, top nav bar)
  • Implementing progress bars and pagination dots

Screenshots

(Theme system and text styles are foundational - visual components will be demonstrated in subsequent PRs)

Checklist

  • Code follows project style guidelines
  • Changes have been tested locally
  • Dependencies properly added to pubspec.yaml
  • Shared library properly integrated
  • No breaking changes to existing code

Summary by CodeRabbit

  • New Features

    • Standardized typography system with predefined text styles for headings, body text, actions, and captions with color variants
    • Expanded color palette featuring neutral, success, warning, and error variants with multiple tonal levels
    • Added icon sizing and border width constants for consistent UI design
  • Chores

    • Integrated SVG icon support and code generation tools for development workflow

- Created shared theme system in docpilot_core
- Implemented comprehensive text styles (TextStyle) with all variants
- Added ThemeHelper for centralized theme access
- Integrated theme system in docpilot_doctor and docpilot_patient
- Added icon assets to docpilot_doctor
- Updated palette definitions for consistency across apps

Addresses #17
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 26, 2025

Walkthrough

The PR centralizes the design system by introducing DocPilotTextStyles to docpilot_core and expanding ThemeHelper with standardized color constants, icon sizes, and border widths. Both doctor and patient apps migrate to use ThemeHelper-sourced colors via Palette and add build runner/flutter_gen configuration for code generation.

Changes

Cohort / File(s) Summary
Core Theme Infrastructure
docpilot_core/lib/docpilot_core.dart, docpilot_core/lib/src/theme/text_style.dart
New DocPilotTextStyles class with static TextStyle constants for headings (h1–h5), body sizes (bodyXL–bodyXS), actions, captions, and color variant helpers; exported from public API.
Core Theme Helper Expansion
docpilot_core/lib/src/theme/theme_helper.dart
Added 18 color constants (neutral light/dark palettes, success/warning/error variants), icon sizes, border widths, and helper methods getBorderWidth() and getTextColor().
Doctor App Theme Consolidation
docpilot_doctor/lib/core/theme/app_theme.dart, docpilot_doctor/lib/core/theme/palette.dart, docpilot_doctor/lib/main.dart
Simplified lightTheme (removed custom button/scaffold overrides); migrated Palette colors to ThemeHelper constants; applied theme to MaterialApp.router.
Doctor App Build Configuration
docpilot_doctor/pubspec.yaml, docpilot_doctor/.gitignore
Added flutter_svg, solar_icons, build_runner, flutter_gen_runner, flutter_lints; added flutter_gen config block and generated file ignore patterns.
Patient App Theme Consolidation
docpilot_patient/lib/core/theme/palette.dart
Migrated Palette colors to ThemeHelper constants; added docpilot_core import.
Patient App Build Configuration
docpilot_patient/pubspec.yaml, docpilot_patient/.gitignore
Added flutter_svg, solar_icons, build_runner, flutter_gen_runner; added flutter_gen config block and generated file ignore patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention areas:
    • Verify that all 18 new color constants in ThemeHelper align with design system specs (no value mismatches vs. originals).
    • Confirm that DocPilotTextStyles typography values (font sizes, weights, line heights) are correct per design; check color assignments in heading/body styles.
    • Review the simplified AppTheme.lightTheme to ensure no unintended visual regressions from removed customizations.
    • Validate that both Palette migrations (doctor & patient) have 1:1 mapping from hard-coded colors to ThemeHelper values (18 constants each).
    • Check flutter_gen configuration and build_runner integration for correctness.

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Poem

🎨 Colors once scattered now unite with pride,
Typography standards crystallized inside,
From docpilot_core the system shines bright,
Doctor and patient apps, aligned just right!

Pre-merge checks

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning Issue #17 requires the creation of actual button components (primary, secondary, tertiary with specific features like loading states, icons, haptic feedback, accessibility) and navigation components (bottom nav bar, top nav bar, progress bar, pagination dots). This PR provides only foundational infrastructure—a theme system with text styles, color constants, and utilities—but does not implement any of the required button or navigation components themselves. While the PR author explicitly states this is "foundation work," the primary objectives and acceptance criteria of issue #17 (all button variants working, smooth navigation, Figma design compliance, proper state management) are not met by this PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Out of Scope Changes Check ❓ Inconclusive Most changes align with providing a theme system and text styles—the core objective. However, the PR introduces several supporting dependencies and configurations (flutter_svg, solar_icons, build_runner, flutter_gen_runner, flutter_gen configuration) that extend beyond foundational theming into preparatory infrastructure for future button and navigation components. Additionally, the PR description mentions "Added navigation icon assets (home, calendar, patients, prescribe)" but the actual icon files are not clearly documented in the provided change summaries, creating uncertainty about whether files beyond the scope of theme infrastructure were added.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "feat: Implement theme system and shared text styles for Button and Navigation Components" is clear, specific, and directly related to the primary changes in the PR. It accurately summarizes that the PR is implementing a foundational theme system and text styles, not vague or overly broad. The title effectively communicates to reviewers that this is infrastructure work supporting future component development.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docpilot_doctor/lib/core/theme/palette.dart (1)

50-55: Disabled text contrast fails WCAG AA.

Verified: textDisabled (0xFF8F9098 on 0xFFFFFFFF background) achieves only 3.18:1 contrast ratio, falling short of the 4.5:1 minimum for WCAG AA compliance. Consider lightening the disabled text color or darkening the background to meet accessibility standards.

🧹 Nitpick comments (8)
docpilot_core/lib/src/theme/theme_helper.dart (1)

151-167: Progress indicator theme - one tiny nit on const.

The theme configuration looks good overall, but line 158 should use const EdgeInsets.all(2.0) since it's a compile-time constant.

-        circularTrackPadding: EdgeInsets.all(2.0),
+        circularTrackPadding: const EdgeInsets.all(2.0),
docpilot_doctor/lib/core/theme/app_theme.dart (1)

184-193: Theme simplified to delegate to ThemeHelper - but the copyWith is a no-op.

The refactor to rely entirely on ThemeHelper.createAppTheme is clean and aligns with centralized theming. However, line 192 calls baseTheme.copyWith() with no arguments, which effectively does nothing.

You can simplify this further:

   static ThemeData get lightTheme {
     // Get base theme from ThemeHelper with doctor app primary color
     final baseTheme = ThemeHelper.createAppTheme(
       primaryColor: Palette.primary,
       fontFamily: fontFamily,
     );

-    // Customize with doctor app specific colors
-    return baseTheme.copyWith();
+    return baseTheme;
   }

Or if you anticipate adding customizations later, add a comment explaining the structure:

    // Return base theme (doctor-specific customizations can be added here if needed)
    return baseTheme;
docpilot_core/lib/src/theme/text_style.dart (5)

16-23: Unify text colors with ThemeHelper; avoid hex drift.

All these styles hard-code 0xFF1F1F1F while helpers use 0xFF1F2024. Pipe base text color through ThemeHelper (e.g., ThemeHelper.neutralDarkDarkest) to keep one source of truth and simplify dark‑mode later.

Example (apply similarly across all styles):

-  static const TextStyle h1 = TextStyle(
+  static const TextStyle h1 = TextStyle(
     fontFamily: _fontFamily,
     fontSize: 24,
     fontWeight: FontWeight.w800, // Extra Bold
     height: 1.0, // 100% line height
     letterSpacing: 0.24,
-    color: Color(0xFF1F1F1F),
+    color: ThemeHelper.neutralDarkDarkest,
   );

Note: import ThemeHelper from core internals to avoid circular export. Keep it consistent across h1–h5, bodyXL–XS, actionL–S, captionM.

Also applies to: 27-34, 39-45, 49-55, 59-65, 71-77, 81-87, 91-97, 101-108, 112-119, 125-131, 135-141, 145-151, 159-165


169-199: Make color helpers theme-aware and de-duplicate hex.

These helpers lock in hex values. Consider deriving from ThemeHelper or a ThemeData ColorScheme to adapt to light/dark and reduce duplication.

Minimal option:

-  static TextStyle withDarkColor(TextStyle style) {
-    return style.copyWith(color: const Color(0xFF1F2024));
-  }
+  static TextStyle withDarkColor(TextStyle style) {
+    return style.copyWith(color: ThemeHelper.neutralDarkDarkest);
+  }

Theme-aware option:

+  static TextStyle withColorFromTheme(
+    BuildContext context,
+    TextStyle style,
+    Color Function(ColorScheme s) pick,
+  ) {
+    final scheme = Theme.of(context).colorScheme;
+    return style.copyWith(color: pick(scheme));
+  }

14-24: Heading line-height at 1.0 can feel tight and clip with scale.

Consider removing explicit height (let font metrics drive) or using a slightly looser ratio (e.g., 1.15–1.2) for multi-line headings. Helps with large text scaling.

Also applies to: 25-35, 36-46, 47-56, 57-66


155-165: Caption uppercase: provide an API, not a comment.

Add an opt-in helper or Text widget wrapper to transform to uppercase to avoid caller-by-caller string munging.

Example:

class UppercaseText extends StatelessWidget {
  final String data;
  final TextStyle? style;
  const UppercaseText(this.data, {super.key, this.style});
  @override
  Widget build(BuildContext context) =>
      Text(data.toUpperCase(), style: style ?? DocPilotTextStyles.captionM);
}

3-11: Naming alignment with design tokens.

PR summary mentions display/headline/title/body/label. File exposes h1–h5, body*, action*, caption*. Consider alias getters or mapping docs to reduce cognitive load.

Example aliases:

static const TextStyle headline1 = h1;
static const TextStyle labelM = actionM;
docpilot_doctor/lib/core/theme/palette.dart (1)

12-18: Consider centralizing primary shades too.

Primary* are still hex here. If core owns tokens, mirror them in ThemeHelper (e.g., ThemeHelper.primaryDarkest, …) and reference here to prevent drift between apps.

Example:

-  static const Color primaryDarkest = Color(0xFF006FFD);
+  static const Color primaryDarkest = ThemeHelper.primaryDarkest;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c9d66de and fc818d7.

⛔ Files ignored due to path filters (10)
  • docpilot_doctor/assets/icons/calendar.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/calendar_selected.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/home.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/home_selected.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/patients.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/patients_selected.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/prescribe.svg is excluded by !**/*.svg
  • docpilot_doctor/assets/icons/prescribe_selected.svg is excluded by !**/*.svg
  • docpilot_doctor/pubspec.lock is excluded by !**/*.lock
  • docpilot_patient/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • docpilot_core/lib/docpilot_core.dart (1 hunks)
  • docpilot_core/lib/src/theme/text_style.dart (1 hunks)
  • docpilot_core/lib/src/theme/theme_helper.dart (9 hunks)
  • docpilot_doctor/.gitignore (1 hunks)
  • docpilot_doctor/lib/core/theme/app_theme.dart (1 hunks)
  • docpilot_doctor/lib/core/theme/palette.dart (2 hunks)
  • docpilot_doctor/lib/main.dart (2 hunks)
  • docpilot_doctor/pubspec.yaml (2 hunks)
  • docpilot_patient/.gitignore (1 hunks)
  • docpilot_patient/lib/core/theme/palette.dart (2 hunks)
  • docpilot_patient/pubspec.yaml (2 hunks)
🔇 Additional comments (21)
docpilot_patient/.gitignore (1)

46-49: Clean addition of generated file patterns.

The three ignore patterns correctly exclude common Dart-generated artifacts (flutter_gen, build_runner, freezed). Standard and appropriate for the tooling being integrated.

docpilot_doctor/.gitignore (1)

47-49: LGTM! Solid additions for generated code.

These ignore patterns are exactly what you need for the new code generation tooling (flutter_gen, build_runner) added in the pubspec. Keeps the repo clean from generated artifacts.

docpilot_patient/pubspec.yaml (2)

14-16: Dependencies look good, version alignment is solid.

The flutter_svg and solar_icons versions match the doctor app setup. Nice consistency across modules.


49-53: Review comment is incorrect—assets are already properly declared.

The pubspec.yaml already contains an assets: block in the flutter section. The Inter font family with all 9 font weights (100-900) is properly declared with corresponding asset paths. No changes needed.

Likely an incorrect or invalid review comment.

docpilot_doctor/pubspec.yaml (3)

14-16: Dependencies looking fresh.

flutter_svg and solar_icons versions are consistent with the patient app. Nice work keeping versions aligned across the monorepo.


51-55: Flutter Gen config is clean.

Output path and SVG integration look good for generating type-safe asset references.


27-28: Assets directory verified ✓

The assets/icons/ directory exists and contains all navigation icons as expected—calendar, home, patients, and prescribe (with selected state variants). The pubspec.yaml declaration is correct.

docpilot_core/lib/src/theme/theme_helper.dart (8)

2-2: Text style integration looks good.

Importing the new text_style module to use DocPilotTextStyles in the theme configuration below.


22-49: Comprehensive color system - nicely organized.

The neutral/success/warning/error color palettes are well-structured and follow a clear naming convention (darkest → lightest). This centralization will make theming much more consistent across apps.


65-73: Border width helper logic is clean.

Returns thick border for error/focus states, medium otherwise. Straightforward and correct.


76-79: Text color helper looks solid.

Uses theme colors appropriately for enabled/disabled states.


109-122: Filled button theme configured nicely.

Primary color background with white foreground, proper spacing and border radius. The elevation: 0 gives it that modern flat look.


124-136: Outlined button theme looks correct.

Consistent spacing and border radius with the filled variant, proper use of primary color for foreground and border.


138-149: Text button theme is on point.

Lighter padding than filled/outlined buttons makes sense for tertiary actions.


178-192: Navigation bar theme integrated with DocPilotTextStyles.

The dynamic text style switching based on selected state is solid. Using DocPilotTextStyles.actionM for selected items and bodyXS for unselected gives good visual hierarchy.

docpilot_doctor/lib/main.dart (2)

4-4: Theme import added cleanly.

Bringing in the centralized theme configuration.


18-18: Theme application looks perfect.

Wiring up AppTheme.lightTheme to the MaterialApp. Nice and clean integration.

docpilot_core/lib/docpilot_core.dart (1)

37-38: Text style utilities now public - nice.

Exporting the new text_style module makes DocPilotTextStyles available across both apps. Clean API extension.

docpilot_patient/lib/core/theme/palette.dart (2)

1-1: Core theme integration added.

Importing docpilot_core to access ThemeHelper color constants.


20-46: Color consolidation looks excellent.

All neutral/success/warning/error colors now sourced from ThemeHelper, establishing a single source of truth. Patient-specific primary colors (purple/pink) remain local, which makes sense. This pattern keeps shared colors centralized while preserving app-specific brand colors.

docpilot_doctor/lib/core/theme/palette.dart (1)

1-1: Nice move to ThemeHelper.

Swapping neutrals and semantic colors to ThemeHelper tightens consistency and reduces duplication. Looks good.

Also applies to: 20-25, 27-32, 34-37, 39-41, 44-46

@xkaper001 xkaper001 merged commit 7e98bdd into dev Oct 26, 2025
2 checks passed
@xkaper001 xkaper001 deleted the xkaper001/issue17 branch October 26, 2025 18:44
@github-actions
Copy link
Copy Markdown

🎊 Well done, @xkaper001! Your PR has been merged into the project! 🚀

Thank you for your hard work and dedication! Contributors like you make open source truly special. Keep being awesome! 💫🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Button and Navigation Components

1 participant