bool _shouldUpdatePosition(Scrollable oldWidget) { ScrollPhysics newPhysics = widget.physics; ScrollPhysics oldPhysics = oldWidget.physics; do { Type newPhysicsType = newPhysics != null?newPhysics.GetType() : null; Type oldPhysicsType = oldPhysics != null?oldPhysics.GetType() : null; if (newPhysicsType != oldPhysicsType) { return(true); } if (newPhysics != null) { newPhysics = newPhysics.parent; } if (oldPhysics != null) { oldPhysics = oldPhysics.parent; } } while (newPhysics != null || oldPhysics != null); Type controllerType = widget.controller == null ? null : widget.controller.GetType(); Type oldControllerType = oldWidget.controller == null ? null : oldWidget.controller.GetType(); return(controllerType != oldControllerType); }
protected float applyBoundaryConditions(float value) { float result = physics.applyBoundaryConditions(this, value); D.assert(() => { float delta = value - pixels; if (result.abs() > delta.abs()) { throw new UIWidgetsError( $"{physics.GetType()}.applyBoundaryConditions returned invalid overscroll value.\n" + $"The method was called to consider a change from {pixels} to {value}, which is a " + $"delta of {delta:F1} units. However, it returned an overscroll of " + $"${result:F1} units, which has a greater magnitude than the delta. " + "The applyBoundaryConditions method is only supposed to reduce the possible range " + "of movement, not increase it.\n" + $"The scroll extents are {minScrollExtent} .. {maxScrollExtent}, and the " + $"viewport dimension is {viewportDimension}."); } return(true); }); return(result); }