Mohamed Gaber
Mohamed Gaber

Reputation: 1745

Use PageView inside a CustomScrollView

I have a CustomScrollView Contain a :-

1- SliverToBoxAdapter which have tree of widgets

2- SliverList

The problem is happened when i Wrap SliverList with PageView its normal because CustomScrollView only accept Slivers

code snippet

        CustomScrollView(
          slivers: <Widget>[
            SliverToBoxAdapter(child : ),
        PageView(children: <Widget>[SliverList()])]


run result

A RenderViewport expected a child of type RenderSliver but received a child of type RenderRepaintBoundary. RenderObjects expect specific types of children because they coordinate with their children during layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a RenderSliver does not understand the RenderBox layout protocol.

Upvotes: 8

Views: 4317

Answers (1)

Mohamed Gaber
Mohamed Gaber

Reputation: 1745

I resolved this issue by using NestedScrollView :-

header property have SliverToBoxAdapter it accepts Slivers

body property have PageView it doesn't accept Slivers

Upvotes: 20

Related Questions