Skip to content

Conversation

@akhil-ge0rge
Copy link
Contributor

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

Description

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

Related Issues

Closes #417

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 SliverPadding support for padded slivers in scrollable layouts.
  • Documentation

    • Added a docs page describing SliverPadding, its properties, and usage example.
  • Examples

    • Added a gallery entry and an interactive example demonstrating a padded sliver with a styled box.

✏️ 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 a new StacSliverPadding widget: model, JSON (de)serialization, parser, parser registration and export, WidgetType enum entry, documentation page, gallery example JSON, and a home-screen gallery entry for the SliverPadding example.

Changes

Cohort / File(s) Summary
Documentation & Examples
docs/docs.json, docs/widgets/sliver_padding.mdx, examples/stac_gallery/assets/json/home_screen.json, examples/stac_gallery/assets/json/sliver_padding_example.json
New docs entry and MDX page for SliverPadding; gallery home list item added; new example JSON demonstrating a SliverPadding wrapping a SliverToBoxAdapter.
Core Model & Serialization
packages/stac_core/lib/widgets/sliver_padding/stac_sliver_padding.dart, packages/stac_core/lib/widgets/sliver_padding/stac_sliver_padding.g.dart, packages/stac_core/lib/widgets/widgets.dart
Add StacSliverPadding model with padding and sliver fields, generated JSON (de)serializers, and export from widgets barrel.
Widget Type
packages/stac_core/lib/foundation/specifications/widget_type.dart
Insert new enum value sliverPadding into WidgetType.
Parser & Service Registration
packages/stac/lib/src/parsers/widgets/stac_sliver_padding/stac_sliver_padding_parser.dart, packages/stac/lib/src/parsers/widgets/widgets.dart, packages/stac/lib/src/framework/stac_service.dart
Add StacSliverPaddingParser, export it, and register it in StacService parser list so JSON type sliverPadding maps to a SliverPadding widget at runtime.

Sequence Diagram(s)

sequenceDiagram
    participant JSON as JSON asset
    participant Service as StacService
    participant Parser as StacSliverPaddingParser
    participant Model as StacSliverPadding
    participant Flutter as Flutter SliverPadding

    JSON->>Service: load JSON
    Service->>Parser: dispatch by type "sliverPadding"
    Parser->>Model: getModel(json)
    Parser->>Parser: construct StacSliverPadding (padding, sliver)
    Parser->>Flutter: parse(context, model) -> SliverPadding widget
    Flutter->>Flutter: render inside CustomScrollView
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • divyanshub024
  • Potatomonsta

Poem

🐰
I hopped through JSON, tidy and bright,
Wrapped a sliver snug in padding light,
Parsers hum, docs sparkle, examples play,
A green box lounges, content all day,
🥕 — Happy hops and clean array!

🚥 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 'feat: add stacSliverPadding widget, parser, example and documentation' accurately summarizes the main changes across all files.
Linked Issues check ✅ Passed The PR successfully implements StacSliverPadding model and parser as required by #417, with complete documentation and examples added.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the StacSliverPadding widget, its parser, documentation, and examples as specified in the linked issue.
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 `@examples/stac_gallery/assets/json/home_screen.json`:
- Around line 1250-1253: Update the "subtitle" value in the JSON entry for the
SliverPadding tile (the "subtitle" property) to remove the incorrect "Material
Design" qualifier; replace "A Material Design Sliver Padding widget" with a
concise, accurate phrase such as "A Flutter SliverPadding widget" or "A
SliverPadding widget" so it correctly reflects that SliverPadding is from
Flutter's widgets library.

In `@packages/stac_core/lib/widgets/sliver_padding/stac_sliver_padding.dart`:
- Around line 22-48: The JSON example in the documentation block of
stac_sliver_padding.dart uses // single-line comments so it won't be picked up
by doc generation; update the JSON lines inside the fenced comment (the block
between ```json and ```) to use Dart doc comment markers (///) instead of // so
the example is included in generated docs — i.e., replace each leading // with
/// for the JSON object lines in the sliverPadding example.
🧹 Nitpick comments (1)
packages/stac/lib/src/parsers/widgets/stac_sliver_padding/stac_sliver_padding_parser.dart (1)

4-4: Unused import.

The stac_edge_insets_parser.dart import appears unused. The model.padding.parse getter is provided by StacEdgeInsets (from stac_core), not by the parser.

🔧 Suggested fix
 import 'package:flutter/material.dart';
 import 'package:stac/src/parsers/core/stac_widget_parser.dart';
-
-import 'package:stac/src/parsers/foundation/geometry/stac_edge_insets_parser.dart';
 import 'package:stac_core/stac_core.dart';
 import 'package:stac_framework/stac_framework.dart';

@akhil-ge0rge akhil-ge0rge changed the title Feat sliver padding feat: add stacSliverPadding widget, parser,example and documentation Jan 17, 2026
@akhil-ge0rge
Copy link
Contributor Author

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

@divyanshub024
Copy link
Member

@akhil-ge0rge Your PR example is failing. Can you please check?

@akhil-ge0rge
Copy link
Contributor Author

@akhil-ge0rge Your PR example is failing. Can you please check?

Hi @divyanshub024 , all checks are passing on my side.
Could you please let me know if there are any other issues you’re seeing?

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

🤖 Fix all issues with AI agents
In `@packages/stac_core/lib/widgets/sliver_padding/stac_sliver_padding.dart`:
- Around line 51-72: The StacSliverPadding class lacks explicit nested JSON
serialization; update the class annotation to `@JsonSerializable`(explicitToJson:
true) on the StacSliverPadding declaration so its nested fields (padding:
StacEdgeInsets and sliver: StacWidget) are serialized consistently with other
widgets (e.g., StacCustomScrollView, StacGestureDetector); ensure the generator
is re-run so _$StacSliverPaddingFromJson and _$StacSliverPaddingToJson handle
nested toJson calls.

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 SliverPadding

2 participants