|
|
|
|
|
|
public readonly DragStartBehavior dragStartBehavior; |
|
|
|
|
|
|
|
public static SliverOverlapAbsorberHandle sliverOverlapAbsorberHandleFor(BuildContext context) { |
|
|
|
_InheritedNestedScrollView target = |
|
|
|
(_InheritedNestedScrollView) context.inheritFromWidgetOfExactType(typeof(_InheritedNestedScrollView)); |
|
|
|
_InheritedNestedScrollView target = context.dependOnInheritedWidgetOfExactType<_InheritedNestedScrollView>(); |
|
|
|
() => { |
|
|
|
return |
|
|
|
"NestedScrollView.sliverOverlapAbsorberHandleFor must be called with a context that contains a NestedScrollView."; |
|
|
|
}); |
|
|
|
() => "NestedScrollView.sliverOverlapAbsorberHandleFor must be called with a context that contains a NestedScrollView." |
|
|
|
); |
|
|
|
List<Widget> slivers = new List<Widget> { }; |
|
|
|
List<Widget> slivers = new List<Widget>(); |
|
|
|
slivers.AddRange(headerSliverBuilder(context, bodyIsScrolled)); |
|
|
|
slivers.Add(new SliverFillRemaining( |
|
|
|
child: new PrimaryScrollController( |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public override State createState() { |
|
|
|
return new _NestedScrollViewState(); |
|
|
|
return new NestedScrollViewState(); |
|
|
|
class _NestedScrollViewState : State<NestedScrollView> { |
|
|
|
internal SliverOverlapAbsorberHandle _absorberHandle = new SliverOverlapAbsorberHandle(); |
|
|
|
class NestedScrollViewState : State<NestedScrollView> { |
|
|
|
internal readonly SliverOverlapAbsorberHandle _absorberHandle = new SliverOverlapAbsorberHandle(); |
|
|
|
|
|
|
|
ScrollController innerController => _coordinator._innerController; |
|
|
|
|
|
|
|
ScrollController outerController => _coordinator._outerController; |
|
|
|
|
|
|
|
_NestedScrollCoordinator _coordinator; |
|
|
|
|
|
|
|
|
|
|
class _InheritedNestedScrollView : InheritedWidget { |
|
|
|
public _InheritedNestedScrollView( |
|
|
|
Key key = null, |
|
|
|
_NestedScrollViewState state = null, |
|
|
|
NestedScrollViewState state = null, |
|
|
|
Widget child = null |
|
|
|
) : base(key: key, child: child) { |
|
|
|
D.assert(state != null); |
|
|
|
|
|
|
|
|
|
|
public readonly _NestedScrollViewState state; |
|
|
|
public readonly NestedScrollViewState state; |
|
|
|
|
|
|
|
public override bool updateShouldNotify(InheritedWidget _old) { |
|
|
|
_InheritedNestedScrollView old = _old as _InheritedNestedScrollView; |
|
|
|
|
|
|
|
|
|
|
class _NestedScrollCoordinator : ScrollActivityDelegate, ScrollHoldController { |
|
|
|
public _NestedScrollCoordinator( |
|
|
|
_NestedScrollViewState _state, |
|
|
|
NestedScrollViewState _state, |
|
|
|
ScrollController _parent, |
|
|
|
VoidCallback _onHasScrolledBodyChanged) { |
|
|
|
float initialScrollOffset = _parent?.initialScrollOffset ?? 0.0f; |
|
|
|
|
|
|
this._onHasScrolledBodyChanged = _onHasScrolledBodyChanged; |
|
|
|
} |
|
|
|
|
|
|
|
public readonly _NestedScrollViewState _state; |
|
|
|
public readonly NestedScrollViewState _state; |
|
|
|
ScrollController _parent; |
|
|
|
public readonly VoidCallback _onHasScrolledBodyChanged; |
|
|
|
|
|
|
|
|
|
|
float velocity) { |
|
|
|
return position.createBallisticScrollActivity( |
|
|
|
position.physics.createBallisticSimulation( |
|
|
|
velocity == 0 ? (ScrollMetrics) position : _getMetrics(position, velocity), |
|
|
|
velocity == 0f ? (ScrollMetrics) position : _getMetrics(position, velocity), |
|
|
|
velocity |
|
|
|
), |
|
|
|
mode: _NestedBallisticScrollActivityMode.inner |
|
|
|
|
|
|
public SliverOverlapAbsorber( |
|
|
|
Key key = null, |
|
|
|
SliverOverlapAbsorberHandle handle = null, |
|
|
|
Widget child = null |
|
|
|
) : base(key: key, child: child) { |
|
|
|
Widget child = null, |
|
|
|
Widget sliver = null |
|
|
|
) : base(key: key, child: sliver ?? child) { |
|
|
|
D.assert(child == null || sliver == null); |
|
|
|
this.handle = handle; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public class RenderSliverOverlapAbsorber : RenderObjectWithChildMixinRenderSliver<RenderSliver> { |
|
|
|
public RenderSliverOverlapAbsorber( |
|
|
|
SliverOverlapAbsorberHandle handle, |
|
|
|
RenderSliver child = null |
|
|
|
RenderSliver child = null, |
|
|
|
RenderSliver sliver = null |
|
|
|
D.assert(child == null || sliver == null); |
|
|
|
this.child = child; |
|
|
|
this.child = sliver ?? child; |
|
|
|
} |
|
|
|
|
|
|
|
public SliverOverlapAbsorberHandle handle { |
|
|
|
|
|
|
scrollExtent: childLayoutGeometry.scrollExtent - childLayoutGeometry.maxScrollObstructionExtent, |
|
|
|
paintExtent: childLayoutGeometry.paintExtent, |
|
|
|
paintOrigin: childLayoutGeometry.paintOrigin, |
|
|
|
layoutExtent: childLayoutGeometry.paintExtent - childLayoutGeometry.maxScrollObstructionExtent, |
|
|
|
layoutExtent: Mathf.Max(0, childLayoutGeometry.paintExtent - childLayoutGeometry.maxScrollObstructionExtent), |
|
|
|
maxPaintExtent: childLayoutGeometry.maxPaintExtent, |
|
|
|
maxScrollObstructionExtent: childLayoutGeometry.maxScrollObstructionExtent, |
|
|
|
hitTestExtent: childLayoutGeometry.hitTestExtent, |
|
|
|
|
|
|
public SliverOverlapInjector( |
|
|
|
Key key = null, |
|
|
|
SliverOverlapAbsorberHandle handle = null, |
|
|
|
Widget child = null |
|
|
|
) : base(key: key, child: child) { |
|
|
|
Widget child = null, |
|
|
|
Widget sliver = null |
|
|
|
) : base(key: key, child: sliver ?? child) { |
|
|
|
D.assert(child == null || sliver == null); |
|
|
|
this.handle = handle; |
|
|
|
} |
|
|
|
|
|
|
|