[SOLVED]: SliverGeometry is not valid: The “layoutExtent” exceeds the “paintExtent”.

Oflutter SliverGeometry is not valid

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: .....
      
      );
  }

You May Also Like

Leave a Reply

Your email address will not be published.

3 + 7 =