Unverified Commit 73428160 authored by jslavitz's avatar jslavitz Committed by GitHub

Adds fix for double comparison error (#24026)

* adds fix for rounding error
parent 3d01e89e
......@@ -656,6 +656,8 @@ class SliverGeometry extends Diagnosticable {
/// * [RenderViewport.cacheExtent] for a description of a viewport's cache area.
final double cacheExtent;
static const double _epsilon = 1e-10;
/// Asserts that this geometry is internally consistent.
///
/// Does nothing if asserts are disabled. Always returns true.
......@@ -686,7 +688,9 @@ class SliverGeometry extends Diagnosticable {
);
}
verify(maxPaintExtent != null, 'The "maxPaintExtent" is null.');
if (maxPaintExtent < paintExtent) {
// If the paintExtent is slightly more than the maxPaintExtent, but the difference is still less
// than epsilon, we will not throw the assert below.
if (paintExtent - maxPaintExtent > _epsilon) {
verify(false,
'The "maxPaintExtent" is less than the "paintExtent".\n' +
_debugCompareFloats('maxPaintExtent', maxPaintExtent, 'paintExtent', paintExtent) +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment