Skip to content

Instantly share code, notes, and snippets.

@KoheiKanagu
Created October 30, 2023 08:25
Show Gist options
  • Save KoheiKanagu/be6caa384531983e2f676f448e85118a to your computer and use it in GitHub Desktop.
Save KoheiKanagu/be6caa384531983e2f676f448e85118a to your computer and use it in GitHub Desktop.
class CustomSliverPersistentHeader extends SingleChildRenderObjectWidget {
const CustomSliverPersistentHeader({
super.key,
required super.child,
});
@override
RenderObject createRenderObject(BuildContext context) =>
_RenderCustomSliverPersistentHeader();
}
class _RenderCustomSliverPersistentHeader
extends RenderSliverPinnedPersistentHeader {
@override
double get maxExtent =>
child!.getMaxIntrinsicHeight(constraints.crossAxisExtent);
@override
double get minExtent => 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment