Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement nested SliverList? #66

Open
erfanium opened this issue Jun 16, 2021 · 2 comments
Open

How to implement nested SliverList? #66

erfanium opened this issue Jun 16, 2021 · 2 comments

Comments

@erfanium
Copy link

erfanium commented Jun 16, 2021

First I use this example from here:
https://github.com/letsar/flutter_sticky_header/blob/master/example/lib/examples/mix_slivers.dart

Instead of hard-coded _StickyHeaderList in build method:

Widget build(BuildContext context) {
return AppScaffold(
title: 'List Example',
slivers: [
SliverAppBar(
backgroundColor: Colors.orange,
title: Text('SliverAppBar'),
automaticallyImplyLeading: false,
pinned: true,
),
SliverToBoxAdapter(
child: Container(
height: 50,
color: Colors.red,
),
),
_StickyHeaderList(index: 0),
_StickyHeaderList(index: 1),
_StickyHeaderList(index: 2),
_StickyHeaderList(index: 3),
],
);
}
}

I want to use another ListView like:

  @override
  Widget build(BuildContext context) {
    return AppScaffold(
      title: 'List Example',
      slivers: [
        SliverAppBar(
          backgroundColor: Colors.orange,
          title: Text('SliverAppBar'),
          automaticallyImplyLeading: false,
          pinned: true,
        ),
        SliverToBoxAdapter(
          child: Container(
            height: 50,
            color: Colors.red,
          ),
        ),
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (context, i) => ListTile(
              leading: _StickyHeaderList(),
            ),
            childCount: 6,
          ),
        ),
      ],
    );
  }
}

But I get this error:

The following assertion was thrown building _StickyHeaderList:
A RenderRepaintBoundary expected a child of type RenderBox but received a child of type
RenderSliverStickyHeader.

How can I do that?

@letsar
Copy link
Owner

letsar commented Jul 13, 2022

What do you want to achieve exactly? Here you provide a Sliver to the leading of the ListTile, that's why there is an error.

@erfanium
Copy link
Author

@letsar

What do you want to achieve exactly?

Good question, obviously I don't remember what I wanted after a year :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants