+-
我的滚动条在很高的位置,而子滚动条在树的下面几层。当滚动子滚动条时,父滚动条也会滚动。只是滚动条在父滚动条中显示和移动。反之则不会发生这种情况。我试过用手势检测器包装子代,但没有用。另外,这是Web
这是父级布局部件(子级是子级要渲染的地方)。
Scrollbar(
controller: layoutScrollController,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if(title != null) Container(
height: 67,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color:Theme.of(context).brightness == Brightness.dark ? GatheredThemeColors.light[850] : Colors.white,
border: Border(
bottom: BorderSide(
color: Theme.of(context).brightness == Brightness.dark ? GatheredThemeColors.light[800] : GatheredThemeColors.light[200],
width: 1
)
)
),
padding: EdgeInsets.all(20),
child: Text(title,style: Theme.of(context).textTheme.headline1,),
),
Container(
padding: EdgeInsets.all(20),
constraints: BoxConstraints(minHeight: 200),
child: child,
),
],
),
),
);
}
在下图中,"Reports "区域是导致父版滚动的子版。寻找ReportList。报告列表是一个ListView部件。
0
投票
投票
这是一个工作方法,我找不到参考资料,但看起来flutter团队看起来要解决这个问题。
下面是这样的。像这样把你的滚动条包起来。
NotificationListener<ScrollNotification>(
onNotification: (notification) => true,
child: Scrollbar()
)