I just started to learn about slivers and they don't seem to work with any other Flutter widgets except for the ones that start with "Sliver". I tried adding a Container so I can add BorderRadius to decorate the list. But I got this error:

A RenderSliverFillRemaining expected a child of type RenderBox but received a child of type RenderSliverToBoxAdapter.

Here's my code so far:

...
SliverFillRemaining(
  child: SliverToBoxAdapter(
    child: Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(36),
          topRight: Radius.circular(36),
        ),
      ),
      child: SliverPadding(
        padding: const EdgeInsets.all(16),
        sliver: SliverFixedExtentList(
          itemExtent: 50.0,
          delegate: SliverChildBuilderDelegate(
            (BuildContext context, int index) {
              return Container(
                alignment: Alignment.center,
                color: Colors.lightBlue[100 * (index % 9)],
                child: Text('List Item $index'),
              );
            },
          ),
        ),
      ),
    ),
  ),
),
...


Solution 1: dlohani

[UPDATE] Based on your use case I think, you don't even need SliverFillRemaining, if you want the list inside SliverFillRemaining to be infinite, just use SliverList with SliverChildBuilderDelegate

...
    SliverFixedExtentList(
      itemExtent: 50.0,
      delegate: SliverChildBuilderDelegate(
        (BuildContext context, int index) {
          return Container(
            alignment: Alignment.center,
            color: Colors.lightBlue[100 * (index % 9)],
            child: Text('List Item $index'),
          );
        },
      ),
    ),
    ...

previous

You already have your answer in the error, you SliverFillRemaining doesn't use sliver, it uses child which should be widget

...
SliverFillRemaining(
    hasScrollBody: true,
    child: Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(36),
          topRight: Radius.circular(36),
        ),
      ),
      child: Padding(
        padding: const EdgeInsets.all(16),
        child: ListView.builder(
          itemCount: 20,
          physics: NeverScrollableScrollPhysics(), //adding this line will disable the scrolling and listview and so the CustomScrollView should work as a single scroll view
          itemBuilder: (_, __) => ListTile(
            title: Text("Item"),
          ),
        ),
      ),
    ),
  ),
...


Solution 2: Benjamin

I solved my issue by using a NestedScrollView instead of a CustomScrollView.

return Scaffold(
  body: NestedScrollView(
    headerSliverBuilder: (context, innerBoxIsScrolled) {
      return <Widget>[
        SliverAppBar(
          floating: false,
          pinned: true,
          snap: false,
          elevation: 0,
          expandedHeight: 150.0,
          brightness: DynamicTheme.of(context).brightness,
          flexibleSpace: FlexibleSpaceBar(
            title: Text(assignment.name),
          ),
        ),
      ];
    },
    body: Container(
      decoration: BoxDecoration(
        color: Colors.red,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(36),
          topRight: Radius.circular(36),
        ),
      ),
      child: ListView.builder(
        itemExtent: 50.0,
        itemBuilder: (context, index) {
          return Container(
            alignment: Alignment.center,
            color: Colors.lightBlue[100 * (index % 9)],
            child: Text('List Item $index'),
          );
        },
      ),
    ),
  ),
);