【发布时间】:2018-08-04 17:01:45
【问题描述】:
我可能在这里遗漏了一些明显的东西,但我的 BottomSheet 只占用了屏幕的下半部分,尽管其中的小部件占用了更多空间。所以现在在 BottomSheet 中有滚动行为。我希望能够增加 BottomSheet,以便用户不必滚动太多。
我还想在我的 BottomSheet 顶部添加一个边框半径,使其看起来更像“模态”-y 或“制表符”。
代码:
void _showBottomSheet(BuildContext context) {
showModalBottomSheet<Null>(
context: context,
builder: (BuildContext context) {
return _bottomSheetScreen; // defined earlier on
},
);
}
我试过了:
showModalBottomSheet<Null>(
context: context,
builder: (BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: _borderRadius,
),
height: 1000.0,
child: _bottomSheetScreen,
);
},
);
但是好像只影响BottomSheet里面的内容,并没有自定义BottomSheet本身。
【问题讨论】:
-
目前不可能。如果您想要自定义的东西,请使用
Navigator推送自定义模式。在 github 中也有一个关于扩展底部工作表的类似问题:github.com/flutter/flutter/issues/497 -
很高兴知道,我会提出这个问题。感谢您提供有关在 Navigator 中使用自定义模式的建议,我没想到!
标签: material-design flutter bottom-sheet