Adds fix for double comparison error (#24026)
* adds fix for rounding error
This commit is contained in:
@@ -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) +
|
||||
|
||||
Reference in New Issue
Block a user