|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
using com.unity.uiwidgets.Runtime.rendering; |
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
using Unity.UIWidgets.gestures; |
|
|
|
using Unity.UIWidgets.painting; |
|
|
|
using Unity.UIWidgets.rendering; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
bool? primary = null, |
|
|
|
ScrollPhysics physics = null, |
|
|
|
bool shrinkWrap = false, |
|
|
|
float? cacheExtent = null |
|
|
|
Key center = null, |
|
|
|
float anchor = 0.0f, |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
D.assert(!shrinkWrap || center == null); |
|
|
|
D.assert(anchor >= 0.0f && anchor <= 1.0f); |
|
|
|
|
|
|
|
primary = primary ?? controller == null && scrollDirection == Axis.vertical; |
|
|
|
physics = physics ?? (primary.Value ? new AlwaysScrollableScrollPhysics() : null); |
|
|
|
|
|
|
this.primary = primary.Value; |
|
|
|
this.physics = physics; |
|
|
|
this.shrinkWrap = shrinkWrap; |
|
|
|
this.center = center; |
|
|
|
this.anchor = anchor; |
|
|
|
this.dragStartBehavior = dragStartBehavior; |
|
|
|
} |
|
|
|
|
|
|
|
public readonly Axis scrollDirection; |
|
|
|
|
|
|
public readonly ScrollPhysics physics; |
|
|
|
public readonly bool shrinkWrap; |
|
|
|
public readonly Key center; |
|
|
|
public readonly float anchor; |
|
|
|
public readonly DragStartBehavior dragStartBehavior; |
|
|
|
|
|
|
|
protected AxisDirection getDirection(BuildContext context) { |
|
|
|
return LayoutUtils.getAxisDirectionFromAxisReverseAndDirectionality( |
|
|
|
|
|
|
axisDirection: axisDirection, |
|
|
|
offset: offset, |
|
|
|
slivers: slivers, |
|
|
|
cacheExtent: this.cacheExtent |
|
|
|
cacheExtent: this.cacheExtent, |
|
|
|
center: this.center, |
|
|
|
anchor: this.anchor |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
ScrollController scrollController = this.primary ? PrimaryScrollController.of(context) : this.controller; |
|
|
|
|
|
|
|
Scrollable scrollable = new Scrollable( |
|
|
|
dragStartBehavior: this.dragStartBehavior, |
|
|
|
axisDirection: axisDirection, |
|
|
|
controller: scrollController, |
|
|
|
physics: this.physics, |
|
|
|
|
|
|
bool? primary = null, |
|
|
|
ScrollPhysics physics = null, |
|
|
|
bool shrinkWrap = false, |
|
|
|
Key center = null, |
|
|
|
float anchor = 0.0f, |
|
|
|
List<Widget> slivers = null |
|
|
|
List<Widget> slivers = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
center: center, |
|
|
|
anchor: anchor, |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.slivers = slivers ?? new List<Widget>(); |
|
|
|
} |
|
|
|
|
|
|
ScrollPhysics physics = null, |
|
|
|
bool shrinkWrap = false, |
|
|
|
EdgeInsets padding = null, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.padding = padding; |
|
|
|
} |
|
|
|
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null, |
|
|
|
List<Widget> children = null |
|
|
|
List<Widget> children = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.itemExtent = itemExtent; |
|
|
|
this.childrenDelegate = new SliverChildListDelegate( |
|
|
|
|
|
|
int? itemCount = null, |
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base(key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
reverse: reverse, |
|
|
|
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.itemExtent = itemExtent; |
|
|
|
this.childrenDelegate = new SliverChildBuilderDelegate( |
|
|
|
|
|
|
int? itemCount = null, |
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
key, |
|
|
|
scrollDirection, |
|
|
|
reverse, |
|
|
|
controller, |
|
|
|
primary, |
|
|
|
physics, |
|
|
|
shrinkWrap, |
|
|
|
padding, |
|
|
|
itemExtent, |
|
|
|
itemBuilder, |
|
|
|
itemCount, |
|
|
|
addAutomaticKeepAlives, |
|
|
|
addRepaintBoundaries |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
reverse: reverse, |
|
|
|
controller: controller, |
|
|
|
primary: primary, |
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
itemExtent: itemExtent, |
|
|
|
itemBuilder: itemBuilder, |
|
|
|
itemCount: itemCount, |
|
|
|
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|
|
|
addRepaintBoundaries: addRepaintBoundaries, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
int itemCount = 0, |
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
D.assert(itemBuilder != null); |
|
|
|
D.assert(separatorBuilder != null); |
|
|
|
|
|
|
EdgeInsets padding = null, |
|
|
|
SliverGridDelegate gridDelegate = null, |
|
|
|
SliverChildDelegate childrenDelegate = null, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
D.assert(gridDelegate != null); |
|
|
|
D.assert(childrenDelegate != null); |
|
|
|
|
|
|
EdgeInsets padding = null, |
|
|
|
SliverGridDelegate gridDelegate = null, |
|
|
|
SliverChildDelegate childrenDelegate = null, |
|
|
|
float? cacheExtent = null |
|
|
|
float? cacheExtent = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) { |
|
|
|
return new GridView( |
|
|
|
key: key, |
|
|
|
|
|
|
padding: padding, |
|
|
|
gridDelegate: gridDelegate, |
|
|
|
childrenDelegate: childrenDelegate, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null, |
|
|
|
List<Widget> children = null |
|
|
|
List<Widget> children = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding, |
|
|
|
cacheExtent: cacheExtent |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.gridDelegate = new SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
crossAxisCount: crossAxisCount ?? 0, |
|
|
|
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
float? cacheExtent = null, |
|
|
|
List<Widget> children = null |
|
|
|
List<Widget> children = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) { |
|
|
|
return new GridView( |
|
|
|
key: key, |
|
|
|
|
|
|
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|
|
|
addRepaintBoundaries: addRepaintBoundaries, |
|
|
|
cacheExtent: cacheExtent, |
|
|
|
children: children |
|
|
|
children: children, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
bool addSemanticIndexes = true, |
|
|
|
List<Widget> children = null |
|
|
|
List<Widget> children = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) : base( |
|
|
|
key: key, |
|
|
|
scrollDirection: scrollDirection, |
|
|
|
|
|
|
physics: physics, |
|
|
|
shrinkWrap: shrinkWrap, |
|
|
|
padding: padding |
|
|
|
padding: padding, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
) { |
|
|
|
this.gridDelegate = new SliverGridDelegateWithMaxCrossAxisExtent( |
|
|
|
maxCrossAxisExtent: maxCrossAxisExtent ?? 0, |
|
|
|
|
|
|
float childAspectRatio = 1.0f, |
|
|
|
bool addAutomaticKeepAlives = true, |
|
|
|
bool addRepaintBoundaries = true, |
|
|
|
List<Widget> children = null |
|
|
|
List<Widget> children = null, |
|
|
|
DragStartBehavior dragStartBehavior = DragStartBehavior.down |
|
|
|
) { |
|
|
|
return new GridView( |
|
|
|
key: key, |
|
|
|
|
|
|
childAspectRatio: childAspectRatio, |
|
|
|
addAutomaticKeepAlives: addAutomaticKeepAlives, |
|
|
|
addRepaintBoundaries: addRepaintBoundaries, |
|
|
|
children: children |
|
|
|
children: children, |
|
|
|
dragStartBehavior: dragStartBehavior |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|