siyao
3 年前
当前提交
facf8a73
共有 25 个文件被更改,包括 3665 次插入 和 0 次删除
-
922AwesomeUIWidgets/Assets/Scenes/ImageFlow.unity
-
7AwesomeUIWidgets/Assets/Scenes/ImageFlow.unity.meta
-
299AwesomeUIWidgets/Assets/Scripts/ImageFlowDemo.cs
-
3AwesomeUIWidgets/Assets/Scripts/ImageFlowDemo.cs.meta
-
3AwesomeUIWidgets/Assets/Packages/SGrid/render/sliver_staggered_grid.cs.meta
-
429AwesomeUIWidgets/Assets/Packages/SGrid/render/sliver_variable_size_box_adaptor.cs
-
3AwesomeUIWidgets/Assets/Packages/SGrid/render/sliver_variable_size_box_adaptor.cs.meta
-
757AwesomeUIWidgets/Assets/Packages/SGrid/render/sliver_staggered_grid.cs
-
520AwesomeUIWidgets/Assets/Packages/SGrid/widget/grid.cs
-
3AwesomeUIWidgets/Assets/Packages/SGrid/widget/grid.cs.meta
-
3AwesomeUIWidgets/Assets/Packages/SGrid/widget/staggered_grid_view.cs.meta
-
55AwesomeUIWidgets/Assets/Packages/SGrid/widget/staggered_tile.cs
-
3AwesomeUIWidgets/Assets/Packages/SGrid/widget/staggered_tile.cs.meta
-
342AwesomeUIWidgets/Assets/Packages/SGrid/widget/staggered_grid_view.cs
-
11AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs
-
3AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.cs.meta
-
142AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs
-
11AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta
-
146AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk
-
3AwesomeUIWidgets/Assets/Packages/SGrid/codegen/TileContainerRenderObjectMixin.mixin.njk.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 9 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 705507994} |
|||
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748172, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 1 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 0 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 12 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_AtlasSize: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_ExtractAmbientOcclusion: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 1 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 500 |
|||
m_PVRBounces: 2 |
|||
m_PVREnvironmentSampleCount: 500 |
|||
m_PVREnvironmentReferencePointCount: 2048 |
|||
m_PVRFilteringMode: 2 |
|||
m_PVRDenoiserTypeDirect: 0 |
|||
m_PVRDenoiserTypeIndirect: 0 |
|||
m_PVRDenoiserTypeAO: 0 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVREnvironmentMIS: 0 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_ExportTrainingData: 0 |
|||
m_TrainingDataDestination: TrainingData |
|||
m_LightProbeSampleCountMultiplier: 4 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &156319110 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 156319113} |
|||
- component: {fileID: 156319112} |
|||
- component: {fileID: 156319111} |
|||
m_Layer: 0 |
|||
m_Name: EventSystem |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &156319111 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 156319110} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalAxis: Horizontal |
|||
m_VerticalAxis: Vertical |
|||
m_SubmitButton: Submit |
|||
m_CancelButton: Cancel |
|||
m_InputActionsPerSecond: 10 |
|||
m_RepeatDelay: 0.5 |
|||
m_ForceModuleActive: 0 |
|||
--- !u!114 &156319112 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 156319110} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_FirstSelected: {fileID: 0} |
|||
m_sendNavigationEvents: 1 |
|||
m_DragThreshold: 10 |
|||
--- !u!4 &156319113 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 156319110} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &373829882 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 373829883} |
|||
- component: {fileID: 373829885} |
|||
- component: {fileID: 373829884} |
|||
m_Layer: 5 |
|||
m_Name: RawImage |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &373829883 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 373829882} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1882612342} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &373829884 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 373829882} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4b528d0713eb470881072361372fa123, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Texture: {fileID: 985023221} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
hardwareAntiAliasing: 0 |
|||
fonts: [] |
|||
--- !u!222 &373829885 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 373829882} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &486503336 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 486503339} |
|||
- component: {fileID: 486503338} |
|||
- component: {fileID: 486503337} |
|||
m_Layer: 5 |
|||
m_Name: Panel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 0 |
|||
--- !u!114 &486503337 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 486503336} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 0.392} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_Type: 1 |
|||
m_PreserveAspect: 0 |
|||
m_FillCenter: 1 |
|||
m_FillMethod: 4 |
|||
m_FillAmount: 1 |
|||
m_FillClockwise: 1 |
|||
m_FillOrigin: 0 |
|||
m_UseSpriteMesh: 0 |
|||
m_PixelsPerUnitMultiplier: 1 |
|||
--- !u!222 &486503338 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 486503336} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!224 &486503339 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 486503336} |
|||
m_LocalRotation: {x: -0, y: -0.3507795, z: -0, w: 0.9364581} |
|||
m_LocalPosition: {x: 0, y: 0, z: 606.11426} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 1588079143} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 32.075195, y: 392} |
|||
m_SizeDelta: {x: 398, y: 784} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!1 &705507993 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 705507995} |
|||
- component: {fileID: 705507994} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &705507994 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 705507993} |
|||
m_Enabled: 1 |
|||
serializedVersion: 10 |
|||
m_Type: 1 |
|||
m_Shape: 0 |
|||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_InnerSpotAngle: 21.80208 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_CullingMatrixOverride: |
|||
e00: 1 |
|||
e01: 0 |
|||
e02: 0 |
|||
e03: 0 |
|||
e10: 0 |
|||
e11: 1 |
|||
e12: 0 |
|||
e13: 0 |
|||
e20: 0 |
|||
e21: 0 |
|||
e22: 1 |
|||
e23: 0 |
|||
e30: 0 |
|||
e31: 0 |
|||
e32: 0 |
|||
e33: 1 |
|||
m_UseCullingMatrixOverride: 0 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingLayerMask: 1 |
|||
m_Lightmapping: 1 |
|||
m_LightShadowCasterMode: 0 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} |
|||
m_UseBoundingSphereOverride: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &705507995 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 705507993} |
|||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} |
|||
--- !u!1 &963194225 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 963194228} |
|||
- component: {fileID: 963194227} |
|||
- component: {fileID: 963194226} |
|||
m_Layer: 0 |
|||
m_Name: Main Cameraff |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &963194226 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 963194225} |
|||
m_Enabled: 1 |
|||
--- !u!20 &963194227 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 963194225} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 1 |
|||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
|||
m_projectionMatrixMode: 1 |
|||
m_GateFitMode: 2 |
|||
m_FOVAxisMode: 0 |
|||
m_SensorSize: {x: 36, y: 24} |
|||
m_LensShift: {x: 0, y: 0} |
|||
m_FocalLength: 50 |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 1 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!4 &963194228 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 963194225} |
|||
m_LocalRotation: {x: -0, y: -0.9991026, z: -0, w: 0.04235741} |
|||
m_LocalPosition: {x: -8.95, y: 4.3, z: -4.52} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: -175.145, z: 0} |
|||
--- !u!28 &985023221 |
|||
Texture2D: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_Name: |
|||
m_ImageContentsHash: |
|||
serializedVersion: 2 |
|||
Hash: 00000000000000000000000000000000 |
|||
m_ForcedFallbackFormat: 4 |
|||
m_DownscaleFallback: 0 |
|||
serializedVersion: 3 |
|||
m_Width: 0 |
|||
m_Height: 0 |
|||
m_CompleteImageSize: 0 |
|||
m_TextureFormat: 0 |
|||
m_MipCount: 1 |
|||
m_IsReadable: 1 |
|||
m_IgnoreMasterTextureLimit: 0 |
|||
m_IsPreProcessed: 0 |
|||
m_StreamingMipmaps: 0 |
|||
m_StreamingMipmapsPriority: 0 |
|||
m_AlphaIsTransparency: 0 |
|||
m_ImageCount: 0 |
|||
m_TextureDimension: 2 |
|||
m_TextureSettings: |
|||
serializedVersion: 2 |
|||
m_FilterMode: 1 |
|||
m_Aniso: 1 |
|||
m_MipBias: 0 |
|||
m_WrapU: 0 |
|||
m_WrapV: 0 |
|||
m_WrapW: 0 |
|||
m_LightmapFormat: 0 |
|||
m_ColorSpace: 0 |
|||
image data: 0 |
|||
_typelessdata: |
|||
m_StreamData: |
|||
offset: 0 |
|||
size: 0 |
|||
path: |
|||
m_OriginalWidth: 0 |
|||
m_OriginalHeight: 0 |
|||
m_OriginalAssetGuid: 00000000000000000000000000000000 |
|||
--- !u!1 &1588079142 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1588079143} |
|||
- component: {fileID: 1588079146} |
|||
- component: {fileID: 1588079145} |
|||
- component: {fileID: 1588079144} |
|||
m_Layer: 5 |
|||
m_Name: Canvas |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1588079143 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1588079142} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0, y: 0, z: 0} |
|||
m_Children: |
|||
- {fileID: 1666129244} |
|||
m_Father: {fileID: 486503339} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0} |
|||
--- !u!114 &1588079144 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1588079142} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &1588079145 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1588079142} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!223 &1588079146 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1588079142} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 0 |
|||
m_Camera: {fileID: 0} |
|||
m_PlaneDistance: 100 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!1 &1666129243 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1666129244} |
|||
- component: {fileID: 1666129246} |
|||
- component: {fileID: 1666129245} |
|||
m_Layer: 5 |
|||
m_Name: RawImage |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1666129244 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1666129243} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1588079143} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1666129245 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1666129243} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4b528d0713eb470881072361372fa123, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Texture: {fileID: 0} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
hardwareAntiAliasing: 0 |
|||
fonts: [] |
|||
--- !u!222 &1666129246 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1666129243} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!1 &1882612338 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1882612342} |
|||
- component: {fileID: 1882612341} |
|||
- component: {fileID: 1882612340} |
|||
- component: {fileID: 1882612339} |
|||
m_Layer: 5 |
|||
m_Name: Canvas |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &1882612339 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1882612338} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &1882612340 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1882612338} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!223 &1882612341 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1882612338} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 2 |
|||
m_Camera: {fileID: 963194227} |
|||
m_PlaneDistance: 100 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!224 &1882612342 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1882612338} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 373829883} |
|||
m_Father: {fileID: 2074331824} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 500, y: 800} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!1 &2074331820 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 2074331824} |
|||
- component: {fileID: 2074331823} |
|||
- component: {fileID: 2074331822} |
|||
- component: {fileID: 2074331821} |
|||
m_Layer: 0 |
|||
m_Name: Cube |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!65 &2074331821 |
|||
BoxCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2074331820} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 0 |
|||
serializedVersion: 2 |
|||
m_Size: {x: 1, y: 1, z: 1} |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &2074331822 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2074331820} |
|||
m_Enabled: 0 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_RayTracingMode: 2 |
|||
m_RenderingLayerMask: 1 |
|||
m_RendererPriority: 0 |
|||
m_Materials: |
|||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_ReceiveGI: 1 |
|||
m_PreserveUVs: 0 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 1 |
|||
m_SelectedEditorRenderState: 3 |
|||
m_MinimumChartSize: 4 |
|||
m_AutoUVMaxDistance: 0.5 |
|||
m_AutoUVMaxAngle: 89 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_SortingLayerID: 0 |
|||
m_SortingLayer: 0 |
|||
m_SortingOrder: 0 |
|||
--- !u!33 &2074331823 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2074331820} |
|||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &2074331824 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2074331820} |
|||
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} |
|||
m_LocalPosition: {x: -8.84, y: 4.93, z: -14.53} |
|||
m_LocalScale: {x: 0.01, y: 0.01, z: 1} |
|||
m_Children: |
|||
- {fileID: 1882612342} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 4 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4a3548dce430542b4aff5fced1776adb |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using FontStyle = Unity.UIWidgets.ui.FontStyle; |
|||
using Image = Unity.UIWidgets.widgets.Image; |
|||
using Random = System.Random; |
|||
using ui_ = Unity.UIWidgets.widgets.ui_; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public class ImageFlowDemo : UIWidgetsPanel |
|||
{ |
|||
protected void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new ImageFlowApp()); |
|||
} |
|||
} |
|||
|
|||
class ImageFlowApp : StatelessWidget |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new MaterialApp( |
|||
theme: new ThemeData( |
|||
brightness: Brightness.dark, |
|||
accentColor: Colors.cyan[600], |
|||
textTheme: new TextTheme( |
|||
headline1: new TextStyle(fontSize: 72.0f, fontWeight: FontWeight.bold), |
|||
headline6: new TextStyle(fontSize: 36.0f, fontStyle: FontStyle.italic), |
|||
bodyText2: new TextStyle(fontSize: 14.0f) |
|||
) |
|||
), |
|||
home: new Container(color: new Color(0xAF000000), |
|||
child: new ImageFlow()) |
|||
); |
|||
} |
|||
} |
|||
|
|||
|
|||
public static class Utils |
|||
{ |
|||
public static List<Color> colors = new List<Color>() |
|||
{ |
|||
Colors.red, |
|||
Colors.amber, |
|||
Colors.cyan, |
|||
Colors.brown, |
|||
Colors.purpleAccent, |
|||
Colors.blue |
|||
}; |
|||
|
|||
public static List<string> lotties = new List<string>() |
|||
{ |
|||
"1055-world-locations.json", |
|||
"1370-confetti.json", |
|||
"1798-check-animation.json", |
|||
"226-splashy-loader.json", |
|||
"66992-the-flying-rocket.json", |
|||
"77-im-thirsty.json", |
|||
"782-check-mark-success.json", |
|||
"91-mailsent.json", |
|||
"lottieflow-checkbox-06-000000-easey.json", |
|||
"lottieflow-cta-04-000000-easey.json", |
|||
"lottieflow-radio-07-000000-easey.json", |
|||
"lottieflow-social-networks-16-12-000000-easey.json", |
|||
"lottieflow-social-networks-16-7-000000-easey.json", |
|||
}; |
|||
|
|||
public static List<string> imageUrls = new List<string>() |
|||
{ |
|||
"https://cdn.pixabay.com/photo/2016/10/21/14/50/plouzane-1758197_960_720.jpg", |
|||
"https://cdn.pixabay.com/photo/2016/11/16/10/59/mountains-1828596_960_720.jpg", |
|||
"https://cdn.pixabay.com/photo/2017/08/24/22/37/gyrfalcon-2678684_960_720.jpg", |
|||
"https://cdn.pixabay.com/photo/2013/01/17/08/25/sunset-75159_960_720.jpg", |
|||
"https://cdn.pixabay.com/photo/2021/04/06/21/08/crown-anemone-6157488_960_720.jpg", |
|||
"https://cdn.pixabay.com/photo/2021/05/10/10/46/yellow-wall-6243164_960_720.jpg", |
|||
}; |
|||
|
|||
internal static Random random = new Random(); |
|||
|
|||
public static bool UseImage = true; |
|||
public static bool UseAmountSlider = false; |
|||
|
|||
public static T RandomSelect<T>(this List<T> a) |
|||
{ |
|||
if (a.isEmpty()) |
|||
{ |
|||
return default; |
|||
} |
|||
|
|||
return a[random.Next(a.Count)]; |
|||
} |
|||
} |
|||
|
|||
class ImageFlow : StatefulWidget |
|||
{ |
|||
public override State createState() |
|||
{ |
|||
return new ImageFlowState(); |
|||
} |
|||
} |
|||
|
|||
class ImageFlowState : State<ImageFlow> |
|||
{ |
|||
public ImageFlowState() |
|||
{ |
|||
UpdateTiles(); |
|||
} |
|||
|
|||
private readonly List<StaggeredTile> _staggeredTiles = new List<StaggeredTile>(); |
|||
|
|||
private readonly List<Widget> _tiles = new List<Widget>(); |
|||
|
|||
private int count = 4; |
|||
private int tileCount = 30; |
|||
|
|||
public void UpdateTiles() |
|||
{ |
|||
while (_tiles.Count < tileCount) |
|||
{ |
|||
if (Utils.UseImage) |
|||
{ |
|||
_tiles.Add( |
|||
new ImageTile( |
|||
Utils.colors.RandomSelect(), |
|||
Utils.imageUrls.RandomSelect() |
|||
) |
|||
); |
|||
} |
|||
else |
|||
{ |
|||
_tiles.Add( |
|||
new LottieTile( |
|||
Utils.colors.RandomSelect(), |
|||
Utils.lotties.RandomSelect() |
|||
) |
|||
); |
|||
} |
|||
|
|||
_staggeredTiles.Add( |
|||
StaggeredTile.count( |
|||
Utils.random.Next(2) + 1, |
|||
Utils.random.Next(2) + 1) |
|||
); |
|||
} |
|||
|
|||
while (_tiles.Count > tileCount) |
|||
{ |
|||
_tiles.RemoveAt(0); |
|||
_staggeredTiles.RemoveAt(0); |
|||
} |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
var result = new List<Widget>() |
|||
{ |
|||
new Expanded(child: |
|||
new Container( |
|||
child: |
|||
StaggeredGridView.count( |
|||
crossAxisCount: count, |
|||
staggeredTiles: _staggeredTiles, |
|||
mainAxisSpacing: 3, |
|||
crossAxisSpacing: 3, |
|||
padding: EdgeInsets.all(4), |
|||
children: _tiles |
|||
) |
|||
)), |
|||
new Slider( |
|||
activeColor: Colors.blue, |
|||
inactiveColor: Colors.white, |
|||
value: count, |
|||
min: 2, |
|||
max: 8, |
|||
divisions: 6, |
|||
label: count.ToString(), |
|||
onChanged: v => |
|||
{ |
|||
int newCount = (int) v; |
|||
if (newCount != count) |
|||
{ |
|||
setState(() => { count = newCount; }); |
|||
} |
|||
} |
|||
), |
|||
}; |
|||
if (Utils.UseAmountSlider) |
|||
{ |
|||
result.Add( |
|||
new Slider( |
|||
activeColor: Colors.blue, |
|||
inactiveColor: Colors.white, |
|||
value: tileCount, |
|||
min: 0, |
|||
max: 20, |
|||
divisions: 20, |
|||
label: tileCount.ToString(), |
|||
onChanged: v => |
|||
{ |
|||
int newCount = (int) v; |
|||
if (newCount != tileCount) |
|||
{ |
|||
setState(() => |
|||
{ |
|||
tileCount = newCount; |
|||
UpdateTiles(); |
|||
}); |
|||
} |
|||
} |
|||
) |
|||
); |
|||
} |
|||
return new Column(children: result); |
|||
} |
|||
} |
|||
|
|||
internal class ImageTile : StatefulWidget |
|||
{ |
|||
internal ImageTile(Color backgroundColor, string path) |
|||
{ |
|||
this.backgroundColor = backgroundColor; |
|||
this.path = path; |
|||
} |
|||
|
|||
public readonly Color backgroundColor; |
|||
public readonly string path; |
|||
|
|||
public override State createState() |
|||
{ |
|||
return new ImageTileState(); |
|||
} |
|||
} |
|||
|
|||
internal class ImageTileState : State<ImageTile> |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new Card( |
|||
color: widget.backgroundColor, |
|||
child: new InkWell( |
|||
onTap: () => { }, |
|||
child: Image.network( |
|||
widget.path, |
|||
fit: BoxFit.cover |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
|
|||
internal class LottieTile : StatefulWidget |
|||
{ |
|||
internal LottieTile(Color backgroundColor, string path) |
|||
{ |
|||
this.backgroundColor = backgroundColor; |
|||
this.path = path; |
|||
} |
|||
|
|||
public readonly Color backgroundColor; |
|||
public readonly string path; |
|||
|
|||
public override State createState() |
|||
{ |
|||
return new LottieTileState(); |
|||
} |
|||
} |
|||
|
|||
internal class LottieTileState : State<LottieTile> |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new Card( |
|||
color: widget.backgroundColor, |
|||
child: new InkWell( |
|||
onTap: () => { }, |
|||
child: new Center( |
|||
child: new Padding( |
|||
padding: EdgeInsets.all(4), |
|||
child: new Lottie(widget.path, size: new Size(100, 100)) |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4b528d0713eb470881072361372fa123 |
|||
timeCreated: 1626845939 |
|
|||
fileFormatVersion: 2 |
|||
guid: cf193666e135441881359df6531ecc41 |
|||
timeCreated: 1626750920 |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
|
|||
public interface RenderSliverVariableSizeBoxChildManager |
|||
{ |
|||
void createChild(int index); |
|||
|
|||
void removeChild(RenderBox child); |
|||
|
|||
float estimateMaxScrollOffset( |
|||
SliverConstraints constraints, |
|||
int? firstIndex = null, |
|||
int? lastIndex = null, |
|||
float? leadingScrollOffset = null, |
|||
float? trailingScrollOffset = null |
|||
); |
|||
|
|||
int childCount { get; } |
|||
|
|||
void didAdoptChild(RenderBox child); |
|||
|
|||
// ignore: avoid_positional_boolean_parameters
|
|||
void setDidUnderflow(bool value); |
|||
|
|||
void didStartLayout(); |
|||
|
|||
void didFinishLayout(); |
|||
|
|||
bool debugAssertChildListLocked(); |
|||
} |
|||
|
|||
public class SliverVariableSizeBoxAdaptorParentData : SliverMultiBoxAdaptorParentData |
|||
{ |
|||
public float crossAxisOffset; |
|||
|
|||
internal bool _keptAlive = false; |
|||
|
|||
public override string ToString() => $"crossAxisOffset={crossAxisOffset}; {base.ToString()}"; |
|||
} |
|||
|
|||
public abstract class RenderSliverVariableSizeBoxAdaptor : TileContainerRenderObjectMixinRenderSliver<RenderBox, |
|||
SliverVariableSizeBoxAdaptorParentData> |
|||
{ |
|||
public RenderSliverVariableSizeBoxAdaptor(RenderSliverVariableSizeBoxChildManager childManager) |
|||
{ |
|||
_childManager = childManager; |
|||
} |
|||
|
|||
public override void setupParentData(RenderObject child) |
|||
{ |
|||
if (!(child.parentData is SliverVariableSizeBoxAdaptorParentData)) |
|||
{ |
|||
child.parentData = new SliverVariableSizeBoxAdaptorParentData(); |
|||
} |
|||
} |
|||
|
|||
protected RenderSliverVariableSizeBoxChildManager childManager |
|||
{ |
|||
get => _childManager; |
|||
} |
|||
|
|||
public readonly RenderSliverVariableSizeBoxChildManager _childManager; |
|||
|
|||
public readonly Dictionary<int, RenderBox> _keepAliveBucket = new Dictionary<int, RenderBox>(); |
|||
|
|||
protected override void adoptChild(AbstractNodeMixinDiagnosticableTree childNode) |
|||
{ |
|||
var child = childNode as RenderObject; |
|||
base.adoptChild(child); |
|||
var childParentData = |
|||
child?.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
if (childParentData?.keepAlive != null && (bool) !childParentData?.keepAlive) |
|||
{ |
|||
childManager.didAdoptChild(child as RenderBox); |
|||
} |
|||
} |
|||
|
|||
bool _debugAssertChildListLocked() => |
|||
childManager.debugAssertChildListLocked(); |
|||
|
|||
public override void remove(int index) |
|||
{ |
|||
RenderBox child = this[index]; |
|||
|
|||
// if child is null, it means this element was cached - drop the cached element
|
|||
if (child == null) |
|||
{ |
|||
RenderBox cachedChild = _keepAliveBucket[index]; |
|||
if (cachedChild != null) |
|||
{ |
|||
dropChild(cachedChild); |
|||
_keepAliveBucket.Remove(index); |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
if (childParentData?._keptAlive != null && (bool) !childParentData?._keptAlive) |
|||
{ |
|||
base.remove(index); |
|||
return; |
|||
} |
|||
|
|||
D.assert(childParentData != null && |
|||
(childParentData.index != null && (_keepAliveBucket[childParentData.index] == child))); |
|||
_keepAliveBucket.Remove(childParentData.index); |
|||
dropChild(child); |
|||
} |
|||
|
|||
public override void removeAll() |
|||
{ |
|||
base.removeAll(); |
|||
_keepAliveBucket.Values.ToList().ForEach(dropChild); |
|||
_keepAliveBucket.Clear(); |
|||
} |
|||
|
|||
void _createOrObtainChild(int index) |
|||
{ |
|||
invokeLayoutCallback<SliverConstraints>((SliverConstraints constraints) => |
|||
{ |
|||
D.assert(constraints == this.constraints); |
|||
if (_keepAliveBucket.ContainsKey(index)) |
|||
{ |
|||
RenderBox child = _keepAliveBucket[index]; |
|||
_keepAliveBucket.Remove(index); |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
D.assert(childParentData._keptAlive); |
|||
dropChild(child); |
|||
child.parentData = childParentData; |
|||
this[index] = child; |
|||
childParentData._keptAlive = false; |
|||
} |
|||
else |
|||
{ |
|||
_childManager.createChild(index); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
void _destroyOrCacheChild(int index) |
|||
{ |
|||
RenderBox child = this[index]; |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
if (childParentData.keepAlive) |
|||
{ |
|||
D.assert(!childParentData._keptAlive); |
|||
remove(index); |
|||
_keepAliveBucket[childParentData.index] = child; |
|||
child.parentData = childParentData; |
|||
base.adoptChild(child); |
|||
childParentData._keptAlive = true; |
|||
} |
|||
else |
|||
{ |
|||
D.assert(child.parent == this); |
|||
_childManager.removeChild(child); |
|||
D.assert(child.parent == null); |
|||
} |
|||
} |
|||
|
|||
public override void attach(object o) |
|||
{ |
|||
if (o is PipelineOwner ownerIn) |
|||
{ |
|||
base.attach(ownerIn); |
|||
_keepAliveBucket.Values.ToList().ForEach((child) => child.attach(ownerIn)); |
|||
} |
|||
} |
|||
|
|||
public override void detach() |
|||
{ |
|||
base.detach(); |
|||
_keepAliveBucket.Values.ToList().ForEach((child) => child.detach()); |
|||
} |
|||
|
|||
public override void redepthChildren() |
|||
{ |
|||
base.redepthChildren(); |
|||
_keepAliveBucket.Values.ToList().ForEach(redepthChild); |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) |
|||
{ |
|||
base.visitChildren(visitor); |
|||
_keepAliveBucket.Values.ToList().ForEach(a => visitor(a)); |
|||
} |
|||
|
|||
public bool addChild(int index) |
|||
{ |
|||
D.assert(_debugAssertChildListLocked()); |
|||
_createOrObtainChild(index); |
|||
var child = this[index]; |
|||
if (child != null) |
|||
{ |
|||
D.assert(indexOf(child) == index); |
|||
return true; |
|||
} |
|||
|
|||
childManager.setDidUnderflow(true); |
|||
return false; |
|||
} |
|||
|
|||
public RenderBox addAndLayoutChild( |
|||
int index, |
|||
BoxConstraints childConstraints, |
|||
bool parentUsesSize = false |
|||
) |
|||
{ |
|||
D.assert(_debugAssertChildListLocked()); |
|||
_createOrObtainChild(index); |
|||
var child = this[index]; |
|||
if (child != null) |
|||
{ |
|||
D.assert(indexOf(child) == index); |
|||
child.layout(childConstraints, parentUsesSize: parentUsesSize); |
|||
return child; |
|||
} |
|||
|
|||
childManager.setDidUnderflow(true); |
|||
return null; |
|||
} |
|||
|
|||
protected void collectGarbage(HashSet<int> visibleIndices) |
|||
{ |
|||
D.assert(_debugAssertChildListLocked()); |
|||
D.assert(childCount >= visibleIndices.Count); |
|||
invokeLayoutCallback<SliverConstraints>((SliverConstraints constraints) => |
|||
{ |
|||
// We destroy only those which are not visible.
|
|||
indices.Except(visibleIndices).ToList().ForEach(_destroyOrCacheChild); |
|||
|
|||
// Ask the child manager to remove the children that are no longer being
|
|||
// kept alive. (This should cause _keepAliveBucket to change, so we have
|
|||
// to prepare our list ahead of time.)
|
|||
_keepAliveBucket.Values |
|||
.Where((RenderBox child) => |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
return childParentData != null && !childParentData.keepAlive; |
|||
}) |
|||
.ToList() |
|||
.ForEach(_childManager.removeChild); |
|||
D.assert(!_keepAliveBucket.Values.Where((RenderBox child) => |
|||
{ |
|||
return child.parentData is SliverVariableSizeBoxAdaptorParentData childParentData && |
|||
!childParentData.keepAlive; |
|||
}).Any()); |
|||
}); |
|||
} |
|||
|
|||
public int indexOf(RenderBox child) |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
D.assert(childParentData?.index != null); |
|||
return childParentData.index; |
|||
} |
|||
|
|||
protected float paintExtentOf(RenderBox child) |
|||
{ |
|||
D.assert(child.hasSize); |
|||
switch (constraints.axis) |
|||
{ |
|||
case Axis.horizontal: |
|||
return child.size.width; |
|||
case Axis.vertical: |
|||
return child.size.height; |
|||
default: |
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
protected override bool hitTestChildren(SliverHitTestResult result, |
|||
float mainAxisPosition, float crossAxisPosition) |
|||
{ |
|||
foreach (var child in children) |
|||
{ |
|||
if (this.hitTestBoxChild( |
|||
new BoxHitTestResult(result), |
|||
child, |
|||
mainAxisPosition: mainAxisPosition, |
|||
crossAxisPosition: crossAxisPosition) |
|||
) |
|||
{ |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override float? childMainAxisPosition(RenderObject child) |
|||
{ |
|||
return childScrollOffset(child) - constraints.scrollOffset; |
|||
} |
|||
|
|||
public override float? childCrossAxisPosition(RenderObject child) |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
return childParentData.crossAxisOffset; |
|||
} |
|||
|
|||
public override float? childScrollOffset(RenderObject child) |
|||
{ |
|||
D.assert(child.parent == this); |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
D.assert(childParentData != null && childParentData.layoutOffset != null); |
|||
return childParentData.layoutOffset; |
|||
} |
|||
|
|||
public override void applyPaintTransform(RenderObject child, Matrix4 transform) |
|||
{ |
|||
this.applyPaintTransformForBoxChild(child as RenderBox, transform); |
|||
} |
|||
|
|||
public override void paint(PaintingContext context, Offset offset) |
|||
{ |
|||
if (childCount == 0) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
// offset is to the top-left corner, regardless of our axis direction.
|
|||
// originOffset gives us the delta from the real origin to the origin in the axis direction.
|
|||
Offset mainAxisUnit = new Offset(0, 0); |
|||
Offset crossAxisUnit = new Offset(0, 0); |
|||
Offset originOffset = new Offset(0, 0); |
|||
bool? addExtent = null; |
|||
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection( |
|||
constraints.axisDirection, constraints.growthDirection)) |
|||
{ |
|||
case AxisDirection.up: |
|||
mainAxisUnit = new Offset(0, -1); |
|||
crossAxisUnit = new Offset(1, 0); |
|||
originOffset = offset + new Offset(0, geometry.paintExtent); |
|||
addExtent = true; |
|||
break; |
|||
case AxisDirection.right: |
|||
mainAxisUnit = new Offset(1, 0); |
|||
crossAxisUnit = new Offset(0, 1); |
|||
originOffset = offset; |
|||
addExtent = false; |
|||
break; |
|||
case AxisDirection.down: |
|||
mainAxisUnit = new Offset(0, 1); |
|||
crossAxisUnit = new Offset(1, 0); |
|||
originOffset = offset; |
|||
addExtent = false; |
|||
break; |
|||
case AxisDirection.left: |
|||
mainAxisUnit = new Offset(-1, 0); |
|||
crossAxisUnit = new Offset(0, 1); |
|||
originOffset = offset + new Offset(geometry.paintExtent, 0); |
|||
addExtent = true; |
|||
break; |
|||
} |
|||
|
|||
foreach (var child in children) |
|||
{ |
|||
float? mainAxisDelta = childMainAxisPosition(child); |
|||
float? crossAxisDelta = childCrossAxisPosition(child); |
|||
Offset childOffset = new Offset( |
|||
(float) (originOffset.dx + |
|||
mainAxisUnit.dx * mainAxisDelta + |
|||
crossAxisUnit.dx * crossAxisDelta), |
|||
(float) (originOffset.dy + |
|||
mainAxisUnit.dy * mainAxisDelta + |
|||
crossAxisUnit.dy * crossAxisDelta) |
|||
); |
|||
if (addExtent.Value) |
|||
{ |
|||
childOffset += mainAxisUnit * paintExtentOf(child); |
|||
} |
|||
|
|||
context.paintChild(child, childOffset); |
|||
} |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) |
|||
{ |
|||
base.debugFillProperties(properties); |
|||
properties.add(DiagnosticsNode.message(childCount > 0 |
|||
? $"currently live children: ${string.Join(", ", indices)}" |
|||
: "no children current live")); |
|||
} |
|||
|
|||
public override List<DiagnosticsNode> debugDescribeChildren() |
|||
{ |
|||
List<DiagnosticsNode> |
|||
childList = new List<DiagnosticsNode>(); |
|||
if (childCount > 0) |
|||
{ |
|||
foreach (var child in |
|||
children) |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
childList.Add(child.toDiagnosticsNode( |
|||
name: $"child with index {childParentData.index}")); |
|||
} |
|||
} |
|||
|
|||
if (_keepAliveBucket.isNotEmpty()) |
|||
{ |
|||
List<int> indices = _keepAliveBucket.Keys.ToList(); |
|||
indices.Sort(); |
|||
foreach (var index in indices) |
|||
{ |
|||
childList.Add(_keepAliveBucket[index].toDiagnosticsNode( |
|||
name: $"child with index {index} (kept alive offstage)", |
|||
style: DiagnosticsTreeStyle.offstage |
|||
)); |
|||
} |
|||
} |
|||
|
|||
return childList; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 274a2fe33c69454ea4202770796e123d |
|||
timeCreated: 1626667380 |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.external; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
|
|||
public static class GridUtil |
|||
{ |
|||
public delegate StaggeredTile IndexedStaggeredTileBuilder(int index); |
|||
|
|||
internal const float _epsilon = 0.0001f; |
|||
|
|||
internal static bool _nearEqual(float d1, float d2) |
|||
{ |
|||
return (d1 - d2).abs() < _epsilon; |
|||
} |
|||
} |
|||
|
|||
public class StaggeredGridConfiguration |
|||
{ |
|||
public StaggeredGridConfiguration( |
|||
int crossAxisCount, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
float cellExtent, |
|||
float mainAxisSpacing, |
|||
float crossAxisSpacing, |
|||
bool reverseCrossAxis, |
|||
int? staggeredTileCount, |
|||
int mainAxisOffsetsCacheSize = 3 |
|||
) |
|||
{ |
|||
D.assert(crossAxisCount > 0); |
|||
D.assert(cellExtent >= 0); |
|||
D.assert(mainAxisSpacing >= 0); |
|||
D.assert(crossAxisSpacing >= 0); |
|||
D.assert(mainAxisOffsetsCacheSize > 0); |
|||
this.crossAxisCount = crossAxisCount; |
|||
this.staggeredTileBuilder = staggeredTileBuilder; |
|||
this.cellExtent = cellExtent; |
|||
this.mainAxisSpacing = mainAxisSpacing; |
|||
this.crossAxisSpacing = crossAxisSpacing; |
|||
this.reverseCrossAxis = reverseCrossAxis; |
|||
this.staggeredTileCount = staggeredTileCount; |
|||
this.mainAxisOffsetsCacheSize = mainAxisOffsetsCacheSize; |
|||
cellStride = cellExtent + crossAxisSpacing; |
|||
} |
|||
|
|||
public readonly int crossAxisCount; |
|||
|
|||
public readonly float cellExtent; |
|||
|
|||
public readonly float mainAxisSpacing; |
|||
|
|||
public readonly float crossAxisSpacing; |
|||
|
|||
public readonly GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder; |
|||
|
|||
public readonly int? staggeredTileCount; |
|||
|
|||
public readonly bool reverseCrossAxis; |
|||
|
|||
public readonly float cellStride; |
|||
|
|||
public readonly int mainAxisOffsetsCacheSize; |
|||
|
|||
public List<float> generateMainAxisOffsets() |
|||
{ |
|||
return Enumerable.Repeat(0.0f, crossAxisCount).ToList(); |
|||
} |
|||
|
|||
public StaggeredTile getStaggeredTile(int index) |
|||
{ |
|||
StaggeredTile tile = null; |
|||
if (staggeredTileCount == null || index < staggeredTileCount) |
|||
{ |
|||
// There is maybe a tile for this index.
|
|||
tile = _normalizeStaggeredTile(staggeredTileBuilder(index)); |
|||
} |
|||
|
|||
return tile; |
|||
} |
|||
|
|||
float _getStaggeredTileMainAxisExtent(StaggeredTile tile) |
|||
{ |
|||
if (tile.mainAxisCellCount != null) |
|||
{ |
|||
return (float) (tile.mainAxisExtent ?? |
|||
(tile.mainAxisCellCount * cellExtent) + |
|||
(tile.mainAxisCellCount - 1) * mainAxisSpacing); |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
StaggeredTile _normalizeStaggeredTile(StaggeredTile staggeredTile) |
|||
{ |
|||
if (staggeredTile == null) |
|||
{ |
|||
return null; |
|||
} |
|||
else |
|||
{ |
|||
var crossAxisCellCount = |
|||
staggeredTile.crossAxisCellCount.clamp(0, crossAxisCount); |
|||
if (staggeredTile.fitContent) |
|||
{ |
|||
return StaggeredTile.fit(crossAxisCellCount); |
|||
} |
|||
else |
|||
{ |
|||
return StaggeredTile.extent( |
|||
crossAxisCellCount, _getStaggeredTileMainAxisExtent(staggeredTile)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
internal class _Block |
|||
{ |
|||
internal _Block( |
|||
int index, |
|||
int crossAxisCount, |
|||
float minOffset, |
|||
float maxOffset |
|||
) |
|||
{ |
|||
this.index = index; |
|||
this.crossAxisCount = crossAxisCount; |
|||
this.minOffset = minOffset; |
|||
this.maxOffset = maxOffset; |
|||
} |
|||
|
|||
public readonly int index; |
|||
public readonly int crossAxisCount; |
|||
public readonly float minOffset; |
|||
public readonly float maxOffset; |
|||
} |
|||
|
|||
public class SliverStaggeredGridGeometry |
|||
{ |
|||
public SliverStaggeredGridGeometry( |
|||
float scrollOffset, |
|||
float crossAxisOffset, |
|||
float? mainAxisExtent, |
|||
float crossAxisExtent, |
|||
int crossAxisCellCount, |
|||
int blockIndex |
|||
) |
|||
{ |
|||
this.scrollOffset = scrollOffset; |
|||
this.crossAxisOffset = crossAxisOffset; |
|||
this.mainAxisExtent = mainAxisExtent; |
|||
this.crossAxisExtent = crossAxisExtent; |
|||
this.crossAxisCellCount = crossAxisCellCount; |
|||
this.blockIndex = blockIndex; |
|||
} |
|||
|
|||
public readonly float scrollOffset; |
|||
|
|||
public readonly float crossAxisOffset; |
|||
|
|||
public readonly float? mainAxisExtent; |
|||
|
|||
public readonly float crossAxisExtent; |
|||
|
|||
public readonly int crossAxisCellCount; |
|||
|
|||
public readonly int blockIndex; |
|||
|
|||
public bool hasTrailingScrollOffset |
|||
{ |
|||
get { return mainAxisExtent != null; } |
|||
} |
|||
|
|||
public float trailingScrollOffset |
|||
{ |
|||
get { return scrollOffset + (mainAxisExtent ?? 0); } |
|||
} |
|||
|
|||
public SliverStaggeredGridGeometry copyWith( |
|||
float? scrollOffset = null, |
|||
float? crossAxisOffset = null, |
|||
float? mainAxisExtent = null, |
|||
float? crossAxisExtent = null, |
|||
int? crossAxisCellCount = null, |
|||
int? blockIndex = null |
|||
) |
|||
{ |
|||
return new SliverStaggeredGridGeometry( |
|||
scrollOffset: scrollOffset ?? this.scrollOffset, |
|||
crossAxisOffset: crossAxisOffset ?? this.crossAxisOffset, |
|||
mainAxisExtent: mainAxisExtent ?? this.mainAxisExtent, |
|||
crossAxisExtent: crossAxisExtent ?? this.crossAxisExtent, |
|||
crossAxisCellCount: crossAxisCellCount ?? this.crossAxisCellCount, |
|||
blockIndex: blockIndex ?? this.blockIndex |
|||
); |
|||
} |
|||
|
|||
public BoxConstraints getBoxConstraints(SliverConstraints constraints) |
|||
{ |
|||
return constraints.asBoxConstraints( |
|||
minExtent: mainAxisExtent ?? 0.0f, |
|||
maxExtent: mainAxisExtent ?? float.PositiveInfinity, |
|||
crossAxisExtent: crossAxisExtent |
|||
); |
|||
} |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return "SliverStaggeredGridGeometry(" + |
|||
$"scrollOffset: {scrollOffset}, " + |
|||
$"crossAxisOffset: {crossAxisOffset}, " + |
|||
$"mainAxisExtent: {mainAxisExtent}, " + |
|||
$"crossAxisExtent: {crossAxisExtent}, " + |
|||
$"crossAxisCellCount: {crossAxisCellCount}, " + |
|||
$"startIndex: {blockIndex})"; |
|||
} |
|||
} |
|||
|
|||
public class RenderSliverStaggeredGrid : RenderSliverVariableSizeBoxAdaptor |
|||
{ |
|||
public RenderSliverStaggeredGrid( |
|||
RenderSliverVariableSizeBoxChildManager childManager, |
|||
SliverStaggeredGridDelegate gridDelegate |
|||
) : base(childManager: childManager) |
|||
{ |
|||
_gridDelegate = gridDelegate; |
|||
_pageSizeToViewportOffsets = new Dictionary<int, SplayTree<int, _ViewportOffsets>>(); |
|||
} |
|||
|
|||
public override void setupParentData(RenderObject child) |
|||
{ |
|||
if (!(child.parentData is SliverVariableSizeBoxAdaptorParentData)) |
|||
{ |
|||
var data = new SliverVariableSizeBoxAdaptorParentData(); |
|||
|
|||
// By default we will keep it true.
|
|||
//data.keepAlive = true;
|
|||
child.parentData = data; |
|||
} |
|||
} |
|||
|
|||
public SliverStaggeredGridDelegate gridDelegate |
|||
{ |
|||
get { return _gridDelegate; } |
|||
set |
|||
{ |
|||
if (_gridDelegate == value) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
if (value.GetType() != _gridDelegate.GetType() || |
|||
value.shouldRelayout(_gridDelegate)) |
|||
{ |
|||
markNeedsLayout(); |
|||
} |
|||
|
|||
_gridDelegate = value; |
|||
} |
|||
} |
|||
|
|||
SliverStaggeredGridDelegate _gridDelegate; |
|||
|
|||
// modified by siyao for uiwidgets
|
|||
readonly Dictionary<int, SplayTree<int, _ViewportOffsets>> _pageSizeToViewportOffsets; |
|||
|
|||
protected override void performLayout() |
|||
{ |
|||
childManager.didStartLayout(); |
|||
childManager.setDidUnderflow(false); |
|||
|
|||
float scrollOffset = |
|||
constraints.scrollOffset + constraints.cacheOrigin; |
|||
D.assert(scrollOffset >= 0.0); |
|||
float remainingExtent = constraints.remainingCacheExtent; |
|||
D.assert(remainingExtent >= 0.0); |
|||
float targetEndScrollOffset = scrollOffset + remainingExtent; |
|||
|
|||
bool reachedEnd = false; |
|||
float trailingScrollOffset = 0; |
|||
float leadingScrollOffset = float.PositiveInfinity; |
|||
bool visible = false; |
|||
int firstIndex = 0; |
|||
int lastIndex = 0; |
|||
|
|||
var configuration = _gridDelegate.getConfiguration(constraints); |
|||
|
|||
var pageSize = configuration.mainAxisOffsetsCacheSize * |
|||
constraints.viewportMainAxisExtent; |
|||
if (pageSize == 0.0f) |
|||
{ |
|||
geometry = SliverGeometry.zero; |
|||
childManager.didFinishLayout(); |
|||
return; |
|||
} |
|||
|
|||
var pageIndex = (int) (scrollOffset / pageSize); |
|||
D.assert(pageIndex >= 0); |
|||
|
|||
// modified by siyao for uiwidgets
|
|||
var viewportOffsets = _pageSizeToViewportOffsets.putIfAbsent( |
|||
configuration.crossAxisCount, () => new SplayTree<int, _ViewportOffsets>()); |
|||
|
|||
_ViewportOffsets viewportOffset; |
|||
if (viewportOffsets.isEmpty()) |
|||
{ |
|||
viewportOffset = |
|||
new _ViewportOffsets(configuration.generateMainAxisOffsets(), pageSize); |
|||
viewportOffsets[0] = viewportOffset; |
|||
} |
|||
else |
|||
{ |
|||
var smallestKey = viewportOffsets.lastKeyBefore(pageIndex + 1); |
|||
viewportOffset = viewportOffsets[smallestKey]; |
|||
} |
|||
|
|||
// A staggered grid always have to layout the child from the zero-index based one to the last visible.
|
|||
var mainAxisOffsets = viewportOffset.mainAxisOffsets.ToList(); |
|||
var visibleIndices = new HashSet<int>(); |
|||
|
|||
// Iterate through all children while they can be visible.
|
|||
for (var index = viewportOffset.firstChildIndex; |
|||
mainAxisOffsets.Any((o) => o <= targetEndScrollOffset); |
|||
index++) |
|||
{ |
|||
SliverStaggeredGridGeometry geometry = |
|||
getSliverStaggeredGeometry(index, configuration, mainAxisOffsets); |
|||
if (geometry == null) |
|||
{ |
|||
// There are either no children, or we are past the end of all our children.
|
|||
reachedEnd = true; |
|||
break; |
|||
} |
|||
|
|||
bool hasTrailingScrollOffset = geometry.hasTrailingScrollOffset; |
|||
RenderBox child = null; |
|||
if (!hasTrailingScrollOffset) |
|||
{ |
|||
// Layout the child to compute its tailingScrollOffset.
|
|||
var constraints = |
|||
BoxConstraints.tightFor(width: geometry.crossAxisExtent); |
|||
child = addAndLayoutChild(index, constraints, parentUsesSize: true); |
|||
geometry = geometry.copyWith(mainAxisExtent: paintExtentOf(child)); |
|||
} |
|||
|
|||
if (!visible && |
|||
targetEndScrollOffset >= geometry.scrollOffset && |
|||
scrollOffset <= geometry.trailingScrollOffset) |
|||
{ |
|||
visible = true; |
|||
leadingScrollOffset = geometry.scrollOffset; |
|||
firstIndex = index; |
|||
} |
|||
|
|||
if (visible && hasTrailingScrollOffset) |
|||
{ |
|||
child = |
|||
addAndLayoutChild(index, geometry.getBoxConstraints(constraints)); |
|||
} |
|||
|
|||
if (child != null) |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
childParentData.layoutOffset = geometry.scrollOffset; |
|||
childParentData.crossAxisOffset = geometry.crossAxisOffset; |
|||
D.assert(childParentData.index == index); |
|||
} |
|||
|
|||
if (visible && indices.Contains(index)) |
|||
{ |
|||
visibleIndices.Add(index); |
|||
} |
|||
|
|||
if (geometry.trailingScrollOffset >= |
|||
viewportOffset?.trailingScrollOffset) |
|||
{ |
|||
var nextPageIndex = viewportOffset.pageIndex + 1; |
|||
var nextViewportOffset = new _ViewportOffsets( |
|||
mainAxisOffsets, |
|||
(nextPageIndex + 1) * pageSize, |
|||
nextPageIndex, |
|||
index |
|||
); |
|||
viewportOffsets[nextPageIndex] = nextViewportOffset; |
|||
viewportOffset = nextViewportOffset; |
|||
} |
|||
|
|||
float endOffset = |
|||
geometry.trailingScrollOffset + configuration.mainAxisSpacing; |
|||
for (var i = 0; i < geometry.crossAxisCellCount; i++) |
|||
{ |
|||
mainAxisOffsets[i + geometry.blockIndex] = endOffset; |
|||
} |
|||
|
|||
trailingScrollOffset = mainAxisOffsets.Aggregate((acc, x) => acc + x); |
|||
lastIndex = index; |
|||
} |
|||
|
|||
collectGarbage(visibleIndices); |
|||
|
|||
if (!visible) |
|||
{ |
|||
if (scrollOffset > viewportOffset.trailingScrollOffset) |
|||
{ |
|||
// We are outside the bounds, we have to correct the scroll.
|
|||
var viewportOffsetScrollOffset = pageSize * viewportOffset.pageIndex; |
|||
var correction = viewportOffsetScrollOffset - scrollOffset; |
|||
geometry = new SliverGeometry( |
|||
scrollOffsetCorrection: correction |
|||
); |
|||
} |
|||
else |
|||
{ |
|||
geometry = SliverGeometry.zero; |
|||
childManager.didFinishLayout(); |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
float estimatedMaxScrollOffset; |
|||
if (reachedEnd) |
|||
{ |
|||
estimatedMaxScrollOffset = trailingScrollOffset; |
|||
} |
|||
else |
|||
{ |
|||
estimatedMaxScrollOffset = childManager.estimateMaxScrollOffset( |
|||
constraints, |
|||
firstIndex: firstIndex, |
|||
lastIndex: lastIndex, |
|||
leadingScrollOffset: leadingScrollOffset, |
|||
trailingScrollOffset: trailingScrollOffset |
|||
); |
|||
D.assert(estimatedMaxScrollOffset >= |
|||
trailingScrollOffset - leadingScrollOffset); |
|||
} |
|||
|
|||
float paintExtent = calculatePaintOffset( |
|||
constraints, |
|||
from: leadingScrollOffset, |
|||
to: trailingScrollOffset |
|||
); |
|||
float cacheExtent = calculateCacheOffset( |
|||
constraints, |
|||
from: leadingScrollOffset, |
|||
to: trailingScrollOffset |
|||
); |
|||
|
|||
geometry = new SliverGeometry( |
|||
scrollExtent: estimatedMaxScrollOffset, |
|||
paintExtent: paintExtent, |
|||
cacheExtent: cacheExtent, |
|||
maxPaintExtent: estimatedMaxScrollOffset, |
|||
// Conservative to avoid flickering away the clip during scroll.
|
|||
hasVisualOverflow: trailingScrollOffset > targetEndScrollOffset || |
|||
constraints.scrollOffset > 0.0f |
|||
); |
|||
|
|||
// We may have started the layout while scrolled to the end, which would not
|
|||
// expose a child.
|
|||
if (estimatedMaxScrollOffset == trailingScrollOffset) |
|||
{ |
|||
childManager.setDidUnderflow(true); |
|||
} |
|||
|
|||
childManager.didFinishLayout(); |
|||
} |
|||
|
|||
static SliverStaggeredGridGeometry getSliverStaggeredGeometry(int index, |
|||
StaggeredGridConfiguration configuration, List<float> offsets) |
|||
{ |
|||
var tile = configuration.getStaggeredTile(index); |
|||
if (tile == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
var block = _findFirstAvailableBlockWithCrossAxisCount( |
|||
tile.crossAxisCellCount, offsets); |
|||
|
|||
var scrollOffset = block.minOffset; |
|||
var blockIndex = block.index; |
|||
if (configuration.reverseCrossAxis) |
|||
{ |
|||
blockIndex = |
|||
configuration.crossAxisCount - tile.crossAxisCellCount - blockIndex; |
|||
} |
|||
|
|||
var crossAxisOffset = blockIndex * configuration.cellStride; |
|||
var geometry = new SliverStaggeredGridGeometry( |
|||
scrollOffset: scrollOffset, |
|||
crossAxisOffset: crossAxisOffset, |
|||
mainAxisExtent: tile.mainAxisExtent, |
|||
crossAxisExtent: configuration.cellStride * tile.crossAxisCellCount - |
|||
configuration.crossAxisSpacing, |
|||
crossAxisCellCount: tile.crossAxisCellCount, |
|||
blockIndex: block.index |
|||
); |
|||
return geometry; |
|||
} |
|||
|
|||
static _Block _findFirstAvailableBlockWithCrossAxisCount( |
|||
int crossAxisCount, List<float> offsets) |
|||
{ |
|||
return _findFirstAvailableBlockWithCrossAxisCountAndOffsets( |
|||
crossAxisCount, new List<float>(offsets)); |
|||
} |
|||
|
|||
static _Block _findFirstAvailableBlockWithCrossAxisCountAndOffsets( |
|||
int crossAxisCount, List<float> offsets) |
|||
{ |
|||
var block = _findFirstAvailableBlock(offsets); |
|||
if (block.crossAxisCount < crossAxisCount) |
|||
{ |
|||
// Not enough space for the specified cross axis count.
|
|||
// We have to fill this block and try again.
|
|||
for (var i = 0; i < block.crossAxisCount; ++i) |
|||
{ |
|||
offsets[i + block.index] = block.maxOffset; |
|||
} |
|||
|
|||
return _findFirstAvailableBlockWithCrossAxisCountAndOffsets( |
|||
crossAxisCount, offsets); |
|||
} |
|||
else |
|||
{ |
|||
return block; |
|||
} |
|||
} |
|||
|
|||
static _Block _findFirstAvailableBlock(List<float> offsets) |
|||
{ |
|||
int index = 0; |
|||
float minBlockOffset = float.PositiveInfinity; |
|||
float maxBlockOffset = float.PositiveInfinity; |
|||
int crossAxisCount = 1; |
|||
bool contiguous = false; |
|||
|
|||
// We have to use the GridUtil._nearEqual function because of floating-point arithmetic.
|
|||
// Ex: 0.1 + 0.2 = 0.30000000000000004 and not 0.3.
|
|||
|
|||
for (var i = index; i < offsets.Count; ++i) |
|||
{ |
|||
var offset = offsets[i]; |
|||
if (offset < minBlockOffset && !GridUtil._nearEqual(offset, minBlockOffset)) |
|||
{ |
|||
index = i; |
|||
maxBlockOffset = minBlockOffset; |
|||
minBlockOffset = offset; |
|||
crossAxisCount = 1; |
|||
contiguous = true; |
|||
} |
|||
else if (GridUtil._nearEqual(offset, minBlockOffset) && contiguous) |
|||
{ |
|||
crossAxisCount++; |
|||
} |
|||
else if (offset < maxBlockOffset && |
|||
offset > minBlockOffset && |
|||
!GridUtil._nearEqual(offset, minBlockOffset)) |
|||
{ |
|||
contiguous = false; |
|||
maxBlockOffset = offset; |
|||
} |
|||
else |
|||
{ |
|||
contiguous = false; |
|||
} |
|||
} |
|||
|
|||
return new _Block(index, crossAxisCount, minBlockOffset, maxBlockOffset); |
|||
} |
|||
} |
|||
|
|||
internal class _ViewportOffsets |
|||
{ |
|||
internal _ViewportOffsets( |
|||
List<float> mainAxisOffsets, |
|||
float trailingScrollOffset, |
|||
int pageIndex = 0, |
|||
int firstChildIndex = 0 |
|||
) |
|||
{ |
|||
this.trailingScrollOffset = trailingScrollOffset; |
|||
this.pageIndex = pageIndex; |
|||
this.firstChildIndex = firstChildIndex; |
|||
this.mainAxisOffsets = mainAxisOffsets.ToList(); |
|||
} |
|||
|
|||
public readonly int pageIndex; |
|||
|
|||
public readonly int firstChildIndex; |
|||
|
|||
public readonly float trailingScrollOffset; |
|||
|
|||
public readonly List<float> mainAxisOffsets; |
|||
|
|||
public override string ToString() => |
|||
$"[{pageIndex}-{trailingScrollOffset}] ({firstChildIndex}, {mainAxisOffsets})"; |
|||
} |
|||
|
|||
public abstract class SliverStaggeredGridDelegate |
|||
{ |
|||
public SliverStaggeredGridDelegate( |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder = null, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0, |
|||
int? staggeredTileCount = null |
|||
) |
|||
{ |
|||
D.assert(mainAxisSpacing >= 0); |
|||
D.assert(crossAxisSpacing >= 0); |
|||
this.staggeredTileBuilder = staggeredTileBuilder; |
|||
this.mainAxisSpacing = mainAxisSpacing; |
|||
this.crossAxisSpacing = crossAxisSpacing; |
|||
this.staggeredTileCount = staggeredTileCount; |
|||
} |
|||
|
|||
public readonly float mainAxisSpacing; |
|||
|
|||
public readonly float crossAxisSpacing; |
|||
|
|||
public readonly GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder; |
|||
|
|||
public readonly int? staggeredTileCount; |
|||
|
|||
public virtual bool _debugAssertIsValid() |
|||
{ |
|||
D.assert(mainAxisSpacing >= 0); |
|||
D.assert(crossAxisSpacing >= 0); |
|||
return true; |
|||
} |
|||
|
|||
public abstract StaggeredGridConfiguration getConfiguration(SliverConstraints constraints); |
|||
|
|||
public virtual bool shouldRelayout(SliverStaggeredGridDelegate oldDelegate) |
|||
{ |
|||
return oldDelegate.mainAxisSpacing != mainAxisSpacing || |
|||
oldDelegate.crossAxisSpacing != crossAxisSpacing || |
|||
oldDelegate.staggeredTileCount != staggeredTileCount || |
|||
oldDelegate.staggeredTileBuilder != staggeredTileBuilder; |
|||
} |
|||
} |
|||
|
|||
public class SliverStaggeredGridDelegateWithFixedCrossAxisCount : SliverStaggeredGridDelegate |
|||
{ |
|||
public SliverStaggeredGridDelegateWithFixedCrossAxisCount( |
|||
int crossAxisCount, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0, |
|||
int? staggeredTileCount = null |
|||
) : base( |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileCount: staggeredTileCount |
|||
) |
|||
{ |
|||
D.assert(crossAxisCount > 0); |
|||
this.crossAxisCount = crossAxisCount; |
|||
} |
|||
|
|||
public readonly int crossAxisCount; |
|||
|
|||
public override bool _debugAssertIsValid() |
|||
{ |
|||
D.assert(crossAxisCount > 0); |
|||
return base._debugAssertIsValid(); |
|||
} |
|||
|
|||
public override StaggeredGridConfiguration getConfiguration(SliverConstraints constraints) |
|||
{ |
|||
D.assert(_debugAssertIsValid()); |
|||
float usableCrossAxisExtent = |
|||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1); |
|||
float cellExtent = usableCrossAxisExtent / crossAxisCount; |
|||
return new StaggeredGridConfiguration( |
|||
crossAxisCount: crossAxisCount, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: staggeredTileCount, |
|||
cellExtent: cellExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
reverseCrossAxis: AxisUtils.axisDirectionIsReversed(constraints.crossAxisDirection) |
|||
); |
|||
} |
|||
|
|||
public override bool shouldRelayout(SliverStaggeredGridDelegate oldDelegate) |
|||
{ |
|||
return oldDelegate is SliverStaggeredGridDelegateWithFixedCrossAxisCount sliverOldDelegate |
|||
&& sliverOldDelegate.crossAxisCount != crossAxisCount || |
|||
base.shouldRelayout(oldDelegate); |
|||
} |
|||
} |
|||
|
|||
class SliverStaggeredGridDelegateWithMaxCrossAxisExtent : SliverStaggeredGridDelegate |
|||
{ |
|||
public SliverStaggeredGridDelegateWithMaxCrossAxisExtent( |
|||
float maxCrossAxisExtent, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0, |
|||
int? staggeredTileCount = null |
|||
) : base( |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileCount: staggeredTileCount |
|||
) |
|||
{ |
|||
D.assert(maxCrossAxisExtent > 0); |
|||
this.maxCrossAxisExtent = maxCrossAxisExtent; |
|||
} |
|||
|
|||
public float maxCrossAxisExtent; |
|||
|
|||
public override bool _debugAssertIsValid() |
|||
{ |
|||
D.assert(maxCrossAxisExtent >= 0); |
|||
return base._debugAssertIsValid(); |
|||
} |
|||
|
|||
public override StaggeredGridConfiguration getConfiguration(SliverConstraints constraints) |
|||
{ |
|||
D.assert(_debugAssertIsValid()); |
|||
int crossAxisCount = |
|||
((constraints.crossAxisExtent + crossAxisSpacing) / |
|||
(maxCrossAxisExtent + crossAxisSpacing)) |
|||
.ceil(); |
|||
|
|||
float usableCrossAxisExtent = |
|||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1); |
|||
|
|||
float cellExtent = usableCrossAxisExtent / crossAxisCount; |
|||
return new StaggeredGridConfiguration( |
|||
crossAxisCount: crossAxisCount, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: staggeredTileCount, |
|||
cellExtent: cellExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
reverseCrossAxis: AxisUtils.axisDirectionIsReversed(constraints.crossAxisDirection) |
|||
); |
|||
} |
|||
|
|||
public override bool shouldRelayout(SliverStaggeredGridDelegate oldDelegate) |
|||
{ |
|||
return oldDelegate is SliverStaggeredGridDelegateWithMaxCrossAxisExtent delegateWithMaxCross && |
|||
delegateWithMaxCross.maxCrossAxisExtent != maxCrossAxisExtent || |
|||
base.shouldRelayout(oldDelegate); |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.external; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
public abstract class SliverVariableSizeBoxAdaptorWidget : SliverWithKeepAliveWidget |
|||
{ |
|||
public SliverVariableSizeBoxAdaptorWidget( |
|||
SliverChildDelegate Delegate, |
|||
Key key = null |
|||
) : base(key: key) |
|||
{ |
|||
this.Delegate = Delegate; |
|||
} |
|||
|
|||
public readonly SliverChildDelegate Delegate; |
|||
|
|||
public override Element createElement() |
|||
{ |
|||
return new SliverVariableSizeBoxAdaptorElement(this); |
|||
} |
|||
|
|||
public abstract override RenderObject createRenderObject(BuildContext context); |
|||
|
|||
public float? estimateMaxScrollOffset( |
|||
SliverConstraints constraints, |
|||
int firstIndex, |
|||
int lastIndex, |
|||
float leadingScrollOffset, |
|||
float trailingScrollOffset |
|||
) |
|||
{ |
|||
D.assert(lastIndex >= firstIndex); |
|||
return Delegate.estimateMaxScrollOffset( |
|||
firstIndex, |
|||
lastIndex, |
|||
leadingScrollOffset, |
|||
trailingScrollOffset |
|||
); |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) |
|||
{ |
|||
base.debugFillProperties(properties); |
|||
properties.add( |
|||
new DiagnosticsProperty<SliverChildDelegate>("delegate", Delegate) |
|||
); |
|||
} |
|||
} |
|||
|
|||
public class SliverVariableSizeBoxAdaptorElement : RenderObjectElement |
|||
, RenderSliverVariableSizeBoxChildManager |
|||
{ |
|||
public SliverVariableSizeBoxAdaptorElement(SliverVariableSizeBoxAdaptorWidget widget) |
|||
: base(widget) |
|||
{ |
|||
} |
|||
|
|||
public override RenderObjectWidget widget |
|||
{ |
|||
get { return base.widget as SliverVariableSizeBoxAdaptorWidget; } |
|||
} |
|||
|
|||
public override RenderObject renderObject |
|||
{ |
|||
get { return base.renderObject as RenderSliverVariableSizeBoxAdaptor; } |
|||
} |
|||
|
|||
public override void update(Widget newWidgetx) |
|||
{ |
|||
SliverVariableSizeBoxAdaptorWidget newWidget = newWidgetx as SliverVariableSizeBoxAdaptorWidget; |
|||
SliverVariableSizeBoxAdaptorWidget oldWidget = widget as SliverVariableSizeBoxAdaptorWidget; |
|||
base.update(newWidget); |
|||
SliverChildDelegate newDelegate = newWidget.Delegate; |
|||
SliverChildDelegate oldDelegate = oldWidget.Delegate; |
|||
if (newDelegate != oldDelegate && |
|||
(newDelegate.GetType() != oldDelegate.GetType() || |
|||
newDelegate.shouldRebuild(oldDelegate))) |
|||
{ |
|||
performRebuild(); |
|||
} |
|||
} |
|||
|
|||
// We inflate widgets at two different times:
|
|||
// 1. When we ourselves are told to rebuild (see performRebuild).
|
|||
// 2. When our render object needs a child (see createChild).
|
|||
// In both cases, we cache the results of calling into our delegate to get the widget,
|
|||
// so that if we do case 2 later, we don't call the builder again.
|
|||
// Any time we do case 1, though, we reset the cache.
|
|||
|
|||
private readonly Dictionary<int, Widget> _childWidgets = new Dictionary<int, Widget>(); |
|||
|
|||
readonly SplayTree<int, Element> _childElements = |
|||
new SplayTree<int, Element>(); |
|||
|
|||
protected override void performRebuild() |
|||
{ |
|||
_childWidgets.Clear(); // Reset the cache, as described above.
|
|||
base.performRebuild(); |
|||
D.assert(_currentlyUpdatingChildIndex == null); |
|||
try |
|||
{ |
|||
int firstIndex; |
|||
int lastIndex; |
|||
if (_childElements.isEmpty()) |
|||
{ |
|||
firstIndex = 0; |
|||
lastIndex = 0; |
|||
} |
|||
else if (_didUnderflow) |
|||
{ |
|||
firstIndex = _childElements.firstKey(); |
|||
lastIndex = _childElements.lastKey() + 1; |
|||
} |
|||
else |
|||
{ |
|||
firstIndex = _childElements.firstKey(); |
|||
lastIndex = _childElements.lastKey(); |
|||
} |
|||
|
|||
for (int index = firstIndex; index <= lastIndex; ++index) |
|||
{ |
|||
_currentlyUpdatingChildIndex = index; |
|||
Element newChild = |
|||
updateChild(_childElements[index], _build(index), index); |
|||
if (newChild != null) |
|||
{ |
|||
_childElements[index] = newChild; |
|||
} |
|||
else |
|||
{ |
|||
_childElements.Remove(index); |
|||
} |
|||
} |
|||
} |
|||
finally |
|||
{ |
|||
_currentlyUpdatingChildIndex = null; |
|||
} |
|||
} |
|||
|
|||
|
|||
Widget _build(int index) |
|||
{ |
|||
return _childWidgets.putIfAbsent( |
|||
index, () => ((SliverVariableSizeBoxAdaptorWidget) widget).Delegate.build(this, index)); |
|||
} |
|||
|
|||
public void createChild(int index) |
|||
{ |
|||
D.assert(_currentlyUpdatingChildIndex == null); |
|||
owner.buildScope(this, () => |
|||
{ |
|||
Element newChild; |
|||
try |
|||
{ |
|||
_currentlyUpdatingChildIndex = index; |
|||
newChild = updateChild(_childElements.getOrDefault(index, null), _build(index), index); |
|||
} |
|||
finally |
|||
{ |
|||
_currentlyUpdatingChildIndex = null; |
|||
} |
|||
|
|||
if (newChild != null) |
|||
{ |
|||
_childElements[index] = newChild; |
|||
} |
|||
else |
|||
{ |
|||
_childElements.Remove(index); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
protected override Element updateChild(Element child, Widget newWidget, object newSlot) |
|||
{ |
|||
Element newChild = base.updateChild(child, newWidget, newSlot); |
|||
var oldParentData = child?.renderObject?.parentData |
|||
as SliverVariableSizeBoxAdaptorParentData; |
|||
var newParentData = newChild?.renderObject?.parentData |
|||
as SliverVariableSizeBoxAdaptorParentData; |
|||
|
|||
// set keepAlive to true in order to populate the cache
|
|||
if (newParentData != null) |
|||
{ |
|||
newParentData.keepAlive = true; |
|||
} |
|||
|
|||
// Preserve the old layoutOffset if the renderObject was swapped out.
|
|||
if (oldParentData != newParentData && |
|||
oldParentData != null && |
|||
newParentData != null) |
|||
{ |
|||
newParentData.layoutOffset = oldParentData.layoutOffset; |
|||
} |
|||
|
|||
return newChild; |
|||
} |
|||
|
|||
public override void forgetChild(Element child) |
|||
{ |
|||
D.assert(child.slot != null); |
|||
D.assert(_childElements.ContainsKey((int) child.slot)); |
|||
_childElements.Remove((int) child.slot); |
|||
base.forgetChild(child); |
|||
} |
|||
|
|||
public void removeChild(RenderBox child) |
|||
{ |
|||
int index = ((RenderSliverVariableSizeBoxAdaptor) renderObject).indexOf(child); |
|||
D.assert(_currentlyUpdatingChildIndex == null); |
|||
D.assert(index >= 0); |
|||
owner.buildScope(this, () => |
|||
{ |
|||
D.assert(_childElements.ContainsKey(index)); |
|||
try |
|||
{ |
|||
_currentlyUpdatingChildIndex = index; |
|||
Element result = updateChild(_childElements[index], null, index); |
|||
D.assert(result == null); |
|||
} |
|||
finally |
|||
{ |
|||
_currentlyUpdatingChildIndex = null; |
|||
} |
|||
|
|||
_childElements.Remove(index); |
|||
D.assert(!_childElements.ContainsKey(index)); |
|||
}); |
|||
} |
|||
|
|||
float? _extrapolateMaxScrollOffset( |
|||
int? firstIndex, |
|||
int? lastIndex, |
|||
float? leadingScrollOffset, |
|||
float? trailingScrollOffset |
|||
) |
|||
{ |
|||
int? childCount = ((SliverVariableSizeBoxAdaptorWidget) widget).Delegate.estimatedChildCount; |
|||
if (childCount == null) |
|||
{ |
|||
return float.PositiveInfinity; |
|||
} |
|||
|
|||
if (lastIndex == childCount - 1) |
|||
{ |
|||
return trailingScrollOffset; |
|||
} |
|||
|
|||
int? reifiedCount = lastIndex - firstIndex + 1; |
|||
float? averageExtent = |
|||
(trailingScrollOffset - leadingScrollOffset) / reifiedCount; |
|||
int? remainingCount = childCount - lastIndex - 1; |
|||
return trailingScrollOffset + averageExtent * remainingCount; |
|||
} |
|||
|
|||
public float estimateMaxScrollOffset( |
|||
SliverConstraints constraints, |
|||
int? firstIndex = null, |
|||
int? lastIndex = null, |
|||
float? leadingScrollOffset = null, |
|||
float? trailingScrollOffset = null |
|||
) |
|||
{ |
|||
return ((SliverVariableSizeBoxAdaptorWidget) widget).estimateMaxScrollOffset( |
|||
constraints, |
|||
firstIndex.Value, |
|||
lastIndex.Value, |
|||
leadingScrollOffset.Value, |
|||
trailingScrollOffset.Value |
|||
) ?? |
|||
_extrapolateMaxScrollOffset( |
|||
firstIndex, |
|||
lastIndex, |
|||
leadingScrollOffset, |
|||
trailingScrollOffset |
|||
).Value; |
|||
} |
|||
|
|||
public int childCount |
|||
{ |
|||
get { return ((SliverVariableSizeBoxAdaptorWidget) widget).Delegate.estimatedChildCount ?? 0; } |
|||
} |
|||
|
|||
public void didStartLayout() |
|||
{ |
|||
D.assert(debugAssertChildListLocked()); |
|||
} |
|||
|
|||
public void didFinishLayout() |
|||
{ |
|||
D.assert(debugAssertChildListLocked()); |
|||
int firstIndex = _childElements.firstKey(); |
|||
int lastIndex = _childElements.lastKey(); |
|||
((SliverVariableSizeBoxAdaptorWidget) widget).Delegate.didFinishLayout(firstIndex, lastIndex); |
|||
} |
|||
|
|||
int? _currentlyUpdatingChildIndex; |
|||
|
|||
public bool debugAssertChildListLocked() |
|||
{ |
|||
D.assert(_currentlyUpdatingChildIndex == null); |
|||
return true; |
|||
} |
|||
|
|||
public void didAdoptChild(RenderBox child) |
|||
{ |
|||
D.assert(_currentlyUpdatingChildIndex != null); |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
childParentData.index = _currentlyUpdatingChildIndex.Value; |
|||
} |
|||
|
|||
bool _didUnderflow = false; |
|||
|
|||
public void setDidUnderflow(bool value) |
|||
{ |
|||
_didUnderflow = value; |
|||
} |
|||
|
|||
protected override void insertChildRenderObject(RenderObject childObject, object o) |
|||
{ |
|||
var child = childObject as RenderBox; |
|||
int slot = (int) o; |
|||
D.assert(_currentlyUpdatingChildIndex == slot); |
|||
D.assert(((RenderSliverVariableSizeBoxAdaptor) renderObject).debugValidateChild(child)); |
|||
((RenderSliverVariableSizeBoxAdaptor) renderObject)[_currentlyUpdatingChildIndex.Value] = child; |
|||
D.assert(() => |
|||
{ |
|||
var childParentData = |
|||
child.parentData as SliverVariableSizeBoxAdaptorParentData; |
|||
D.assert(slot == childParentData.index); |
|||
return true; |
|||
}); |
|||
} |
|||
|
|||
protected override void moveChildRenderObject(RenderObject child, object slot) |
|||
{ |
|||
D.assert(false); |
|||
} |
|||
|
|||
protected override void removeChildRenderObject(RenderObject child) |
|||
{ |
|||
D.assert(_currentlyUpdatingChildIndex != null); |
|||
((RenderSliverVariableSizeBoxAdaptor) renderObject).remove(_currentlyUpdatingChildIndex.Value); |
|||
} |
|||
|
|||
public override void visitChildren(ElementVisitor visitor) |
|||
{ |
|||
// The toList() is to make a copy so that the underlying list can be modified by
|
|||
// the visitor:
|
|||
_childElements.Values.ToList().ForEach(v => visitor(v)); |
|||
} |
|||
|
|||
public override void debugVisitOnstageChildren(ElementVisitor visitor) |
|||
{ |
|||
_childElements.Values.Where((Element child) => |
|||
{ |
|||
var parentData = |
|||
child.renderObject.parentData as SliverMultiBoxAdaptorParentData; |
|||
float itemExtent = 0; |
|||
SliverConstraints sliverConstraints = (SliverConstraints) renderObject.constraints; |
|||
switch (sliverConstraints.axis) |
|||
{ |
|||
case Axis.horizontal: |
|||
itemExtent = child.renderObject.paintBounds.width; |
|||
break; |
|||
case Axis.vertical: |
|||
itemExtent = child.renderObject.paintBounds.height; |
|||
break; |
|||
} |
|||
|
|||
return parentData.layoutOffset < |
|||
sliverConstraints.scrollOffset + |
|||
sliverConstraints.remainingPaintExtent && |
|||
parentData.layoutOffset + itemExtent > |
|||
sliverConstraints.scrollOffset; |
|||
}).ToList().ForEach(v => visitor(v)); |
|||
} |
|||
} |
|||
|
|||
public class SliverStaggeredGrid : SliverVariableSizeBoxAdaptorWidget |
|||
{ |
|||
public SliverStaggeredGrid( |
|||
SliverChildDelegate Delegate, |
|||
SliverStaggeredGridDelegate gridDelegate, |
|||
Key key = null |
|||
) : base(key: key, Delegate: Delegate) |
|||
{ |
|||
this.gridDelegate = gridDelegate; |
|||
} |
|||
|
|||
public static SliverStaggeredGrid count( |
|||
int crossAxisCount, |
|||
Key key = null, |
|||
float mainAxisSpacing = 0.0f, |
|||
float crossAxisSpacing = 0.0f, |
|||
List<Widget> children = null, |
|||
List<StaggeredTile> staggeredTiles = null |
|||
) |
|||
{ |
|||
staggeredTiles = staggeredTiles ?? new List<StaggeredTile>(); |
|||
children = children ?? new List<Widget>(); |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithFixedCrossAxisCount( |
|||
crossAxisCount: crossAxisCount, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: (i) => staggeredTiles[i], |
|||
staggeredTileCount: staggeredTiles.Count |
|||
); |
|||
return new SliverStaggeredGrid( |
|||
Delegate: new SliverChildListDelegate( |
|||
children |
|||
), |
|||
gridDelegate: gridDelegate, |
|||
key: key |
|||
); |
|||
} |
|||
|
|||
public static SliverStaggeredGrid countBuilder( |
|||
int crossAxisCount, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
IndexedWidgetBuilder itemBuilder, |
|||
int itemCount, |
|||
Key key = null, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0 |
|||
) |
|||
{ |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithFixedCrossAxisCount( |
|||
crossAxisCount: crossAxisCount, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: itemCount |
|||
); |
|||
|
|||
return new SliverStaggeredGrid( |
|||
Delegate: new SliverChildBuilderDelegate( |
|||
itemBuilder, |
|||
childCount: itemCount |
|||
), |
|||
gridDelegate: gridDelegate, |
|||
key: key |
|||
); |
|||
} |
|||
|
|||
public static SliverStaggeredGrid extent( |
|||
float maxCrossAxisExtent, |
|||
Key key = null, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0, |
|||
List<Widget> children = null, //const <Widget>[],
|
|||
List<StaggeredTile> staggeredTiles = null // = const <StaggeredTile>[],
|
|||
) |
|||
{ |
|||
children = new List<Widget>(); |
|||
staggeredTiles = new List<StaggeredTile>(); |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithMaxCrossAxisExtent( |
|||
maxCrossAxisExtent: maxCrossAxisExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: (i) => staggeredTiles[i], |
|||
staggeredTileCount: staggeredTiles.Count |
|||
); |
|||
return new SliverStaggeredGrid( |
|||
key: key, |
|||
Delegate: new SliverChildListDelegate( |
|||
children |
|||
), |
|||
gridDelegate: gridDelegate |
|||
); |
|||
} |
|||
|
|||
public static SliverStaggeredGrid extentBuilder( |
|||
float maxCrossAxisExtent, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
IndexedWidgetBuilder itemBuilder, |
|||
int itemCount, |
|||
Key key = null, |
|||
float mainAxisSpacing = 0, |
|||
float crossAxisSpacing = 0 |
|||
) |
|||
{ |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithMaxCrossAxisExtent( |
|||
maxCrossAxisExtent: maxCrossAxisExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: itemCount |
|||
); |
|||
return new SliverStaggeredGrid( |
|||
key: key, |
|||
Delegate: new SliverChildBuilderDelegate( |
|||
itemBuilder, |
|||
childCount: itemCount |
|||
), |
|||
gridDelegate: gridDelegate |
|||
); |
|||
} |
|||
|
|||
public readonly SliverStaggeredGridDelegate gridDelegate; |
|||
|
|||
public override RenderObject createRenderObject(BuildContext context) |
|||
{ |
|||
var element = context as SliverVariableSizeBoxAdaptorElement; |
|||
return new RenderSliverStaggeredGrid( |
|||
childManager: element, gridDelegate: gridDelegate); |
|||
} |
|||
|
|||
public override void updateRenderObject(BuildContext context, RenderObject o) |
|||
{ |
|||
var renderObject = o as RenderSliverStaggeredGrid; |
|||
renderObject.gridDelegate = gridDelegate; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9363f8d6ad684d27b22851acf4c50f7e |
|||
timeCreated: 1626751663 |
|
|||
fileFormatVersion: 2 |
|||
guid: 26452f13449c4a358bd8dbdb02d1ab20 |
|||
timeCreated: 1626775469 |
|
|||
using Unity.UIWidgets.foundation; |
|||
|
|||
public class StaggeredTile |
|||
{ |
|||
public StaggeredTile( |
|||
int crossAxisCellCount, |
|||
float? mainAxisCellCount, |
|||
float? mainAxisExtent) |
|||
{ |
|||
this.crossAxisCellCount = crossAxisCellCount; |
|||
this.mainAxisCellCount = mainAxisCellCount; |
|||
this.mainAxisExtent = mainAxisExtent; |
|||
} |
|||
|
|||
public static StaggeredTile count(int crossAxisCellCount, float? mainAxisCellCount) |
|||
{ |
|||
D.assert(crossAxisCellCount >= 0); |
|||
D.assert(mainAxisCellCount != null && mainAxisCellCount >= 0); |
|||
return new StaggeredTile( |
|||
crossAxisCellCount, |
|||
mainAxisCellCount, |
|||
null |
|||
); |
|||
} |
|||
|
|||
public static StaggeredTile extent(int crossAxisCellCount, float? mainAxisExtent) |
|||
{ |
|||
D.assert(crossAxisCellCount >= 0); |
|||
D.assert(mainAxisExtent != null && mainAxisExtent >= 0); |
|||
return new StaggeredTile( |
|||
crossAxisCellCount, |
|||
null, |
|||
mainAxisExtent); |
|||
} |
|||
|
|||
public static StaggeredTile fit(int crossAxisCellCount) |
|||
{ |
|||
D.assert(crossAxisCellCount >= 0); |
|||
return new StaggeredTile( |
|||
crossAxisCellCount, |
|||
null, |
|||
null); |
|||
} |
|||
|
|||
public readonly int crossAxisCellCount; |
|||
|
|||
public readonly float? mainAxisCellCount; |
|||
|
|||
public readonly float? mainAxisExtent; |
|||
|
|||
public bool fitContent |
|||
{ |
|||
get { return mainAxisCellCount == null && mainAxisExtent == null; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 73bd995a32824de9a636279020b2f5bc |
|||
timeCreated: 1626774051 |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
public class StaggeredGridView : BoxScrollView |
|||
{ |
|||
private StaggeredGridView( |
|||
SliverStaggeredGridDelegate gridDelegate, |
|||
SliverChildDelegate childrenDelegate, |
|||
Key key, |
|||
Axis scrollDirection, |
|||
bool reverse, |
|||
ScrollController controller, |
|||
bool? primary, |
|||
ScrollPhysics physics, |
|||
bool shrinkWrap, |
|||
EdgeInsetsGeometry padding |
|||
// string restorationId
|
|||
) : base( |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId
|
|||
) |
|||
{ |
|||
this.gridDelegate = gridDelegate; |
|||
this.childrenDelegate = childrenDelegate; |
|||
} |
|||
|
|||
public static StaggeredGridView New( |
|||
SliverStaggeredGridDelegate gridDelegate, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true, |
|||
List<Widget> children = null //public <Widget>[],
|
|||
// string restorationId = null
|
|||
) |
|||
{ |
|||
var childrenDelegate = new SliverChildListDelegate( |
|||
children ?? new List<Widget>(), |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId
|
|||
); |
|||
} |
|||
|
|||
public static StaggeredGridView builder( |
|||
SliverStaggeredGridDelegate gridDelegate, |
|||
IndexedWidgetBuilder itemBuilder, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
int? itemCount = null, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true, |
|||
string restorationId = null |
|||
) |
|||
{ |
|||
var childrenDelegate = new SliverChildBuilderDelegate( |
|||
itemBuilder, |
|||
childCount: itemCount, |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: (SliverChildDelegate) childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId
|
|||
); |
|||
} |
|||
|
|||
|
|||
public StaggeredGridView custom( |
|||
SliverStaggeredGridDelegate gridDelegate, |
|||
SliverChildDelegate childrenDelegate, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null |
|||
// string restorationId = null
|
|||
) |
|||
{ |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId,
|
|||
); |
|||
} |
|||
|
|||
public static StaggeredGridView count( |
|||
int crossAxisCount, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
float mainAxisSpacing = 0.0f, |
|||
float crossAxisSpacing = 0.0f, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true, |
|||
List<Widget> children = null, // public <Widget>[],
|
|||
List<StaggeredTile> staggeredTiles = null // public <StaggeredTile>[],
|
|||
// String? restorationId,
|
|||
) |
|||
{ |
|||
children = children ?? new List<Widget>(); |
|||
staggeredTiles = staggeredTiles ?? new List<StaggeredTile>(); |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithFixedCrossAxisCount( |
|||
crossAxisCount: crossAxisCount, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: (i) => staggeredTiles[i], |
|||
staggeredTileCount: staggeredTiles.Count |
|||
); |
|||
var childrenDelegate = new SliverChildListDelegate( |
|||
children, |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
|
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId,
|
|||
); |
|||
} |
|||
|
|||
public static StaggeredGridView countBuilder( |
|||
int crossAxisCount, |
|||
IndexedWidgetBuilder itemBuilder, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
int? itemCount = null, |
|||
float mainAxisSpacing = 0.0f, |
|||
float crossAxisSpacing = 0.0f, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true |
|||
// String? restorationId,
|
|||
) |
|||
{ |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithFixedCrossAxisCount( |
|||
crossAxisCount: crossAxisCount, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: itemCount |
|||
); |
|||
var childrenDelegate = new SliverChildBuilderDelegate( |
|||
itemBuilder, |
|||
childCount: itemCount, |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId,
|
|||
); |
|||
} |
|||
|
|||
public static StaggeredGridView extent( |
|||
float maxCrossAxisExtent, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
float mainAxisSpacing = 0.0f, |
|||
float crossAxisSpacing = 0.0f, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true, |
|||
List<Widget> children = null, // public <Widget>[],
|
|||
List<StaggeredTile> staggeredTiles = null // public <StaggeredTile>[],
|
|||
// String? restorationId,
|
|||
) |
|||
{ |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithMaxCrossAxisExtent( |
|||
maxCrossAxisExtent: maxCrossAxisExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: (i) => staggeredTiles[i], |
|||
staggeredTileCount: staggeredTiles.Count |
|||
); |
|||
var childrenDelegate = new SliverChildListDelegate( |
|||
children, |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId,
|
|||
); |
|||
} |
|||
|
|||
public static StaggeredGridView extentBuilder( |
|||
float maxCrossAxisExtent, |
|||
IndexedWidgetBuilder itemBuilder, |
|||
GridUtil.IndexedStaggeredTileBuilder staggeredTileBuilder, |
|||
Key key = null, |
|||
Axis scrollDirection = Axis.vertical, |
|||
bool reverse = false, |
|||
ScrollController controller = null, |
|||
bool? primary = null, |
|||
ScrollPhysics physics = null, |
|||
bool shrinkWrap = false, |
|||
EdgeInsetsGeometry padding = null, |
|||
int? itemCount = null, |
|||
float mainAxisSpacing = 0.0f, |
|||
float crossAxisSpacing = 0.0f, |
|||
bool addAutomaticKeepAlives = true, |
|||
bool addRepaintBoundaries = true |
|||
// String? restorationId = null,
|
|||
) |
|||
{ |
|||
var gridDelegate = new SliverStaggeredGridDelegateWithMaxCrossAxisExtent( |
|||
maxCrossAxisExtent: maxCrossAxisExtent, |
|||
mainAxisSpacing: mainAxisSpacing, |
|||
crossAxisSpacing: crossAxisSpacing, |
|||
staggeredTileBuilder: staggeredTileBuilder, |
|||
staggeredTileCount: itemCount |
|||
); |
|||
var childrenDelegate = new SliverChildBuilderDelegate( |
|||
itemBuilder, |
|||
childCount: itemCount, |
|||
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|||
addRepaintBoundaries: addRepaintBoundaries |
|||
); |
|||
return new StaggeredGridView( |
|||
gridDelegate: gridDelegate, |
|||
childrenDelegate: childrenDelegate, |
|||
key: key, |
|||
scrollDirection: scrollDirection, |
|||
reverse: reverse, |
|||
controller: controller, |
|||
primary: primary, |
|||
physics: physics, |
|||
shrinkWrap: shrinkWrap, |
|||
padding: padding |
|||
// restorationId: restorationId,
|
|||
); |
|||
} |
|||
|
|||
public readonly SliverStaggeredGridDelegate gridDelegate; |
|||
|
|||
public readonly SliverChildDelegate childrenDelegate; |
|||
|
|||
protected override Widget buildChildLayout(BuildContext context) |
|||
{ |
|||
return new SliverStaggeredGrid( |
|||
Delegate: childrenDelegate, |
|||
gridDelegate: gridDelegate |
|||
); |
|||
} |
|||
} |
|
|||
using System; |
|||
|
|||
public interface TileContainerRenderObjectMixin<ChildType, ParentDataType> { |
|||
void forEachChild(Action<ChildType> f); |
|||
|
|||
void remove(int index); |
|||
|
|||
void _removeChild(ChildType child); |
|||
|
|||
void removeAll(); |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3af8956ed28744b899a62e3b21778d83 |
|||
timeCreated: 1626685582 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.external; |
|||
|
|||
|
|||
public abstract class TileContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType>: RenderSliver, TileContainerRenderObjectMixin<ChildType, ParentDataType> |
|||
where ChildType : RenderObject |
|||
where ParentDataType : ParentData |
|||
{ |
|||
// need to make SplayTree public
|
|||
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>(); |
|||
|
|||
/// The number of children.
|
|||
protected int childCount |
|||
{ |
|||
get => _childRenderObjects.Count; |
|||
} |
|||
|
|||
protected ICollection<ChildType> children |
|||
{ |
|||
get => _childRenderObjects.Values; |
|||
} |
|||
|
|||
protected ICollection<int> indices |
|||
{ |
|||
get => _childRenderObjects.Keys; |
|||
} |
|||
|
|||
/// Checks whether the given render object has the correct [runtimeType] to be
|
|||
/// a child of this render object.
|
|||
///
|
|||
/// Does nothing if assertions are disabled.
|
|||
///
|
|||
/// Always returns true.
|
|||
public bool debugValidateChild(RenderObject child) |
|||
{ |
|||
D.assert(() => |
|||
{ |
|||
if (!(child is ChildType)) |
|||
{ |
|||
throw new UIWidgetsError( |
|||
"A $runtimeType expected a child of type $ChildType but received a " + |
|||
"child of type ${child.runtimeType}.\n" + |
|||
"RenderObjects expect specific types of children because they " + |
|||
"coordinate with their children during layout and paint. For " + |
|||
"example, a RenderSliver cannot be the child of a RenderBox because " + |
|||
"a RenderSliver does not understand the RenderBox layout protocol.\n" + |
|||
"\n" + |
|||
"The $runtimeType that expected a $ChildType child was created by:\n" + |
|||
" $debugCreator\n" + |
|||
"\n" + |
|||
"The ${child.runtimeType} that did not match the expected child type " + |
|||
"was created by:\n" + |
|||
" ${child.debugCreator}\n"); |
|||
} |
|||
|
|||
return true; |
|||
}); |
|||
return true; |
|||
} |
|||
|
|||
public ChildType this[int index] { |
|||
get { return _childRenderObjects.ContainsKey(index) ? _childRenderObjects[index] : null; } |
|||
set |
|||
|
|||
{ |
|||
if (index < 0) |
|||
{ |
|||
throw new ArgumentException($"index {index}"); |
|||
} |
|||
|
|||
_removeChild(_childRenderObjects.getOrDefault(index, null)); |
|||
adoptChild(value); |
|||
_childRenderObjects[index] = value; |
|||
} |
|||
} |
|||
|
|||
public virtual void forEachChild(Action<ChildType> f) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(f); |
|||
} |
|||
|
|||
/// Remove the child at the specified index from the child list.
|
|||
public virtual void remove(int index) |
|||
{ |
|||
var child = _childRenderObjects[index]; |
|||
_childRenderObjects.Remove(index); |
|||
_removeChild(child); |
|||
} |
|||
|
|||
public virtual void _removeChild(ChildType child) |
|||
{ |
|||
if (child != null) |
|||
{ |
|||
// Remove the old child.
|
|||
dropChild(child); |
|||
} |
|||
} |
|||
|
|||
/// Remove all their children from this render object's child list.
|
|||
///
|
|||
/// More efficient than removing them individually.
|
|||
public virtual void removeAll() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(dropChild); |
|||
_childRenderObjects.Clear(); |
|||
} |
|||
|
|||
public override void attach(object owner) |
|||
{ |
|||
base.attach(owner); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner)); |
|||
} |
|||
|
|||
public override void detach() |
|||
{ |
|||
base.detach(); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.detach()); |
|||
} |
|||
|
|||
public override void redepthChildren() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(redepthChild); |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(r => visitor(r)); |
|||
} |
|||
|
|||
public override List<DiagnosticsNode> debugDescribeChildren() |
|||
{ |
|||
List<DiagnosticsNode> children = new List<DiagnosticsNode>(); |
|||
_childRenderObjects.ToList().ForEach(pair => |
|||
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}"))); |
|||
return children; |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 146276dca5447c54db1111667c732027 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.external; |
|||
|
|||
{% macro TileContainerRenderObjectMixin(with) %} |
|||
public abstract class TileContainerRenderObjectMixin{{with}}<ChildType, ParentDataType>: {{with}}, TileContainerRenderObjectMixin<ChildType, ParentDataType> |
|||
where ChildType : RenderObject |
|||
where ParentDataType : ParentData |
|||
{ |
|||
// need to make SplayTree public |
|||
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>(); |
|||
|
|||
/// The number of children. |
|||
protected int childCount |
|||
{ |
|||
get => _childRenderObjects.Count; |
|||
} |
|||
|
|||
protected ICollection<ChildType> children |
|||
{ |
|||
get => _childRenderObjects.Values; |
|||
} |
|||
|
|||
protected ICollection<int> indices |
|||
{ |
|||
get => _childRenderObjects.Keys; |
|||
} |
|||
|
|||
/// Checks whether the given render object has the correct [runtimeType] to be |
|||
/// a child of this render object. |
|||
/// |
|||
/// Does nothing if assertions are disabled. |
|||
/// |
|||
/// Always returns true. |
|||
public bool debugValidateChild(RenderObject child) |
|||
{ |
|||
D.assert(() => |
|||
{ |
|||
if (!(child is ChildType)) |
|||
{ |
|||
throw new UIWidgetsError( |
|||
"A $runtimeType expected a child of type $ChildType but received a " + |
|||
"child of type ${child.runtimeType}.\n" + |
|||
"RenderObjects expect specific types of children because they " + |
|||
"coordinate with their children during layout and paint. For " + |
|||
"example, a RenderSliver cannot be the child of a RenderBox because " + |
|||
"a RenderSliver does not understand the RenderBox layout protocol.\n" + |
|||
"\n" + |
|||
"The $runtimeType that expected a $ChildType child was created by:\n" + |
|||
" $debugCreator\n" + |
|||
"\n" + |
|||
"The ${child.runtimeType} that did not match the expected child type " + |
|||
"was created by:\n" + |
|||
" ${child.debugCreator}\n"); |
|||
} |
|||
|
|||
return true; |
|||
}); |
|||
return true; |
|||
} |
|||
|
|||
public ChildType this[int index] |
|||
{ |
|||
get => _childRenderObjects[index]; |
|||
set |
|||
|
|||
{ |
|||
if (index < 0) |
|||
{ |
|||
throw new ArgumentException($"index {index}"); |
|||
} |
|||
|
|||
_removeChild(_childRenderObjects.getOrDefault(index, null)); |
|||
adoptChild(value); |
|||
_childRenderObjects[index] = value; |
|||
} |
|||
} |
|||
|
|||
public virtual void forEachChild(Action<ChildType> f) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(f); |
|||
} |
|||
|
|||
/// Remove the child at the specified index from the child list. |
|||
public virtual void remove(int index) |
|||
{ |
|||
var child = _childRenderObjects[index]; |
|||
_childRenderObjects.Remove(index); |
|||
_removeChild(child); |
|||
} |
|||
|
|||
public virtual void _removeChild(ChildType child) |
|||
{ |
|||
if (child != null) |
|||
{ |
|||
// Remove the old child. |
|||
dropChild(child); |
|||
} |
|||
} |
|||
|
|||
/// Remove all their children from this render object's child list. |
|||
/// |
|||
/// More efficient than removing them individually. |
|||
public virtual void removeAll() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(dropChild); |
|||
_childRenderObjects.Clear(); |
|||
} |
|||
|
|||
public override void attach(object owner) |
|||
{ |
|||
base.attach(owner); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner)); |
|||
} |
|||
|
|||
public override void detach() |
|||
{ |
|||
base.detach(); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.detach()); |
|||
} |
|||
|
|||
public override void redepthChildren() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(redepthChild); |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(r => visitor(r)); |
|||
} |
|||
|
|||
public override List<DiagnosticsNode> debugDescribeChildren() |
|||
{ |
|||
List<DiagnosticsNode> children = new List<DiagnosticsNode>(); |
|||
_childRenderObjects.ToList().ForEach(pair => |
|||
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}"))); |
|||
return children; |
|||
} |
|||
} |
|||
|
|||
{% endmacro %} |
|||
|
|||
{{ TileContainerRenderObjectMixin('RenderSliver') }} |
|
|||
fileFormatVersion: 2 |
|||
guid: cdbbb536a55f4d5da396f06ce06aa5b8 |
|||
timeCreated: 1626681945 |
撰写
预览
正在加载...
取消
保存
Reference in new issue