import 'package:flutter/cupertino.dart'; class CustomSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate { final Widget child; double maxHeight = 100.0; double minHeight = 100.0; CustomSliverPersistentHeaderDelegate({required this.child, required this.maxHeight, required this.minHeight}); @override double get maxExtent => maxHeight; // 最大高度 @override double get minExtent => minHeight; // 最小高度 @override Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { return child; } @override bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) { return true; } }