Skip to content

Conversation

divyanshub024
Copy link
Member

@divyanshub024 divyanshub024 commented Oct 2, 2025

Description

Move StacLinearProgressIndicator to stac_core for Dart to JSON support

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

  • New Features
    • Added LinearProgressIndicator widget support in the core library with JSON (de)serialization.
    • Exposed LinearProgressIndicator and additional widgets (GestureDetector, ListTile, ListView) via public exports.
  • Bug Fixes
    • Improved null-safety for progress indicator properties (value, colors, minHeight, borderRadius).
    • Alignment now correctly supports null values during (de)serialization instead of forcing a default.
  • Refactor
    • Migrated LinearProgressIndicator model to the core library and removed the previous data entity.
    • Updated exports to point to the parser variant and reduced duplicate exports.

Copy link

coderabbitai bot commented Oct 2, 2025

Walkthrough

Replaces the Freezed-based StacLinearProgressIndicator model in packages/stac with a json_serializable model in packages/stac_core. Updates the parser to use the new core model and nullable handling. Adjusts exports in both packages. Modifies StacAlign JSON (de)serialization to allow nullable alignment without a default.

Changes

Cohort / File(s) Summary
Remove Freezed-based linear progress model (stac)
packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart, .../stac_linear_progress_indicator.freezed.dart, .../stac_linear_progress_indicator.g.dart
Deleted the Freezed data class and generated files for StacLinearProgressIndicator, removing its prior JSON (de)serialization and copyWith utilities.
Parser adjustments
packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart
Updated property mappings to the new core model with null-aware access; removed stac_double usage; adjusted value/minHeight to use direct doubles; optional chaining for colors and borderRadius.
Introduce core linear progress model
packages/stac_core/lib/widgets/linear_progress_indicator/stac_linear_progress_indicator.dart, .../stac_linear_progress_indicator.g.dart
Added json_serializable StacLinearProgressIndicator model under stac_core with fields: value, backgroundColor, color, minHeight, semanticsLabel, semanticsValue, borderRadius; includes fromJson/toJson and type getter.
Export updates (widgets)
packages/stac/lib/src/parsers/widgets/widgets.dart, packages/stac_core/lib/widgets/widgets.dart
Switched stac export to parser variant; in stac_core, added exports for gesture_detector, linear_progress_indicator, list_tile, list_view and removed duplicates.
Align JSON behavior
packages/stac_core/lib/widgets/align/stac_align.g.dart
Removed defaulting to StacAlignmentDirectional.center; alignment now nullable in fromJson/toJson without non-null assertion.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant JSON as JSON
  participant Core as stac_core: StacLinearProgressIndicator
  participant Parser as stac (parser)
  participant Flutter as Flutter LinearProgressIndicator

  JSON->>Core: fromJson(...)
  Note right of Core: value, colors, minHeight, borderRadius parsed (nullable)
  Core->>Parser: Model instance
  Parser->>Flutter: Build LinearProgressIndicator<br/>value?, backgroundColor?, color?, minHeight?, semantics?, borderRadius?
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Potatomonsta

Poem

I nibbled the code, crisp and light,
Moved the model to core by night.
Parsers now sniff nulls with care,
Progress gleams with colors fair.
Hop, hop—exports tidy and fine;
JSON trails, a clean new line. 🐇✨

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 title succinctly describes the primary change of relocating the StacLinearProgressIndicator to the stac_core package and correctly labels it as a refactor. It is specific enough for reviewers to immediately grasp the intent without listing implementation details. The phrasing is clear, concise, and directly aligned with the changes in the diff. This makes the PR easy to identify in history and clarifies its purpose at a glance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dv/linear-progress-indicator

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6630f3b and 58f57b7.

📒 Files selected for processing (9)
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/widgets/widgets.dart (1 hunks)
  • packages/stac_core/lib/widgets/align/stac_align.g.dart (2 hunks)
  • packages/stac_core/lib/widgets/linear_progress_indicator/stac_linear_progress_indicator.dart (1 hunks)
  • packages/stac_core/lib/widgets/linear_progress_indicator/stac_linear_progress_indicator.g.dart (1 hunks)
  • packages/stac_core/lib/widgets/widgets.dart (2 hunks)
💤 Files with no reviewable changes (3)
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.g.dart
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.freezed.dart
  • packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: format
  • GitHub Check: analyze
🔇 Additional comments (7)
packages/stac_core/lib/widgets/align/stac_align.g.dart (2)

10-13: LGTM! Nullable alignment without default.

The change correctly allows alignment to be nullable without forcing a default value, consistent with json_serializable patterns for optional enum fields.


22-22: LGTM! Serialization handles nullable alignment.

Correctly serializes potentially null alignment without a non-null assertion, aligning with the nullable fromJson handling.

packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart (1)

20-26: LGTM! Parser correctly handles nullable fields.

The parser correctly adapts to the new json_serializable model:

  • value and minHeight are now direct double? values (no .parse needed)
  • backgroundColor, color, and borderRadius use optional chaining for nullable handling

The changes align with the migration from Freezed to json_serializable.

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

47-47: LGTM! Export updated to parser variant.

The export correctly points to the parser file, consistent with the model moving to stac_core while the parser remains in the stac package.

packages/stac_core/lib/widgets/linear_progress_indicator/stac_linear_progress_indicator.g.dart (1)

9-34: LGTM! Generated JSON serialization is correct.

The generated code properly handles:

  • DoubleConverter for value and minHeight fields
  • Nullable fields (backgroundColor, color, semanticsLabel, semanticsValue)
  • Nested StacBorderRadius with fromJson/toJson
  • type field in JSON output
packages/stac_core/lib/widgets/widgets.dart (1)

38-49: LGTM! Exports updated for new widget models.

The exports correctly include the new StacLinearProgressIndicator model (line 47) and reorganize other widget exports. This makes the model publicly available from the stac_core package.

packages/stac_core/lib/widgets/linear_progress_indicator/stac_linear_progress_indicator.dart (1)

38-92: LGTM! Well-structured widget model with JSON support.

The new StacLinearProgressIndicator model is correctly implemented:

  • Extends StacWidget as expected
  • @JsonSerializable annotation enables code generation
  • @DoubleConverter on numeric fields (value, minHeight)
  • All fields appropriately nullable for optional properties
  • Comprehensive documentation with Dart and JSON examples
  • Proper delegation to generated fromJson/toJson

The migration from Freezed to json_serializable is complete and correct.


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

@divyanshub024 divyanshub024 merged commit 8a05e04 into dev Oct 2, 2025
8 of 9 checks passed
@divyanshub024 divyanshub024 deleted the dv/linear-progress-indicator branch October 2, 2025 19:01
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.

1 participant