在我的中showModalBottomSheet,我有一个DraggableScrollableSheet包含内容的内容。当我向上滚动时,我希望内容动态向上滚动到有内容为止。
但是,当我向上滚动时,默认情况下,内容会在屏幕的中间被切断,并且我会继续滚动:内容被切断,内容会继续滚动
但是,当我添加时isScrollControlled: false,内容将一直到顶部,在下面留下空白,这不是我想要的:内容不断向上滚动,空白位于内容下方
这是不包括默认卡的代码:
void _showSettingsPanel() {
showModalBottomSheet<dynamic>(isScrollControlled: false, backgroundColor: Colors.transparent, context: context, builder: (context) {
return DraggableScrollableSheet(
builder: (BuildContext context, ScrollController scrollController) {
return Container(
color: Colors.blue[100],
child: ListView(
controller: scrollController,
children: const <Widget>[
//here would be the cards
],
),
);
},
);
});
}
Run Code Online (Sandbox Code Playgroud)
并包括卡片...
void _showSettingsPanel() {
showModalBottomSheet<dynamic>(isScrollControlled: false, backgroundColor: Colors.transparent, context: context, builder: (context) {
return DraggableScrollableSheet(
builder: (BuildContext context, ScrollController scrollController) {
return Container(
color: …Run Code Online (Sandbox Code Playgroud)