【发布时间】:2019-12-20 06:52:25
【问题描述】:
我正在尝试生成嵌套在 VERTICAL 列表视图中的动态高度水平列表视图
我已经在打印我的水平列表视图了,但是每张卡片的内容都被水平列表视图的父容器的固定高度切割,关闭动画也被切割掉了,因为水平列表视图的父容器高度
class TestPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Test'),
),
body: ListView(
children: <Widget>[
Container(
height: 100,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 100,
itemBuilder: (context, index) {
return Dismissible(
direction: DismissDirection.down,
key: Key('$index'),
child: Card(
child: Container(
width: 100,
child: Text('${index}',
// here goes cutted long text
style: TextStyle(color: Colors.white),
),
),
),
);
},
),
),
],
),
);
}
}
链接图片,https://i.pinimg.com/564x/b7/f6/34/b7f6340dbb96212bc9c216e9bbc0d5da.jpg,stackoverflow 还不允许我发布图片:(
*编辑:我寻找的是根据子文本的长度动态设置每个卡片的高度
【问题讨论】: