fluttercommunity / fluttercommunity/flutter_sticky_headers

Nested StickyHeaders

Open
#68 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.2k
Forks
130
PR merge metrics
No merged PRs in 30d

Description

It would be nice to be able to nest multiple `StickyHeaders` and keep the inner ones visible under the outer ones.
With the current version of the library the inner ones will go under the outer ones and stick on the top corner of the list making them not visible.

Current behaviour:
![Simulator Screen Recording - iPhone 14 Pro Max - 2022-12-01 at 09 54 29](https://user-images.githubusercontent.com/6703604/205009024-e412552e-74b8-4fcc-ac32-c4b03e53fd25.gif)

Desired behaviour:
![Simulator Screen Recording - iPhone 14 Pro Max - 2022-12-01 at 09 47 27](https://user-images.githubusercontent.com/6703604/205009109-6188d5aa-0b09-44ad-bc80-29375fbf004a.gif)

Use case:
```dart
ListView.builder(
primary: controller == null,
controller: controller,
itemBuilder: (context, index) {
return StickyHeader(
controller: controller, // Optional
header: Container(
height: 50.0,
color: Colors.blueGrey[700]?.withOpacity(.7),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text(
'Header #$index',
style: const TextStyle(color: Colors.white),
),
),
content: Column(
children: [1, 2, 3]
.map(
(index) => StickyHeaderBuilder(
controller: controller,
builder: (context, stuckAmount) {
return Container(
height: 30.0,
color: Colors.red[700]?.withOpacity(1),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text(
'Subheader #$index',
style: const TextStyle(color: Colors.white),
),
);
},
content: Container(
color: Colors.grey[300],
child: Image.network(
imageForIndex(index),
fit: BoxFit.cover,
width: double.infinity,
height: 200.0,
),
),
),
)
.toList(),
),
);
},
);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.