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

Nested StickyHeaders #68

Open
Skogsfrae opened this issue Dec 1, 2022 · 0 comments
Open

Nested StickyHeaders #68

Skogsfrae opened this issue Dec 1, 2022 · 0 comments

Comments

@Skogsfrae
Copy link

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

Desired behaviour:
Simulator Screen Recording - iPhone 14 Pro Max - 2022-12-01 at 09 47 27

Use case:

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(),
      ),
    );
  },
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant