Skip to content

feat: add stacSliverPadding widget, parser,example and documentation#421

Merged
divyanshub024 merged 9 commits intoStacDev:devfrom
akhil-ge0rge:feat-sliver-padding
Jan 27, 2026
Merged

feat: add stacSliverPadding widget, parser,example and documentation#421
divyanshub024 merged 9 commits intoStacDev:devfrom
akhil-ge0rge:feat-sliver-padding

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 a 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 StacSliverPadding end-to-end: new core model and JSON (de)serializers, WidgetType enum entry, parser and registration/export, documentation and gallery example plus home-screen entry enabling JSON-driven SliverPadding usage.

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; 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
Adds StacSliverPadding model with padding (StacEdgeInsets) and sliver (StacWidget), generated JSON (de)serializers, and export from widgets barrel.
Widget Type
packages/stac_core/lib/foundation/specifications/widget_type.dart
Inserted 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
Added StacSliverPaddingParser, exported it, and registered it in StacService parser list so JSON 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 labels

feature

Suggested reviewers

  • divyanshub024
  • Potatomonsta

Poem

🐰
I hopped through JSON neat and bright,
Wrapped a sliver snug with padding light,
Parsers stitch, docs gleam, examples play,
A green box lounges, snug all day,
🥕 — Hoppy deploy!

🚥 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 PR title clearly and specifically describes the main changes: adding a new stacSliverPadding widget with its parser, example, and documentation.
Linked Issues check ✅ Passed The PR fully implements the requirement from #417 by creating StacSliverPadding model, parser, and providing documentation and examples.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the StacSliverPadding widget support; no out-of-scope modifications 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!

@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.

@divyanshub024
Copy link
Member

@akhil-ge0rge, can you please resolve the conflicts?

@akhil-ge0rge
Copy link
Contributor Author

@akhil-ge0rge, can you please resolve the conflicts?

@divyanshub024 Done

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.

Great work @akhil-ge0rge 💯 🚀

@divyanshub024 divyanshub024 merged commit abc84aa into StacDev:dev Jan 27, 2026
7 of 8 checks passed
@akhil-ge0rge akhil-ge0rge deleted the feat-sliver-padding branch January 28, 2026 04:36
@coderabbitai coderabbitai bot mentioned this pull request Feb 12, 2026
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