我有 Flutter 的全屏模态底部工作表,SingleChildScrollView里面有。
正常的结果是,无论我向上还是向下滚动,它都会滚动内部滚动。我可以通过拖动可滚动之外的任何东西来关闭模态底部工作表(它是一个带有拖动手柄的小容器对我来说)。
问题是,如果我拉下内部可滚动,我想拉下底页。在做了一些研究之后,我发现我应该使用AlwaysScrollableScrollPhysics,NeverScrollableScrollPhysics但我真的找不到最好的解决方案。
我的想法是允许内部滚动,直到它的滚动偏移为负。这不起作用,因为当我在不关闭底部工作表的情况下停止滚动时,我需要某种方法使其可滚动。
我可以将内部可滚动包裹起来GestureDetector并检查滚动增量,但还没有成功。
也许有人遇到过类似的问题并得到了一些示例或算法?
添加modal_bottom_sheet并使用showMaterialModalBottomSheet
showMaterialModalBottomSheet(
context: context,
builder: (context) {
return SingleChildScrollView(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height * 0.8,
color: Colors.green,
),
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height * 0.8,
color: Colors.red,
),
],
),
);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
713 次 |
| 最近记录: |