我在扩展小部件中有一个动态尺寸列表。当列表很长时,我没问题。
但是,当列表很短(很短,不需要滚动即可使所有内容在屏幕上清晰显示)并且我在物理Iphone上滚动时,内容在到达屏幕底部之前就消失了(它在MediaQuery处停止) .of(context).size.height * 0.7)。这是因为展开使父窗口小部件尽可能小,并且在滚动时到达父窗口小部件的末尾,但这很丑陋。而且如果我增加0.7,那也很难看,因为即使内容很少,也需要滚动。
请在下面找到代码:
return Column(children: <Widget>[
TabHeader(
text: "Activiteiten",
),
Flexible(
child: RefreshIndicator(
onRefresh: () => refresh(),
color: App.primaryColor,
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: ConstrainedBox(
constraints: new BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.7,
),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: user.getParticipatingActivities().length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 1,
child: ATile(
sortedlist[index],
() => {
this.setState(() => {user.getActivities()})
}),
);
},
),
),
),
),
),
]);
这就是我想要的内容:内容将一直显示到到达底部导航栏。并不是说它会停在更高的位置。
谢谢!