【发布时间】:2021-03-24 14:25:17
【问题描述】:
我有以下颤振/飞镖代码,其中位于 tabBarView 和容器内的 listView 不可滚动
Container(
height: MediaQuery.of(context).size.height,
child: TabBarView(controller: _controller, children: [
ListView(
physics: const AlwaysScrollableScrollPhysics(), // new
controller: _controllerView,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: CustomText(
text: "User Details",
size: 20,
weight: FontWeight.bold,
color: darkPrimary,
),
),
ListTile(
leading: Icon(Icons.date_range_rounded),
title: CustomText(
text: "Joined",
color: grey,
size: 15,
weight: FontWeight.bold,
),
subtitle: CustomText(
text: "Jan 2020",
size: 18,
color: darkPrimary,
weight: FontWeight.bold,
),
dense: true,
),
ListTile(
leading: Icon(Icons.remove_red_eye_rounded),
title: CustomText(
text: "Active",
color: grey,
size: 15,
weight: FontWeight.bold,
),
subtitle: CustomText(
text: "3 days ago",
size: 18,
color: darkPrimary,
weight: FontWeight.bold,
),
dense: true,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: CustomText(
text: "Description",
size: 20,
weight: FontWeight.bold,
color: darkPrimary,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: CustomText(
text:
"khfkjsh dkjash dkjash kdhask dhkas dkashkd askd asdh aksjhdkasj dkhhas dk askdh ask dhas hdas dh ask daskhh daskj daks dka asdh as dasjh",
size: 15,
weight: FontWeight.bold,
color: grey[700],
),
),
]),
ListView(children: [])
]),
)
这是控制器代码
TabController _controller;
ScrollController _controllerView = new ScrollController();
@override
void initState() {
super.initState();
_controller = new TabController(length: 2, vsync: this);
}
这段代码是否有任何问题导致它无法滚动,而屏幕看起来好像是固定的。请帮助我是颤振/飞镖的初学者
更新:相反,我像这样使用 Litview 并将另一个更改为列。即使它不是我想要的它仍然可以
body: SafeArea(
child: ListView(),
)
【问题讨论】: