While working with SliverPersistentHeaderDelegate and using custom animation, you might get an error:
SliverGeometry is not valid: The “layoutExtent” exceeds the “paintExtent”. The relevant error-causing widget was CustomScrollView
This is a known bug, and there is a fix for that.
Fix: SliverGeometry is not valid – use Align widget
To solve this error, you need inside your build Widget wrap content with Align widget:
@override
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
return Align(
child: .....
);
}