customSilverHeaderTabs.dart 578 B

123456789101112131415161718192021222324
  1. import 'package:flutter/cupertino.dart';
  2. class CustomSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
  3. final Widget child;
  4. CustomSliverPersistentHeaderDelegate({required this.child});
  5. @override
  6. double get minExtent => 50.0; // 最小高度
  7. @override
  8. double get maxExtent => 50.0; // 最大高度
  9. @override
  10. Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
  11. return child;
  12. }
  13. @override
  14. bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
  15. return true;
  16. }
  17. }