flutter_sticky_header
flutter_sticky_header copied to clipboard
How to add PageView in sliver
Here is my code, and it's working properly. ProfileReelsSection() is implemented as a SliverGrid in this
SliverStickyHeader.builder(
builder: (context, state) => Container(
height: 50.0,
color: cBgColor(context),
child: Column(
children: [
Container(
height: 1,
color: cGreyLight1(context),
),
Spacer(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_icon(imageName: MyImages.reelsCircles),
_icon(imageName: MyImages.market),
],
),
),
Spacer(),
],
),
),
sticky: true,
sliver: ProfileReelsSection(),
);
When I use ProfileReelsSection() implemented as a GridView.builder(), it is not working and I receive the error: 'Null check operator used on a null value'.
SliverToBoxAdapter(
child: Expanded(
child: PageView(
children: [
ProfileReelsSection(),
ProfileReelsSection(),
],
),
),
),
If I use SizedBox with a fixed height, it works without any error, but the size is fixed.
SliverToBoxAdapter(
child: SizedBox(
height: 300, // Set a fixed height for the PageView
child: PageView(
children: [
ProfileReelsSection(),
ProfileReelsSection(),
],
),
),
)
Please help
hey @Ankooo12 faced that issue before solved it by these two flutter_hooks: ^0.20.5 expandable_page_view: ^1.0.17
just read their documentation and let me know if you need more details.