Skip to content

Conversation

divyanshub024
Copy link
Member

@divyanshub024 divyanshub024 commented Sep 22, 2025

Description

chore: Release Stac 1.0.0-dev.7

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 Dart-to-JSON conversion via the Stac DSL.
    • Improved border and styling capabilities.
    • Gradient parsing now falls back to a linear gradient when type is unknown.
  • Breaking Changes

    • TextSpan now uses text instead of data.
    • Removed several legacy style and alignment-related APIs.
  • Bug Fixes

    • Minor fixes improving stability.
  • Documentation

    • Updated changelog for 1.0.0-dev.7.
  • Chores

    • Version bump to 1.0.0-dev.7, updated dependencies, and refreshed package metadata (homepage, repository).

@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

Walkthrough

This PR removes several local model/data classes (TextStyle, Gradient, EdgeInsets, Rect, BottomNavigationBar and item), updates parser logic for alignment and gradient defaults, prunes related exports, and updates package metadata and dependencies (including adding stac_core). It also revises CHANGELOG for 1.0.0-dev.7.

Changes

Cohort / File(s) Summary
Release & metadata
packages/stac/CHANGELOG.md, packages/stac/pubspec.yaml
Added 1.0.0-dev.7 section; version bump; repository/homepage updates; deps updated: stac_framework ^0.4.0, stac_logger ^1.1.0; new dependency stac_core ^0.2.0.
Alignment parsing refactor
packages/stac/lib/src/parsers/widgets/stac_align/stac_align.dart, packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart, packages/stac/lib/src/parsers/widgets/stac_alignment/stac_alignment.dart, packages/stac/lib/src/parsers/widgets/stac_alignment_directional/stac_alignment_directional.dart
Switched imports to stac_core; parser now uses model.alignment.parse; removed StacAlignment and StacAlignmentDirectional enums and their value getters.
Gradient model removal + parser fallback
packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart, packages/stac/lib/src/parsers/widgets/stac_gradient/stac_gradient.dart
Removed local StacGradient model/types; parser default branch now returns linearGradient() instead of null.
BottomNavigationBar models removed
packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.freezed.dart, packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.g.dart, packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.freezed.dart, packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart
Deleted Freezed-generated classes and JSON (de)serialization for StacBottomNavigationBar and StacBottomNavigationBarItem.
EdgeInsets model removed
packages/stac/lib/src/parsers/widgets/stac_edge_insets/stac_edge_insets.dart
Deleted StacEdgeInsets class and its custom/fromJson logic.
TextStyle model and parser removed
packages/stac/lib/src/parsers/widgets/stac_text_style/stac_text_style.dart
Removed StacTextStyle Freezed model, fromJson, and parse(BuildContext) extension.
Rect model removed
packages/stac/lib/src/parsers/widgets/stac_rect/stac_rect.dart
Deleted stac_rect.dart and its public API.
Exports cleanup
packages/stac/lib/src/parsers/widgets/widgets.dart
Removed exports for alignment, alignment_directional, edge_insets, gradient, and text_style modules.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant JSON as JSON Model
  participant AlignParser as StacAlignParser
  participant Core as stac_core Alignment
  participant Flutter as Flutter Widget

  JSON->>AlignParser: parse(model)
  AlignParser->>Core: model.alignment.parse
  Core-->>AlignParser: Alignment/AlignmentDirectional
  AlignParser->>Flutter: new Align(alignment: value, child: ...)
  note over AlignParser,Core: Alignment resolution now via parse() instead of .value
Loading
sequenceDiagram
  autonumber
  participant JSON as JSON Model
  participant GradParser as StacGradientParser
  participant Flutter as Paint/Shader

  JSON->>GradParser: parse(type, params)
  alt recognized type
    GradParser->>Flutter: build requested gradient
  else unrecognized type (changed)
    GradParser->>Flutter: build linearGradient() fallback
    note over GradParser: Default no longer returns null
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • BugFixes for Stac DSL #350 — Removes local StacTextStyle/Gradient and shifts to stac_core; mirrors this PR’s deletions and dependency addition.

Poem

I nibble through lines with a coder’s delight,
Pruning old leaves, letting new cores ignite.
Alignments now parse, gradients won’t fall,
Exports trimmed tidy—so sleek, so small.
With version hops and carrots in sight,
This bunny ships dev.7 tonight! 🥕✨

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 "chore: Release Stac 1.0.0-dev.7" is a concise, single-sentence summary that clearly communicates the primary intent (a release/version bump). It directly matches the changeset which includes the pubspec version bump, changelog updates, and dependency/version adjustments. The title is specific, free of noise, and sufficient for a reviewer scanning PR history.
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/stac-refactor

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

… 1.0.0-dev.7, stac_core to 0.2.0, stac_framework to 0.4.0 across examples
@divyanshub024 divyanshub024 merged commit b38daa2 into dev Sep 22, 2025
4 of 5 checks passed
@divyanshub024 divyanshub024 deleted the dv/stac-refactor branch September 22, 2025 16:41
Copy link

@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: 2

🧹 Nitpick comments (3)
packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart (2)

12-18: Parse colors once, drop the bang operator, and normalize stops to avoid assertions.

Eliminates three duplicate maps, avoids ! NPE risk, and prevents stops/colors length mismatch from asserting.

   Gradient? parse(BuildContext context) {
-    Gradient linearGradient() => LinearGradient(
-          colors: colors?.map((e) => e.toColor(context)!).toList() ?? [],
+    // Parse and sanitize once
+    final parsedColors = (colors?.map((e) => e.toColor(context)).whereType<Color>().toList()
+        ?? const <Color>[]);
+    final List<double>? normalizedStops =
+        (stops != null && parsedColors.length == stops!.length) ? stops : null;
+    if (parsedColors.length < 2) return null;
+
+    Gradient linearGradient() => LinearGradient(
+          colors: parsedColors,
           begin: begin?.parse ?? Alignment.centerLeft,
           end: end?.parse ?? Alignment.centerRight,
-          stops: stops,
+          stops: normalizedStops,
           tileMode: tileMode?.parse ?? TileMode.clamp,
         );
 
-    Gradient radialGradient() => RadialGradient(
-          colors: colors?.map((e) => e.toColor(context)!).toList() ?? [],
-          stops: stops,
+    Gradient radialGradient() => RadialGradient(
+          colors: parsedColors,
+          stops: normalizedStops,
           tileMode: tileMode?.parse ?? TileMode.clamp,
           focal: focal?.parse,
           focalRadius: focalRadius ?? 0.0,
           radius: radius ?? 0.5,
           center: center?.parse ?? Alignment.center,
         );
 
-    Gradient sweepGradient() => SweepGradient(
-          colors: colors?.map((e) => e.toColor(context)!).toList() ?? [],
-          stops: stops,
+    Gradient sweepGradient() => SweepGradient(
+          colors: parsedColors,
+          stops: normalizedStops,
           center: center?.parse ?? Alignment.center,
           startAngle: startAngle ?? 0.0,
           endAngle: endAngle ?? math.pi * 2,
           tileMode: tileMode?.parse ?? TileMode.clamp,
         );

Also applies to: 20-28, 30-37


39-48: Optional: log unknown gradient types to aid debugging.

A one-liner debug print keeps the silent fallback observable during integration tests.

       default:
+        debugPrint('StacGradient.parse: Unknown gradientType=$gradientType; using linear fallback.');
         // Only fallback to linear when we have a valid gradient payload.
         if ((colors?.length ?? 0) >= 2) {
           return linearGradient();
         }
         return null;
packages/stac/CHANGELOG.md (1)

3-6: Fix typo and standardize BREAKING prefix.

  • "pram" → "param"
  • Use "BREAKING:" (uppercase) for consistency with prior sections.

Apply:

- - feat: Added support for Dart-to-Json conversion via Stac DSL
-- - breaking: TextSpan now takes `text` as a pram instead of `data`
+ - feat: Added support for Dart-to-JSON conversion via Stac DSL
+ - BREAKING: TextSpan now takes `text` as a param instead of `data`
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfe87e7 and 4a0df1b.

⛔ Files ignored due to path filters (3)
  • examples/counter_example/pubspec.lock is excluded by !**/*.lock
  • examples/movie_app/pubspec.lock is excluded by !**/*.lock
  • examples/stac_gallery/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • packages/stac/CHANGELOG.md (2 hunks)
  • packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart (1 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_align/stac_align.dart (1 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart (2 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_alignment/stac_alignment.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_alignment_directional/stac_alignment_directional.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_edge_insets/stac_edge_insets.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_gradient/stac_gradient.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.freezed.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_rect/stac_rect.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/stac_text_style/stac_text_style.dart (0 hunks)
  • packages/stac/lib/src/parsers/widgets/widgets.dart (0 hunks)
  • packages/stac/pubspec.yaml (2 hunks)
💤 Files with no reviewable changes (11)
  • packages/stac/lib/src/parsers/widgets/stac_alignment/stac_alignment.dart
  • packages/stac/lib/src/parsers/widgets/stac_text_style/stac_text_style.dart
  • packages/stac/lib/src/parsers/widgets/stac_rect/stac_rect.dart
  • packages/stac/lib/src/parsers/widgets/widgets.dart
  • packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart
  • packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.g.dart
  • packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar.freezed.dart
  • packages/stac/lib/src/parsers/widgets/stac_alignment_directional/stac_alignment_directional.dart
  • packages/stac/lib/src/parsers/widgets/stac_edge_insets/stac_edge_insets.dart
  • packages/stac/lib/src/parsers/widgets/stac_gradient/stac_gradient.dart
  • packages/stac/lib/src/parsers/widgets/stac_navigation_bar_item/stac_bottom_navigation_bar_item.freezed.dart
🔇 Additional comments (3)
packages/stac/lib/src/parsers/widgets/stac_align/stac_align.dart (1)

3-3: Import switch to stac_core: verify JSON (de)serialization for StacAlignmentDirectional.

Looks right, assuming stac_core exports StacAlignmentDirectional with JsonSerializable/Converter support. Please confirm fromJson/toJson remain intact to avoid runtime decode issues when alignment is present/missing/null.

Run to check for lingering old imports/usages and confirm converter presence:

packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart (2)

3-3: New foundation import: confirmed it provides parse for alignment.

Extension StacAlignmentDirectionalParser in packages/stac/lib/src/parsers/foundation/alignment/stac_alignment_directional_parser.dart defines AlignmentDirectional get parse and is exported by packages/stac/lib/src/parsers/foundation/foundation.dart; no other parse extension on StacAlignmentDirectional was found in the repo.


21-21: Switched from .value to .parse: migration check.

stac_align_parser.dart now uses model.alignment.parse. I ran a repo search for alignment: ... .value and found no matches, but the search results were inconclusive — manually verify other parsers for any remaining .value usages.

Comment on lines +47 to 48
return linearGradient();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fallback to LinearGradient on unknown type can assert/crash when colors < 2 (and with mismatched stops).

Previously unknown types yielded null; now we may construct a LinearGradient with 0–1 colors or invalid stops, which hits Flutter assertions and can fail at runtime. Guard or return null.

Apply this minimal, safer fallback:

       default:
-        return linearGradient();
+        // Only fallback to linear when we have a valid gradient payload.
+        if ((colors?.length ?? 0) >= 2) {
+          return linearGradient();
+        }
+        return null;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return linearGradient();
}
// Only fallback to linear when we have a valid gradient payload.
if ((colors?.length ?? 0) >= 2) {
return linearGradient();
}
return null;
}
🤖 Prompt for AI Agents
In packages/stac/lib/src/parsers/foundation/effects/stac_gradient_parser.dart
around lines 47-48, the fallback that unconditionally returns a LinearGradient
can trigger Flutter assertions when colors has fewer than 2 entries or when
stops length mismatches colors; instead validate before constructing: if colors
is null or colors.length < 2, return null; if stops is non-null and stops.length
!= colors.length, return null (or drop stops by setting to null) and only then
build and return the LinearGradient. Ensure the function preserves the previous
null behavior for invalid/unknown gradient types.

Comment on lines +3 to 6
version: 1.0.0-dev.7
repository: https://github.com/StacDev/stac
homepage: https://stac.dev/

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Version bump and metadata LGTM; verify dependency compatibility with Flutter/Dart constraints.

Confirm that:

  • stac_core ^0.2.0 and stac_framework ^0.4.0 are published and compatible with Flutter >=3.35.0 and your Dart SDK range (currently >=3.0.0 <4.0.0).
  • freezed/json_serializable versions are supported on the targeted Dart shipped with Flutter 3.35.x.

🌐 Web query:

What is the latest published version of stac_core on pub.dev and its supported Dart/Flutter constraints?

💡 Result:

I couldn't find a package named "stac_core" on pub.dev. Did you mean the "stac" or "stac_framework" packages? For reference:

  • stac — latest stable: 0.11.0; min Dart SDK: 3.0. [1]
  • stac_framework — latest stable: 0.3.0; min Dart SDK: 3.1 (Flutter platform package). [2]

Sources:
[1] https://pub.dev/packages/stac/versions (stac 0.11.0 details).
[2] https://pub.dev/packages/stac_framework/versions (stac_framework 0.3.0 details).


🌐 Web query:

What is the latest published version of stac_framework on pub.dev and its supported Dart/Flutter constraints?

💡 Result:

Latest published version: stac_framework 0.4.0 (published ~1 hour ago). It lists a minimum Dart SDK of 3.1 (i.e. Dart 3.1+) and declares Flutter as a dependency. [1][2]

Sources:
[1] pub.dev package versions list for stac_framework.
[2] pub.dev page for stac_framework 0.4.0.


🌐 Web query:

Which Dart SDK version ships with Flutter 3.35.0 stable?

💡 Result:

Flutter 3.35.0 ships with the Dart SDK 3.9.0. [1][2]

Sources:

  • Flutter 3.35.0 release notes (references rolling to Dart 3.9). [1]
  • Dart "What's new" / Dart 3.9 release page (Dart 3.9 released Aug 13, 2025). [2]

🌐 Web query:

Do freezed 3.0.6 and json_serializable 6.9.5 support Dart >=3.5 (the Dart typically paired with Flutter 3.35)?

💡 Result:

Short answer: Yes — but with specifics.

  • Freezed 3.0.6: Freezed moved its Dart minimum up in the 3.x series (3.0.4 notes “Support Dart 3.6.0 … as a minimum”), so 3.0.6 is compatible with Dart >=3.6 (and therefore >=3.5). [1]

  • json_serializable 6.9.5: json_serializable 6.9.0 required Dart 3.5, but starting at 6.9.1 the package bumped the minimum to Dart 3.6. So 6.9.5 follows that line and requires Dart >=3.6 (thus it is not restricted to exactly 3.5). [2][3]

Sources:

  • Freezed changelog (3.0.4 / 3.0.6 entries). [1]
  • json_serializable changelog (6.9.0 → require Dart 3.5; 6.9.1 → require Dart 3.6). [2]
  • json_serializable package metadata page. [3]

References:
[1] pub.dev/packages/freezed/changelog.
[2] pub.dev/packages/json_serializable/changelog.
[3] pub.dev/packages/json_serializable (package/versions metadata).


Fix missing dependency: stac_core not published — update packages/stac/pubspec.yaml

  • stac_core is not on pub.dev; either publish it, change the dependency to the correct published package (e.g. stac or stac_framework), or make it a path/git dependency in packages/stac/pubspec.yaml (dependencies section).
  • stac_framework ^0.4.0 is published and requires Dart >=3.1 — Flutter 3.35.0 ships Dart 3.9, so it's compatible.
  • freezed 3.0.6 and json_serializable 6.9.5 require Dart >=3.6 — compatible with Dart 3.9; ensure CI/devs use Flutter >=3.35 (or Dart >=3.6).
🤖 Prompt for AI Agents
In packages/stac/pubspec.yaml around lines 3 to 6, the pubspec references a
non-published dependency (stac_core) which will break pub get/CI; update the
dependencies section to either replace stac_core with the correct published
package (for example stac_framework ^0.4.0) or point stac_core to a local path
or git dependency (path: ../stac_core or git: url/commit), and ensure SDK
constraints remain compatible with packages (e.g. Dart >=3.6/3.1 as needed) so
CI and devs use Flutter/Dart versions that satisfy freezed and
json_serializable.

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