You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
977 B

import 'package:flutter/material.dart';
class SliverPersistentHeaderPadding extends StatelessWidget {
final double maxHeight;
const SliverPersistentHeaderPadding({required this.maxHeight, super.key,});
@override
Widget build(BuildContext context) {
return SliverPersistentHeader(
delegate: _SliverPersistentHeaderPaddingDelegate(maxHeight: maxHeight,),
floating: false,
pinned: false,
);
}
}
class _SliverPersistentHeaderPaddingDelegate extends SliverPersistentHeaderDelegate {
final double maxHeight;
const _SliverPersistentHeaderPaddingDelegate({required this.maxHeight});
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
return Container();
}
@override
double get maxExtent => maxHeight;
@override
double get minExtent => 0;
@override
bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
return oldDelegate.maxExtent != maxExtent;
}
}