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 widget support for applying padding inside scrollable layouts (CustomScrollView).
  • Documentation

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

    • Added a gallery entry and an example showcasing a padded sliver containing 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 model, JSON (de)serialization, parser, parser registration and export, WidgetType enum entry, documentation page, and an example + gallery navigation entry for SliverPadding.

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
Add docs entry and MDX page for SliverPadding; add gallery home list item and a 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 StacWidget model with padding and sliver fields, generated JSON (de)serializers, and export from widgets barrel.
Widget Type & Enum
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 to enable runtime JSON → SliverPadding widget parsing.

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
    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 soft padding light,
Parsers hum, docs sparkle, examples play,
A little box lounges in green all day,
Nibble nibble — code hops on its way! 🥕

🚥 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 summarizes the main changes: adding a stacSliverPadding widget, parser, example, and documentation.
Linked Issues check ✅ Passed The PR fully implements the requirement from issue #417 to create StacSliverPadding as the StacWidget equivalent of Flutter's SliverPadding.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing StacSliverPadding support: the widget model, parser, example, documentation, and necessary registrations. No unrelated changes detected.
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!

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

1 participant