我的滚动条位于较高级别,子滚动条位于树的下方几层。滚动孩子时,父母也会滚动。仅滚动条显示并在父级中移动。相反,这不会发生。我曾尝试用手势检测器包裹孩子,但没有用。顺便说一句,这是网站
这是父级布局小部件(子级将用于渲染子级):
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,
),
],
),
),
);
}
在下图中,“报告”区域是导致父级滚动的子级。查找ReportList。报告列表是一个ListView小部件。
答案 0 :(得分:1)
这是一个变通方法,我找不到参考,但是看起来像是扑扑团队正在解决这个问题。
是的。这样包装滚动条:
NotificationListener<ScrollNotification>(
onNotification: (notification) => true,
child: Scrollbar()
)