Closed per-johansson-74 closed 2 years ago
It happens in demo on Flutter 3.0.0?
I looked more into it. I can not get this error using the example.
I get it when I use animated container in SliverPinnedPersistentHeaderDelegate using final progress = shrinkOffset / maxExtent; and padding: EdgeInsets.lerp( const EdgeInsets.symmetric(horizontal: 16, vertical: 16), const EdgeInsets.symmetric(horizontal: 4, vertical: 4), progress, ),
So I can solve it two ways, remove edgeinsets.lerp from the delegate or comment out layoutExtent: layoutExtent, from the library. I'll just remove the code from delegate that triggers the rounding error in the lib.
(I don't use this for pinning header, I set minExtentProtoType to 0, and maxExtentProtoType i use template so i get the dynamic height of maxExtent, then i put the actual drawn widget in the delegate)
I'll add that if I use same delegate directly in SliverPersistentHeaderDelegate there is no crash due to the floating point rounding.
sounds great,it seems a special case with dynamic height,maybe we can make another widget for this case
When I scroll up/down couple of times that happens, Seems to be a rounding error.
If I comment layoutExtent in line 74 lib/src/rendering.dart so that it uses paintExtent instead the issue seems solved. No more errors and everything seems to work fine for me.
Here is couple examples: The paintExtent is 74.6651785714286, but the layoutExtent is 74.66517857142861 The paintExtent is 148.74255952380966, but the layoutExtent is 148.7425595238097