import 'package:flutter/material.dart';

class StickyHeader extends SliverPersistentHeaderDelegate {
  final Widget child;
  final double maxExtentSize;
  final double minExtentSize;

  StickyHeader(
      {required this.child,
      required this.maxExtentSize,
      required this.minExtentSize});

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return child;
  }

  @override
  double get maxExtent => maxExtentSize; // Height of the sticky widget
  @override
  double get minExtent => minExtentSize; // Minimum height when collapsed
  @override
  bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
    return true;
  }
}
