persistent_header.dart 522 B

1234567891011121314151617181920212223
  1. import 'package:flutter/material.dart';
  2. class PersistentHeader extends SliverPersistentHeaderDelegate {
  3. double max;
  4. double min;
  5. Widget child;
  6. PersistentHeader({this.max = 50.0, this.min = 50.0, @required this.child});
  7. @override
  8. Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
  9. return child;
  10. }
  11. @override
  12. double get maxExtent => max;
  13. @override
  14. double get minExtent => min;
  15. @override
  16. bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true;
  17. }