Kalash Saini
Kalash Saini

Reputation: 45

What is the correct way to add a Sliver Widget to a Non Sliver Widget in Flutter?

Basically I want to resolve this error.

RenderPadding expected a child of type RenderBox but received a child of type RenderSliverList.

Upvotes: 0

Views: 246

Answers (1)

Amirali Eric Janani
Amirali Eric Janani

Reputation: 1750

You can not add Sliver widgets to a Non Sliver Widget unless to put your Non Sliver widget in a SliverToBoxAdapter to keep it using Sliver

       CustomScrollView(
          slivers: [
            SliverToBoxAdapter(
              child: Widget1()
             ),
            SliverToBoxAdapter(
              child: Widget2()
             ),
          ],
        ),

read Sliver doc carefully

and read this, it may help you.

happy coding.

Upvotes: 1

Related Questions