flutter sliverpersistentheader code example
Example: how to use sliverpersistentheader widget
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
_SliverAppBarDelegate({this.child});
final Widget child;
@override
double get minExtent => 100; //Change these values for your likings
@override
double get maxExtent => 250;
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return child;
}
@override
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
return false;
}
}
// Just call this inside delegate of SliverPersistentHeader,
// give any child and off you go