Skip to content

Conversation

@divyanshub024
Copy link
Member

@divyanshub024 divyanshub024 commented Nov 7, 2025

Description

We have added Stac Theme to stac_core to provide the DSL support for the Stac theme. This will allow us to write the theme in Dart instead of json.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Code refactor
  • Build configuration change
  • Documentation
  • Chore

Summary by CodeRabbit

  • Refactor

    • Restructured theme parsing to use lightweight extension-based parsers, simplifying internals while preserving theme behaviors and conversions.
  • New Features

    • Added parsing support for additional theme controls (navigation label behavior, button layout & text themes, and many widget theme converters) to broaden runtime theming.
  • Chores

    • Added an ignore entry for the FVM version cache (.fvm/) to project ignore rules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Warning

Rate limit exceeded

@divyanshub024 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b1d5009 and 48836cb.

📒 Files selected for processing (17)
  • packages/stac/lib/src/framework/stac.dart (5 hunks)
  • packages/stac/lib/src/framework/stac_app.dart (3 hunks)
  • packages/stac/lib/src/framework/stac_error.dart (5 hunks)
  • packages/stac/lib/src/framework/stac_registry.dart (1 hunks)
  • packages/stac/lib/src/framework/stac_service.dart (2 hunks)
  • packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/geometry/stac_rect_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/theme/stac_input_decoration_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/ui_components/stac_system_ui_overlay_style_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart (1 hunks)

Walkthrough

A large refactor removes many Freezed-generated STAC theme data classes and generated JSON parts, adds parser extension files that map STAC types to Flutter theme types (parse methods/getters), updates several import paths/exports, and adds a .gitignore entry for .fvm/. No runtime control-flow beyond mapping/parsing functions is introduced.

Changes

Cohort / File(s) Summary
VCS config
\.gitignore``
Adds .fvm/ to ignore list.
Import / small edits
packages/stac/lib/src/framework/stac_app.dart,
packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart
Update import paths to use flattened themes.dart.
Foundation exports
packages/stac/lib/src/parsers/foundation/foundation.dart
Adds exports for three new parser files (navigation & theme parsers).
New foundation parsers
packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart,
packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart,
packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart
New extensions converting STAC enums to Flutter enums (provide parse getter/methods).
Theme parser refactors (pattern)
multiple packages/stac/lib/src/parsers/theme/** files (see list below)
Remove Freezed data classes and generated .freezed.dart / .g.dart files; add new *_parser.dart extensions that map STAC models to Flutter theme types via parse(BuildContext) methods.
Representative affected theme paths
packages/stac/lib/src/parsers/theme/stac_app_bar_theme/*, stac_badge_theme_data/*, stac_bottom_app_bar_theme/*, stac_bottom_nav_bar_theme/*, stac_bottom_sheet_theme/*, stac_button_theme_data/*, stac_card_theme_data/*, stac_checkbox_theme_data_parser.dart, stac_chip_theme_data/*, stac_color_scheme/*, stac_date_picker_theme_data/*, stac_dialog_theme/*, stac_dialog_theme_data_parser.dart, stac_divider_theme_data/*, stac_drawer_theme_data/*, stac_floating_action_button_theme_data/*, stac_icon_theme_data/*, stac_list_tile_theme_data/*, stac_material_banner_theme_data/*, stac_material_color/*, stac_navigation_bar_theme_data/*, stac_navigation_drawer_theme_data/*, stac_scrollbar_theme_data/*, stac_snack_bar_theme_data/*, stac_tab_bar_theme_data/*
Large, repeated refactor: deletion of Freezed model + generated serialization files and addition of parser-extension files (e.g., stac_*_parser.dart) that implement conversion to Flutter theme classes.

(Note: the theme refactor cohort groups dozens of specific files; each removed Freezed .dart, .freezed.dart, and .g.dart artifacts were replaced/adapted into corresponding *_parser.dart extensions.)

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant JSON as JSON input
  participant STAC as StacModel (decoded)
  participant Parser as Parser Extension (new)
  participant Flutter as Flutter Theme

  Note over JSON,STAC: Previously: JSON -> Freezed.fromJson -> FreezedModel -> parser extension? (removed)
  JSON->>STAC: decode to StacModel (was via generated fromJson)
  STAC->>Parser: call .parse(context) (new extension)
  Parser->>Flutter: construct Flutter ThemeData (AppBar/Card/...)
  Note right of Flutter: Theme objects used at runtime
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Reason: Many files changed but the pattern is highly repetitive (removal of Freezed/generated artifacts and addition of analogous parser extensions). Review requires spot-checking several representative parser implementations for correctness and import wiring rather than line-by-line logic reasoning for every file.

Attention points:

  • Verify each new parse maps all former fields correctly (including nullable handling and defaults).
  • Confirm no callers still rely on removed generated fromJson/Freezed APIs.
  • Ensure foundation export additions and changed import paths compile across package.

Possibly related PRs

  • chore: Release Stac 1.0.0-dev.7 #355 — Overlapping large-scale refactor of STAC parser/theme modules removing Freezed models and replacing with parser extensions (strong code-level overlap).

Suggested reviewers

  • Potatomonsta
  • rahulbisht25

Poem

🐰 I hopped through code with care and cheer,

Freezed forms shrank, parser-flowers appear.
Enums now parse and themes take flight,
Cleaned paths and .fvm tucked out of sight.
🥕 A tiny hop for rabbit, big for build delight.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor: Add Stac Theme and ThemeData classes to stac_core' directly and accurately summarizes the main objective: adding theme support to stac_core. However, the changeset shows extensive refactoring that moves theme parsing from data classes to extension-based parsers across 40+ theme files, which is a more significant architectural change than the title alone conveys.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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
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: 9

Caution

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

⚠️ Outside diff range comments (4)
packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart (1)

33-34: Guard against null before casting dayShape.

dayShape?.parse(context) evaluates to null when dayShape is absent, but the subsequent as OutlinedBorder forces a non-null cast and will throw at runtime. Wrap this in a null check and only build the WidgetStatePropertyAll when dayShape is present.

Apply this diff:

-      dayShape:
-          WidgetStatePropertyAll(dayShape?.parse(context) as OutlinedBorder),
+      dayShape: dayShape == null
+          ? null
+          : WidgetStatePropertyAll(
+              dayShape!.parse(context) as OutlinedBorder,
+            ),
packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart (1)

22-24: Use MaterialStatePropertyAll for Material-only fields

NavigationDrawerThemeData.labelTextStyle and .iconTheme are typed as MaterialStateProperty, so constructing them with WidgetStatePropertyAll fails to compile. Switch to MaterialStatePropertyAll (or return null when absent) to satisfy the API contract.

-      labelTextStyle: WidgetStatePropertyAll(labelTextStyle?.parse(context)),
-      iconTheme: WidgetStatePropertyAll(iconTheme?.parse(context)),
+      labelTextStyle: MaterialStatePropertyAll(labelTextStyle?.parse(context)),
+      iconTheme: MaterialStatePropertyAll(iconTheme?.parse(context)),

(api.flutter.dev)

packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart (2)

10-21: Remove null assertions and add proper null handling for shade color conversions.

The toColor() method returns Color? (nullable) and can return null when the color string is empty. Using null assertions (!) on all 10 shade conversions without fallback handling will cause runtime crashes if any shade value is empty or misconfigured. Replace with null coalescing (??) to provide fallback colors or restructure to validate shade values before the map is built.


23-27: Replace deprecated .value with .toARGB32() on line 25.

Line 25 uses the deprecated Color.value property. Replace it with Color.toARGB32():

    return MaterialColor(
      // ignore: deprecated_member_use  // Remove this ignore comment
      (primary.toColor(context))!.toARGB32(),
      color,
    );

The ignore comment can also be removed once the deprecated member is no longer used.

🧹 Nitpick comments (4)
packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart (1)

10-10: Consider renaming for consistency.

The extension name StacFloatingActionThemeParser omits "Button" while the extended class is StacFloatingActionButtonThemeData. For better clarity and consistency, consider renaming to StacFloatingActionButtonThemeParser.

-extension StacFloatingActionThemeParser on StacFloatingActionButtonThemeData {
+extension StacFloatingActionButtonThemeParser on StacFloatingActionButtonThemeData {
packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart (1)

5-18: Clean refactoring approach! Consider adding method documentation.

The extension pattern is well-implemented and follows good practices. The null-safe color parsing and direct property mapping are appropriate for this use case.

Consider adding documentation to the parse method for improved maintainability:

+  /// Converts this [StacDividerThemeData] to Flutter's [DividerThemeData].
+  ///
+  /// The [context] is used to resolve theme-dependent color values.
   DividerThemeData parse(BuildContext context) {
packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart (1)

35-35: Parser pattern is inconsistent but likely intentional.

The brightness?.parse uses a getter pattern while other parsers use method calls with context (e.g., side?.parse(context)). This is acceptable if brightness parsing doesn't require context, but the inconsistency is worth noting for future maintainability.

packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart (1)

8-17: Unused context parameter.

The context parameter is accepted but never used in this method. This appears intentional for API consistency with other parsers, but consider whether this parser truly needs the context parameter or if a simpler signature would be more appropriate.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9664784 and b1c3d8f.

📒 Files selected for processing (92)
  • .gitignore (1 hunks)
  • packages/stac/lib/src/framework/stac_app.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/foundation.dart (2 hunks)
  • packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/theme/stac_button_text_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_color_scheme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data_parser.dart (1 hunks)
💤 Files with no reviewable changes (61)
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.g.dart
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.g.dart
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.g.dart
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart
  • packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart
  • packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart
  • packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.g.dart
  • packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart
  • packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart
🔇 Additional comments (37)
.gitignore (1)

45-46: Good practice: FVM cache directory ignored.

Adding .fvm/ to gitignore is appropriate for Flutter projects using FVM (Flutter Version Manager). This prevents the version cache from being accidentally committed to version control.

packages/stac/lib/src/parsers/foundation/ui_components/stac_dropdown_menu_entry_parser.dart (1)

3-3: Clean import consolidation.

The refactoring to consolidate theme-related parsers under themes.dart improves code organization and aligns well with the PR's objective to centralize theme functionality.

packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data_parser.dart (2)

1-5: Imports look good.

All necessary dependencies are included for the parser implementation.


11-29: Implementation looks solid.

The parse method correctly maps all properties with appropriate null handling and context-aware parsing for colors and text styles. The pattern is consistent with other theme parsers in the codebase.

packages/stac/lib/src/parsers/theme/stac_icon_theme_data_parser.dart (3)

1-4: LGTM: Clean imports.

All imports are necessary and properly used in the implementation.


6-9: LGTM: Clear documentation and extension declaration.

The documentation accurately describes the extension's purpose, and the naming follows a clear, consistent pattern.


10-22: LGTM: Clean and straightforward implementation.

The parse method correctly maps all IconThemeData fields with appropriate null-safe handling. The implementation follows the extension-based parsing pattern described in the PR objectives.

packages/stac/lib/src/parsers/theme/stac_divider_theme_data_parser.dart (1)

1-3: LGTM! Clean import structure.

The imports are well-organized and all necessary for the parser implementation.

packages/stac/lib/src/framework/stac_app.dart (1)

2-2: Import consolidation verified as correct.

The new import path properly exports StacTheme from stac_core via the centralized themes.dart export file, and all parser extensions are also available. No remaining references to the old import path exist elsewhere in the codebase. The change is complete and aligns with the refactoring objectives.

packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data_parser.dart (1)

1-35: LGTM! Clean refactoring from Freezed to extension-based parser.

The implementation is well-structured and consistent:

  • New imports for behavior and dismissDirection parsers are correctly integrated
  • Documentation clearly explains the extension's purpose
  • Parser API design is logical (context-free .parse for enums/simple types, .parse(context) for theme-aware types)
  • Null safety is properly handled throughout
  • Formatting improvement on lines 30-32 enhances readability
packages/stac/lib/src/parsers/theme/stac_drawer_theme_data_parser.dart (3)

1-5: LGTM!

The imports are clean, necessary, and properly organized for the parser extension implementation.


7-9: Clear documentation.

The doc comment effectively explains the purpose and behavior of the parser extension.


10-24: Code implementation is correct and approved.

The extension properly converts StacDrawerThemeData to Flutter's DrawerThemeData with appropriate null-safe handling. The parsing API difference on line 21 is intentional: clipBehavior?.parse correctly accesses the getter from StacClipParser, while shape?.parse(context) and endShape?.parse(context) call methods that require context. Each parser appropriately adapts to its implementation needs.

packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data_parser.dart (1)

5-24: LGTM! Clean parser implementation.

The extension follows a consistent pattern for converting STAC theme data to Flutter's ScrollbarThemeData. The use of WidgetStatePropertyAll for state-independent properties and context-aware color resolution is appropriate.

packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data_parser.dart (1)

6-6: LGTM! Clean refactoring from Freezed to extension-based parser.

The changes correctly implement the extension-based parser pattern:

  • The import for stac_material_tap_target_size_parser is necessary for the .parse method on line 27
  • Documentation clearly describes the extension's purpose
  • The .parse method usage is consistent with other parsers in this file (e.g., visualDensity?.parse on line 28)

Also applies to: 10-12, 27-27

packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data_parser.dart (3)

1-10: LGTM! Clear structure and documentation.

The imports are well-organized, and the documentation clearly explains the extension's purpose. The separation of the parser extension from the data class (now in stac_core) aligns well with the PR's refactoring goals.


20-21: Verify the null-handling semantics with WidgetStateProperty.all().

When labelTextStyle or iconTheme is null, the current code creates WidgetStateProperty.all(null), which explicitly sets the property to null for all states. This differs from passing null directly to the constructor, which would mean "no override, use default."

Consider whether the intended behavior is:

  • Current: Always override with the parsed value (or null)
  • Alternative: Only override when a value is provided

If null should mean "no override," consider this pattern:

labelTextStyle: labelTextStyle != null 
    ? WidgetStateProperty.all(labelTextStyle.parse(context))
    : null,
iconTheme: iconTheme != null 
    ? WidgetStateProperty.all(iconTheme.parse(context))
    : null,

22-22: Verify the parse pattern for labelBehavior.

The labelBehavior?.parse pattern (without context parameter) differs from other fields that use parse(context). This suggests parse is a property or getter rather than a method, which may be correct if labelBehavior is an enum or doesn't require context.

Please verify this API is consistent with the labelBehavior type definition in stac_core.

packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data_parser.dart (2)

1-11: LGTM! Clean imports and documentation.

The imports are well-organized and the documentation clearly explains the extension's purpose. The separation of concerns is good—data classes in stac_core, parsers in the stac package.


12-23: LGTM! Parsing logic is correct and consistent.

The field mappings are appropriate, and the parsing approach is consistent:

  • Context-dependent parsers (decoration, text styles) correctly pass context
  • Simple conversions (size, insets) use the .parse getter
  • Colors consistently use the .toColor(context) utility
packages/stac/lib/src/parsers/theme/stac_chip_theme_data_parser.dart (3)

1-10: LGTM! Imports are clean and necessary.

All imports are properly utilized throughout the parser extension.


12-14: LGTM! Clear documentation.

The documentation concisely explains the extension's purpose and transformation.


18-18: Review null handling for WidgetStatePropertyAll.

When color is null, this creates WidgetStatePropertyAll(null) which explicitly sets the color to null rather than leaving it undefined. This may prevent Flutter from using its default chip color from the theme.

Consider using a conditional:

color: color != null ? WidgetStatePropertyAll(color.toColor(context)) : null,

This ensures that when the STAC theme doesn't specify a color, Flutter's default theming behavior is preserved.

packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data_parser.dart (2)

7-10: LGTM! Clear documentation and proper extension declaration.

The documentation clearly explains the extension's purpose, and the extension declaration follows proper Dart conventions.


11-22: <!-- [scratchpad_start]
[task verification_3/3]
Finalize findings and determine outcome.

[observations]

  • StacEdgeInsets.parse IS a GETTER (not a method) returning EdgeInsets
  • String?.toColor(context) extension exists and takes context (for color parsing)
  • StacTextStyle.parse(context) takes context (for theme-aware text style)
  • Verified StacSnackBarThemeDataParser uses identical mixed pattern:
    • .parse (getter) for EdgeInsets
    • .parse(context) (method) for TextStyle and borders
    • .toColor(context) for colors
  • All patterns are consistent, intentional, and correct

[analysis]
CRITICAL: Review comment is based on FALSE PREMISE

  • Claim: "breaking refactor removing the Freezed-generated StacMaterialBannerThemeData class"
  • Reality: Old class STILL EXISTS; this adds extension, not replacing it
  • NOT a breaking change—purely additive
  • Implementation is CORRECT and follows codebase conventions

[pending]
None - verification complete.

[done]

  1. Old Freezed class still exists (not removed/replaced)
  2. Parser adds extension method to existing class
  3. Parse patterns are correct and consistent with other parsers
  4. No migration issues exist
  5. Review comment premise is incorrect

[conclusion]
Use tag - review comment fundamentally mischaracterizes the change.
</scratchpad_end] -->

Review comment premise is incorrect—this is not a breaking refactor.

The old StacMaterialBannerThemeData Freezed class in packages/stac_core/lib/foundation/theme/stac_material_banner_theme_data/ still exists with its @JsonSerializable() and fromJson factory intact. This PR adds an extension method, not a replacement or removal. This is an additive change, not a breaking refactor.

The parse method implementation is correct and consistent with other theme parsers in the codebase. The mixed patterns are intentional: .parse (getter) for StacEdgeInsets handles numeric conversion only, .parse(context) for StacTextStyle provides theme context for text styling, and .toColor(context) for colors handles hex parsing and theme-aware color resolution.

Likely an incorrect or invalid review comment.

packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme_parser.dart (3)

1-11: LGTM! Clean imports and documentation.

The imports are well-organized and the documentation clearly describes the extension's purpose.


13-29: Field mapping is complete and correct.

Flutter's BottomSheetThemeData accepts 13 parameters: backgroundColor, surfaceTintColor, elevation, modalBackgroundColor, modalBarrierColor, shadowColor, modalElevation, shape, showDragHandle, dragHandleColor, dragHandleSize, clipBehavior, and constraints. The parser correctly maps all 13 fields from StacBottomSheetThemeData with appropriate type conversions.


22-27: The review comment is incorrect. The parsing patterns are intentional and correct.

  • shape?.parse(context): StacBorder uses StacShapeBorderParser, which is a method requiring BuildContext
  • dragHandleSize?.parse, clipBehavior?.parse, constraints?.parse: StacSize, StacClip, and StacBoxConstraints use getter-based parsers that don't require context

Each field type correctly matches its corresponding parser implementation. The inconsistency reflects intentional design differences in how different parsers are implemented.

Likely an incorrect or invalid review comment.

packages/stac/lib/src/parsers/theme/stac_material_color_parser.dart (2)

1-3: LGTM! Import structure aligns with refactoring.

The addition of stac_core import properly supports the migration to extension-based parsing.


5-8: LGTM! Clean extension pattern with clear documentation.

The extension-based API is idiomatic and well-documented.

packages/stac/lib/src/parsers/theme/stac_color_scheme_parser.dart (1)

10-60: LGTM! Comprehensive ColorScheme mapping.

The parser correctly handles all ColorScheme fields with appropriate null handling. The non-null assertions on required fields (primary, onPrimary, secondary, onSecondary, error, onError, surface, onSurface) align with Flutter's ColorScheme requirements.

packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data_parser.dart (1)

10-31: LGTM! Clean ListTileThemeData mapping.

The parser correctly handles all ListTileThemeData fields with appropriate nullable handling and delegates to the correct nested parsers.

packages/stac/lib/src/parsers/foundation/navigation/stac_navigation_destination_label_behavior_parser.dart (1)

9-18: LGTM! Clean enum mapping.

The exhaustive switch correctly maps all enum values between the STAC and Flutter types.

packages/stac/lib/src/parsers/foundation/theme/stac_button_bar_layout_behavior_parser.dart (1)

8-15: LGTM! Clean enum mapping.

The exhaustive switch correctly maps both enum values between the STAC and Flutter types.

packages/stac/lib/src/parsers/foundation/foundation.dart (1)

75-75: LGTM!

The new parser exports are properly organized and consistent with the existing export structure.

Also applies to: 95-96

packages/stac/lib/src/parsers/theme/stac_dialog_theme_parser.dart (1)

13-26: LGTM!

Clean and straightforward implementation with proper null-safety and appropriate use of parsing utilities. The field mappings are correctly applied.

packages/stac/lib/src/parsers/theme/stac_button_theme_data_parser.dart (1)

11-17: No changes needed—design pattern is intentional and appropriate.

The hardcoded defaults are not unnecessary duplication. The values match Flutter's ButtonThemeData defaults, but explicitly providing them here is deliberate: it makes defaults visible in the code, ensures stable behavior even if Flutter's defaults change, and clearly separates user-specified values from defaults. This is a sound defensive programming practice.

Likely an incorrect or invalid review comment.

- Updated various widget classes to ensure consistent formatting in JSON serialization.
- Simplified null checks and improved readability across multiple files, including StacButton, StacCard, StacColumn, and others.
- Enhanced maintainability by standardizing the structure of child widget handling and property parsing.
@divyanshub024 divyanshub024 merged commit ffa42d1 into dev Nov 7, 2025
6 checks passed
@divyanshub024 divyanshub024 deleted the dv/stac-themeing branch November 7, 2025 15:38
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