Repository navigation
feat: add CustomScrollView with sliver children - #20
Merged
Merged
Conversation
Render Ruby's CustomScrollView with SliverList, SliverGrid, SliverToBoxAdapter and SliverFillRemaining. Lists and grids take an optional section header that can stay pinned while its items scroll under it (PinnedHeaderSliver in a SliverMainAxisGroup), and any other control in slivers scrolls as one box. The view is design neutral and reuses ScrollableControl and ScrollNotificationControl with its own controller, so scroll, auto_scroll, on_scroll and the scroll_to invoke behave as on ListView. Sliver child types are built only by their parent (not registered in createWidget) and each rebuilds on its own Ruby patches.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the
CustomScrollViewcontrol and its sliver children (SPEC E1). One scroll view can now mix lists, grids, boxes, a filler and sticky section headers that all scroll together.Ruby counterpart: AdamMusa/ruflet#35
Rendering
CustomScrollViewis design-neutral (controls/custom_scroll_view.dart, widgets layer only). It owns aScrollControllerand wraps the view inScrollableControlandScrollNotificationControlthe same wayListViewdoes, soscroll,auto_scroll,scroll_interval,on_scrolland thescroll_toinvoke work unchanged. Material and Cupertino differ only through the platform scroll physics (iOS bounces). No Material widget is built on Cupertino.The sliver child types are built only by
CustomScrollView(D-3, like DataRow or Segment). They are not registered increateWidget(controls/sliver_children.dart):SliverListSliverList.builder/.separated/.list, orSliverFixedExtentList. It uses the same spacing, divider and on-demand rules asListView, plus an optionalSliverPadding.SliverGridSliverGrid.builderwith the same delegate and defaults asGridViewSliverToBoxAdapterSliverToBoxAdapter(content)SliverFillRemainingSliverFillRemaining(content). It becomes a box adapter when the view shrink-wraps, because an unbounded viewport has no remaining extent to fill.SliverToBoxAdapterheader): withsticky_header: true, the list or grid is wrapped inSliverMainAxisGroup([PinnedHeaderSliver(header), items]). The header stays pinned while its items scroll under it, then leaves with its group, like iOS Contacts or Mail. Withoutsticky_header, the header is a plainSliverToBoxAdapter. Both use widgets-layer classes only.bgcolor): wraps the section in aDecoratedSliver.sliver_list(for example, a new item) rebuilds only that sliver. Avisiblechange rebuilds the parent.Wire keys
CustomScrollView:slivers(falls back tocontrolsfor DSL block children),horizontal,reverse,anchor,cache_extent,clip_behavior,semantic_child_count,keyboard_dismiss_behavior(manual|onDrag, underscore-tolerant),scroll,auto_scroll,scroll_interval, the common layout keys, and the eventscroll.SliverList:controls spacing divider_thickness item_extent padding build_controls_on_demand header sticky_header bgcolorSliverGrid:controls runs_count max_extent spacing run_spacing child_aspect_ratio padding header sticky_header bgcolorSliverToBoxAdapter:contentSliverFillRemaining:content has_scroll_body fill_overscrollkey data visible.Invoke:
scroll_to(existingScrollableControlhandler).An unbounded-height horizontal view shows the same
ErrorControlasListView.Not in this PR
on_refresh/refresh_*/on_end_reachedare left for a follow-up once Package A'sfeat/pull-to-refreshandfeat/end-reachedmerge. Those PRs are not open yet; only A0 (feat/scroll-methods: ruflet feat: add FittedBox control #31, ruflet-engine fix: answer scroll_to on the Cupertino ReorderableListView #15) is. The view already uses ListView's controller plumbing (ScrollableControlwith the same controller), so the follow-up only swaps theCustomScrollViewforAdaptiveRefreshScrollViewand addsEndReachedListener.list_view.dartandgrid_view.dartand live insliver_children.dart. A1's plannedscroll_slivers.dartdoes not exist yet. Once it lands they can be merged.Tests
test/widgets/ruby_custom_scroll_view_test.dart: 10 cases × iOS + Android = 20 tests.bgcolor(DecoratedSliver) anditem_extentare honored.scroll_to(offset: -1)reachesmaxScrollExtent, andon_scrollfires.SliverList. Avisible: falsesliver disappears.controlswork as a fallback.ErrorControl.control_renderer_matrix_test.dartfixture forCustomScrollView: sticky-header list, grid, box, auto-wrapped Text and filler, on iOS, Android, macOS, Windows and Linux.team/verify_pr.sh(engine + Ruby worktrees): PASSflutter test(Flutter 3.41.2): +720, all passed (baseline 695 + 20 focused + 5 matrix)flutter analyze lib test: No issues foundcustom_scroll_view.dartandsliver_children.dart. They are not new findings.