我在不滚动的 SafeArea 中有一个 SingleChildScrollView 小部件。我想让所有屏幕都可以滚动,但它绝不滚动。 这是代码:
Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
// some containers with text
CustomList(),
// some containers with text
CustomList(),
// some containers with text
],
),
),
),
),
bottomSheet: // container and button
),
CustomList 是一个 Column 小部件,里面有一些 Rows 小部件,如下所示:
Column(
children:
[
// some rows like this, not only one
Row(
children: [
Container(
child: CustomItem(),
),
],
],
),
];
)
CustomItem 只是一个文本。为什么我的屏幕不可滚动?
只使 scrollView 可滚动
physics: const AlwaysScrollableScrollPhysics(), //add to ScrollView
和其他 listViews 不应该滚动,因为只有一个父母应该滚动
physics: NeverScrollableScrollPhysics(),//add to ListView
还将 Expanded 添加到您的 listViews