Skip to content

Conversation

@akhil-ge0rge
Copy link
Contributor

@akhil-ge0rge akhil-ge0rge commented Jan 17, 2026

Description

This PR introduces support for stacSliverToBoxAdapter by adding a new widget model and its corresponding parser.

Related Issues

Closes #422

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 SliverToBoxAdapter support to enable embedding box widgets inside sliver-based layouts.
  • Documentation

    • Added a new docs page with properties, usage guidance, and an example.
  • Examples

    • Added a gallery entry and a runnable example demonstrating SliverToBoxAdapter usage.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

Adds first-class SliverToBoxAdapter support: new StacSliverToBoxAdapter model with JSON (de)serialization, a parser that renders Flutter SliverToBoxAdapter, parser registration in the framework, WidgetType enum value, exports, docs, and example gallery assets.

Changes

Cohort / File(s) Summary
Documentation
docs/docs.json, docs/widgets/sliver_to_box_adapter.mdx
New docs nav entry and page for SliverToBoxAdapter under Widgets → Layout Widgets; includes props and example JSON.
Example Assets
examples/stac_gallery/assets/json/home_screen.json, examples/stac_gallery/assets/json/sliver_to_box_adapter_example.json
Added gallery menu item and an example JSON demonstrating CustomScrollView → SliverPadding → SliverToBoxAdapter with a centered container.
Core Model
packages/stac_core/lib/widgets/sliver_to_box_adapter/stac_sliver_to_box_adapter.dart, packages/stac_core/lib/widgets/sliver_to_box_adapter/stac_sliver_to_box_adapter.g.dart
New JsonSerializable StacSliverToBoxAdapter model with optional child and generated (de)serializers.
Widget Type & Exports
packages/stac_core/lib/foundation/specifications/widget_type.dart, packages/stac_core/lib/widgets/widgets.dart
Added sliverToBoxAdapter enum value and exported the new model from the widgets barrel.
Parser Implementation & Exports
packages/stac/lib/src/parsers/widgets/stac_sliver_to_box_adapter/stac_sliver_to_box_adapter_parser.dart, packages/stac/lib/src/parsers/widgets/widgets.dart
New StacSliverToBoxAdapterParser mapping JSON → model → SliverToBoxAdapter widget; exported from parsers barrel.
Framework Registration
packages/stac/lib/src/framework/stac_service.dart
Registered StacSliverToBoxAdapterParser in the service's parsers list.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Example as Example JSON / Gallery
participant Service as StacService
participant Parser as StacSliverToBoxAdapterParser
participant Model as StacSliverToBoxAdapter
participant Flutter as SliverToBoxAdapter Widget

Example->>Service: request parse(example JSON)
Service->>Parser: delegate JSON for type "sliverToBoxAdapter"
Parser->>Model: StacSliverToBoxAdapter.fromJson(...)
Parser->>Flutter: build SliverToBoxAdapter(child: child.parse(context))
Flutter-->>Example: rendered sliver in CustomScrollView

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • divyanshub024
  • Potatomonsta

Poem

🐰 A sliver cradles a tiny box so snug,
JSON whispers softly, the parser gives a hug,
Model hops in, docs and examples in tow,
From text to widget — see the sliver glow! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding the stacSliverToBoxAdapter widget with its parser, example, and documentation.
Linked Issues check ✅ Passed The PR successfully implements the core requirement from issue #422: creating StacSliverToBoxAdapter with necessary supporting components (parser, type registration, model class).
Out of Scope Changes check ✅ Passed All changes directly support the implementation of stacSliverToBoxAdapter: widget model, parser, type enum, documentation, and example assets are all in-scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

🤖 Fix all issues with AI agents
In `@docs/widgets/sliver_to_box_adapter.mdx`:
- Around line 6-8: Update the prose describing the widget to hyphenate the
compound adjective: replace occurrences of "sliver to box adapter" with
"sliver-to-box-adapter" in the sentence that mentions "The Stac
SliverToBoxAdapter allows you to build a Flutter sliver to box adapter widget
using JSON." Ensure the phrase "sliver-to-box-adapter widget" appears
consistently (e.g., in the line referencing the official documentation) and keep
the class name "SliverToBoxAdapter" unchanged.

In `@packages/stac_core/lib/foundation/specifications/widget_type.dart`:
- Around line 210-211: The doc comment for the enum value sliverToBoxAdapter is
incorrect (it says "Sliver app bar widget"); update the comment above the
sliverToBoxAdapter enum member in widget_type.dart to accurately describe that
it represents a SliverToBoxAdapter widget (e.g., "SliverToBoxAdapter widget" or
similar). Ensure the updated comment is concise and matches the naming/style of
other enum docs in the same file.

@akhil-ge0rge
Copy link
Contributor Author

Hi @divyanshub024 , @Potatomonsta 👋,
Please take a look. Thanks!

@divyanshub024
Copy link
Member

@akhil-ge0rge PR checks are failing. Please check.

@divyanshub024
Copy link
Member

@akhil-ge0rge I'm unable to run the example app, please check it out.
Logs:

 RenderSliverPadding expected a child of type RenderSliver but received a child of type RenderErrorBox.
The relevant error-causing widget was:
    CustomScrollView CustomScrollView:file:///Users/divy/StudioProjects/stac/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart:23:12
════════════════════════════════════════════════════════════════════════════════
Restarted application in 1,598ms.
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0   LogIO.e (package:stac_logger/src/log_io.dart:25:35)
log_io.dart:25
flutter: │ #1   Log.e (package:stac_logger/src/log.dart:38:45)
log.dart:38
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ ⛔ [Stac Asset Load Error] Type: "asset" - Unable to load asset: "assets/json/sliver_to_box_adapter_example.json".
flutter: │ ⛔ The asset does not exist or has empty data.
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0   LogIO.e (package:stac_logger/src/log_io.dart:25:35)
log_io.dart:25
flutter: │ #1   Log.e (package:stac_logger/src/log.dart:38:45)
log.dart:38
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ ⛔ Stack trace:
flutter: │ ⛔ #0      PlatformAssetBundle.load.<anonymous closure> (package:flutter/src/services/asset_bundle.dart:332:13)
asset_bundle.dart:332
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ #1      AssetBundle.loadString (package:flutter/src/services/asset_bundle.dart:92:27)
asset_bundle.dart:92
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ #2      _FutureBuilderState._subscribe.<anonymous closure> (package:flutter/src/widgets/async.dart:641:7)
async.dart:641
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ 
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@akhil-ge0rge
Copy link
Contributor Author

@akhil-ge0rge I'm unable to run the example app, please check it out. Logs:

 RenderSliverPadding expected a child of type RenderSliver but received a child of type RenderErrorBox.
The relevant error-causing widget was:
    CustomScrollView CustomScrollView:file:///Users/divy/StudioProjects/stac/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart:23:12
════════════════════════════════════════════════════════════════════════════════
Restarted application in 1,598ms.
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0   LogIO.e (package:stac_logger/src/log_io.dart:25:35)
log_io.dart:25
flutter: │ #1   Log.e (package:stac_logger/src/log.dart:38:45)
log.dart:38
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ ⛔ [Stac Asset Load Error] Type: "asset" - Unable to load asset: "assets/json/sliver_to_box_adapter_example.json".
flutter: │ ⛔ The asset does not exist or has empty data.
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ #0   LogIO.e (package:stac_logger/src/log_io.dart:25:35)
log_io.dart:25
flutter: │ #1   Log.e (package:stac_logger/src/log.dart:38:45)
log.dart:38
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ ⛔ Stack trace:
flutter: │ ⛔ #0      PlatformAssetBundle.load.<anonymous closure> (package:flutter/src/services/asset_bundle.dart:332:13)
asset_bundle.dart:332
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ #1      AssetBundle.loadString (package:flutter/src/services/asset_bundle.dart:92:27)
asset_bundle.dart:92
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ #2      _FutureBuilderState._subscribe.<anonymous closure> (package:flutter/src/widgets/async.dart:641:7)
async.dart:641
flutter: │ ⛔ <asynchronous suspension>
flutter: │ ⛔ 
flutter: └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

The example app is currently failing because the supporting widget for StacSliverBoxAdapter, specifically StacSliverPadding, is part of another PR.

Since that PR hasn’t been merged yet, the example doesn’t run as expected.

Would it be okay if I remove the example from this PR and submit it in a separate PR after both PRs are merged?

Copy link
Member

@divyanshub024 divyanshub024 left a comment

Choose a reason for hiding this comment

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

Thanks for this awesome PR @akhil-ge0rge. 🎉 Please check my suggestions below

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.

feat: create StacWidget implementation of SliverToBoxAdapter

2 participants