我有一个用于飘动卷筒纸的屏幕,具有两列。一个是固定的(内容不滚动),另一个包含ListView(滚动)。我正在尝试捕获固定部分上的手势偏移,以使用Scrollable Widget同步ListView滚动。但是我遇到一个错误,该错误没有提供太多信息。
这是我正在使用的代码。
SafeArea(
child: Scaffold(
backgroundColor: AppTheme.primaryBackgroundColor,
body: Row(
children: [
Expanded(
flex: 2,
child: Scrollable(
dragStartBehavior: DragStartBehavior.start,
axisDirection: _getDirection(context),
viewportBuilder: (BuildContext context, ViewportOffset position) {
return FixedPage(
width: isDesktop ? fullWidth / 2 : fullWidth, height: fullHeight);
},
),
),
),
Expanded(
flex:3,
child: ListView(
controller: _scrollController,
children: [
Container(
constraints:
BoxConstraints.expand(width: fullWidth, height: fullHeight - 100),
color: Colors.blueAccent,
),
Container(
constraints:
BoxConstraints.expand(width: fullWidth, height: fullHeight - 100),
color: Colors.redAccent,
),
Container(
constraints:
BoxConstraints.expand(width: fullWidth, height: fullHeight - 100),
color: Colors.greenAccent,
),
Container(
constraints:
BoxConstraints.expand(width: fullWidth, height: fullHeight - 100),
color: Colors.purpleAccent,
),
FooterPage(),
],
),
),
],
),
),
);
}
AxisDirection _getDirection(BuildContext context) {
return getAxisDirectionFromAxisReverseAndDirectionality(context, Axis.vertical, false);
}
错误
════════ Exception caught by gesture library ═══════════════════════════════════════════════════════
The following ArgumentError was thrown while dispatching a pointer event:
Invalid argument: null
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 214:49 throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 13:3 argumentError
packages/flutter/src/widgets/scrollable.dart 584:21 [_targetScrollOffsetForPointerScroll]
packages/flutter/src/widgets/scrollable.dart 590:41 [_receivedPointerSignal]
packages/flutter/src/rendering/proxy_box.dart 2643:29 handleEvent
...
Event: PointerScrollEvent#7c8f4(position: Offset(431.0, 312.0), scrollDelta: Offset(-0.0, 0.5))
position: Offset(431.0, 312.0)
scrollDelta: Offset(-0.0, 0.5)
Target: RenderPointerListener#a2d5b relayoutBoundary=up3
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=480.0, 0.0<=h<=754.0)
size: Size(480.0, 754.0)
behavior: deferToChild
listeners: signal
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by gesture library ═══════════════════════════════════════════════════════
Invalid argument: null
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by gesture library ═══════════════════════════════════════════════════════
Invalid argument: null
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by gesture library ═══════════════════════════════════════════════════════
Invalid argument: null
════════════════════════════════════════════════════════════════════════════════════════════════════