}
diagnosticInfo . Add ( new DiagnosticsProperty < SliverConstraints > ( "The offending constraints were" , this , style : DiagnosticsTreeStyle . errorProperty ) ) ;
throw new UIWidgetsError (
diagnosticInfo ) ;
throw new UIWidgetsError ( diagnosticInfo ) ;
}
return true ;
} ) ;
if ( ReferenceEquals ( this , other ) ) {
return true ;
}
D . assert ( other . debugAssertIsValid ( ) ) ;
return axisDirection = = other . axisDirection
& & growthDirection = = other . growthDirection
& & userScrollDirection = = other . userScrollDirection
}
public override string ToString ( ) {
string result = "" ;
result + = ( $"{axisDirection}" ) + " , " ;
result + = ( $"{growthDirection}" ) + " , " ;
result + = ( $"{userScrollDirection}" ) + " , " ;
result + = ( $"scrollOffset: {scrollOffset : F1}" ) + " , " ;
result + = ( $"remainingPaintExtent: {remainingPaintExtent : F1}" ) + " , " ;
if ( overlap ! = 0.0 )
result + = ( $"overlap: {overlap: F1}" ) + " , " ;
result + = ( $"crossAxisExtent: {crossAxisExtent : F1}" ) + " , " ;
result + = ( $"crossAxisDirection: crossAxisDirection" ) + " , " ;
result + = ( $"viewportMainAxisExtent: {viewportMainAxisExtent : F1}" ) + " , " ;
result + = ( $"remainingCacheExtent: {remainingCacheExtent : F1}" ) + " , " ;
result + = ( $"cacheOrigin: {cacheOrigin : F1}" ) ;
return $"SliverConstraints({result})" ;
return
$"SliverConstraints({axisDirection}, {growthDirection}, {userScrollDirection}, scrollOffset: {scrollOffset:F1}, remainingPaintExtent: {remainingCacheExtent:F1}, " +
$"{(overlap != 0.0f ? " overlap : " + overlap.ToString(" F1 ") + " , " : " ")}crossAxisExtent: {crossAxisExtent:F1}, crossAxisDirection: {crossAxisDirection}, " +
$"viewportMainAxisExtent: {viewportMainAxisExtent:F1}, remainingCacheExtent: {remainingCacheExtent:F1} " +
$"cacheOrigin: {cacheOrigin:F1})" ;
List < string > properties = new List < string > ( ) ;
properties . Add ( $"{axisDirection}" ) ;
properties . Add ( $"{growthDirection}" ) ;
properties . Add ( $"{userScrollDirection}" ) ;
properties . Add ( $"scrollOffset: {scrollOffset : F1}" ) ;
properties . Add ( $"remainingPaintExtent: {remainingPaintExtent : F1}" ) ;
if ( overlap ! = 0.0 )
properties . Add ( $"overlap: {overlap: F1}" ) ;
properties . Add ( $"crossAxisExtent: {crossAxisExtent : F1}" ) ;
properties . Add ( $"crossAxisDirection: {crossAxisDirection}" ) ;
properties . Add ( $"viewportMainAxisExtent: {viewportMainAxisExtent : F1}" ) ;
properties . Add ( $"remainingCacheExtent: {remainingCacheExtent : F1}" ) ;
properties . Add ( $"cacheOrigin: {cacheOrigin : F1}" ) ;
return $"SliverConstraints({string.Join(" , ",properties)})" ;
}
}
public readonly bool hasVisualOverflow ;
public readonly float? scrollOffsetCorrection ;
public readonly float cacheExtent ;
public const float precisionErrorTolerance = 1e-10f ;
internal static List < DiagnosticsNode > _debugCompareFloats ( string labelA , float valueA , string labelB , float valueB ) {
List < DiagnosticsNode > diagnosticInfo = new List < DiagnosticsNode > ( ) ;
) ;
}
if ( paintExtent - maxPaintExtent > precisionErrorTolerance ) {
if ( paintExtent - maxPaintExtent > foundation_ . precisionErrorTolerance ) {
var details = _debugCompareFloats ( "maxPaintExtent" , maxPaintExtent , "paintExtent" ,
paintExtent ) ;
details . Add ( new ErrorDescription ( "By definition, a sliver can\"t paint more than the maximum that it can paint!" ) ) ;
}
public bool addWithAxisOffset (
Offset paintOffset ,
SliverHitTest hitTest
Offset paintOffset = null ,
SliverHitTest hitTest = null
D . assert ( mainAxisOffset ! = null ) ;
D . assert ( crossAxisOffset ! = null ) ;
D . assert ( mainAxisPosition ! = null ) ;
D . assert ( crossAxisPosition ! = null ) ;
D . assert ( hitTest ! = null ) ;
if ( paintOffset ! = null ) {
pushTransform ( Matrix4 . translationValues ( - paintOffset . dx , - paintOffset . dy , 0 ) ) ;
}
public class SliverHitTestEntry : HitTestEntry {
public SliverHitTestEntry ( RenderSliver target ,
public SliverHitTestEntry (
RenderSliver target ,
float mainAxisPosition = 0.0f ,
float crossAxisPosition = 0.0f
) : base ( target ) {
}
D . assert ( ! debugDoingThisResize ) ;
string contract = "" , violation = "" , hint = "" ;
DiagnosticsNode contract , violation , hint = null ;
violation = "It appears that the geometry setter was called from performLayout()." ;
hint = "" ;
violation = new ErrorDescription ( "It appears that the geometry setter was called from performLayout()." ) ;
violation =
"The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object)." ;
violation = new ErrorDescription ( "The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object)." ) ;
hint =
"Only the object itself can set its geometry. It is a contract violation for other objects to set it." ;
hint = new ErrorDescription ( "Only the object itself can set its geometry. It is a contract violation for other objects to set it." ) ;
contract =
"Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize()." ;
contract = new ErrorDescription ( "Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize()." ) ;
contract =
"Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout()." ;
contract = new ErrorDescription (
"Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout()." ) ;
throw new UIWidgetsError (
"RenderSliver geometry setter called incorrectly.\n" +
violation + "\n" +
hint + "\n" +
contract + "\n" +
"The RenderSliver in question is:\n" +
" " + this
) ;
List < DiagnosticsNode > information = new List < DiagnosticsNode > ( ) ;
information . Add ( new ErrorSummary ( "RenderSliver geometry setter called incorrectly." ) ) ;
information . Add ( violation ) ;
if ( hint ! = null ) {
information . Add ( hint ) ;
}
information . Add ( contract ) ;
information . Add ( describeForError ( "The RenderSliver in question is" ) ) ;
throw new UIWidgetsError ( information ) ;
} ) ;
_geometry = value ;
public override Rect paintBounds {
get {
D . assert ( constraints . axis ! = null ) ;
switch ( constraints . axis ) {
case Axis . horizontal :
return Rect . fromLTWH (
geometry . paintExtent
) ;
}
// D.assert(false);
return null ;
}
}
informationCollector : infoCollector ) ;
} ) ;
D . assert ( ( ) = > {
if ( geometry . paintExtent > constraints . remainingPaintExtent ) {
if ( geometry . paintOrigin + geometry . paintExtent > constraints . remainingPaintExtent ) {
"paintExtent" , geometry . paintExtent ) ) ;
"paintOrigin + paintExtent" , geometry . paintOrigin + geometry . paintExtent ) ) ;
throw new UIWidgetsError (
diagnosticInfo
) ;
throw new UIWidgetsError ( diagnosticInfo ) ;
}
return true ;
get { return 0.0f ; }
}
public virtual bool hitTest ( SliverHitTestResult result , float mainAxisPosition = 0 , float crossAxisPosition = 0 ) {
public virtual bool hitTest ( SliverHitTestResult result , float mainAxisPosition = 0.0f , float crossAxisPosition = 0.0f ) {
if ( mainAxisPosition > = 0.0f & & mainAxisPosition < geometry . hitTestExtent & &
crossAxisPosition > = 0.0f & & crossAxisPosition < constraints . crossAxisExtent ) {
if ( hitTestChildren ( result , mainAxisPosition : mainAxisPosition ,
return false ;
}
protected virtual bool hitTestSelf ( float mainAxisPosition = 0 , float crossAxisPosition = 0 ) {
protected virtual bool hitTestSelf ( float mainAxisPosition = 0.0f , float crossAxisPosition = 0.0f ) {
protected virtual bool hitTestChildren ( SliverHitTestResult result , float mainAxisPosition = 0 ,
float crossAxisPosition = 0 ) {
protected virtual bool hitTestChildren ( SliverHitTestResult result , float mainAxisPosition = 0.0f ,
float crossAxisPosition = 0.0f ) {
return false ;
}
case AxisDirection . left :
return new Size ( - geometry . paintExtent , constraints . crossAxisExtent ) ;
}
//D.assert(false);
return null ;
}
} ) ;
}
public override void handleEvent ( PointerEvent evt , HitTestEntry entry ) {
entry = ( SliverHitTestEntry ) entry ;
}
public override void handleEvent ( PointerEvent evt , HitTestEntry entry ) { }
public override void debugFillProperties ( DiagnosticPropertiesBuilder properties ) {
base . debugFillProperties ( properties ) ;
properties . add ( new DiagnosticsProperty < SliverGeometry > ( "geometry" , geometry ) ) ;
public static class RenderSliverHelpers {
public static bool _getRightWayUp ( SliverConstraints constraints ) {
D . assert ( constraints ! = null ) ;
bool rightWayUp = true ;
switch ( constraints . axisDirection ) {
float? absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta ;
Offset paintOffset = null ;
Offset transformedPosition = null ;
D . assert ( it . constraints . axis ! = null ) ;
switch ( it . constraints . axis ) {
case Axis . horizontal :
if ( ! rightWayUp ) {
new Offset ( - ( geometry . scrollExtent - ( geometry . paintExtent + constraints . scrollOffset ) ) ,
0.0f ) ;
break ;
D . assert ( childParentData . paintOffset ! = null ) ;
}
protected override bool hitTestChildren ( SliverHitTestResult result , float mainAxisPosition = 0.0f ,
return ;
}
SliverConstraints constraints = this . constraints ;
child . layout ( constraints . asBoxConstraints ( ) , parentUsesSize : true ) ;
float childExtent = 0.0f ;