-
-
Notifications
You must be signed in to change notification settings - Fork 77
chore: Release Stac 1.0.0-dev.7 #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nParser to use model's alignment parsing method
WalkthroughThis 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
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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Comment |
… 1.0.0-dev.7, stac_core to 0.2.0, stac_framework to 0.4.0 across examples
There was a problem hiding this 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 preventsstops
/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
⛔ 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 providesparse
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 foralignment: ... .value
and found no matches, but the search results were inconclusive — manually verify other parsers for any remaining.value
usages.
return linearGradient(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
version: 1.0.0-dev.7 | ||
repository: https://github.com/StacDev/stac | ||
homepage: https://stac.dev/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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.
Description
chore: Release Stac 1.0.0-dev.7
Type of Change
Summary by CodeRabbit
New Features
Breaking Changes
Bug Fixes
Documentation
Chores