sliver_tools icon indicating copy to clipboard operation
sliver_tools copied to clipboard

SliverPinnedHeader and detecting overlapping (i.e. overlapsContent)

Open TyBarthel opened this issue 1 year ago • 1 comments

Is there a way to detect the overlapping content using a SliverPinnedHeader like you can do with a SliverPersistentHeaderDelegate? I'm ultimately looking to change the background of the SliverPinnedHeader when content overlaps.

TyBarthel avatar Apr 20 '23 18:04 TyBarthel

@TyBarthel You can use SliverLayoutBuilder to achieve it.

SliverLayoutBuilder(
  builder: (_, SliverConstraints constraints) {
    return SliverPinnedHeader(
      child: Text('Is overlapped? ${constraints.overlap > 0}'),
    );
  },
),

sunguard avatar Mar 19 '24 13:03 sunguard