dart - Flutter中基于动态数据扩展卡片高度
问题描述
我需要根据动态数据设置卡片的高度。我的卡片没有显示卡片中的全部内容。
Card(
child: Container(
padding: EdgeInsets.all(7.0),
child: Wrap(
direction: Axis.horizontal,
spacing: 200.0, // gap between adjacent chips
runSpacing: 0.0,
children: <Widget>[
Container(
height: 40.0,
decoration: new BoxDecoration(
color: Colors.grey[800],
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(10.0),
topRight: const Radius.circular(10.0),
),
),
child: Column(
children: <Widget>[
Align(
child: Container(
padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
margin: const EdgeInsets.all(8.0),
child: Text(
contactUs.title,
style: Theme.of(context).textTheme.headline,
),
),
),
],
)),
Container(
padding: EdgeInsets.all(3.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Container(
child: Column(
children: <Widget>[
subtitlesLength > 0
? _listSubtitleSection(contactUs.subtitles)
: Container(),
],
),
),
),
Container(
child: Column(
children: <Widget>[
contactUs.addresses.length > 0
? _listAddressSection(contactUs.addresses)
: Container(),
],
),
),
contactUs.email != ''
? Container(
child: GestureDetector(
child: Text(
'Email: ' + contactUs.email,
style: new TextStyle(
color: Theme.of(context).primaryColor,
height: 1.5,
decoration: TextDecoration.underline,
),
),
onTap: () {
_launchURL(contactUs.email);
},
),
)
: Container(),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0),
child: Container(
child: Column(
children: <Widget>[
contactUs.links.length > 0
? _listLinksSection(contactUs.links)
: Container(),
],
),
),
),
Container(
child: Column(
children: <Widget>[
Divider(
color: Theme.of(context).accentColor,
),
FlatButton(
color: Colors.white,
child: Row(
children: <Widget>[
Icon(Icons.place,
color:
Theme.of(context).primaryColor),
Text(
'Show on maps',
style: TextStyle(
color:
Theme.of(context).primaryColor),
),
],
),
onPressed: () {
launchMap(contactUs.map);
}),
],
),
),
],
),
),
],
),
),
)
我将一半的数据加载到卡中,未显示剩余内容。我试图在卡内放置容器的高度,但这不起作用。我需要帮助来解决这个问题。任何帮助表示赞赏。提前致谢。
解决方案
删除 listView 构建器的 itemExtent 属性解决了这个问题。
推荐阅读
- c++ - 使用 devenv 命令行构建 Visual Studio 解决方案
- python - python groupby 类别列创建新的计数列
- c# - 从数据访问层收集垃圾
- vba - 为什么我使用对话框插入带有 vba-word 的图片时出现“运行时错误 438”
- scope - 从 SignalR 核心集线器中的范围请求 DbContext,向其传递连接字符串
- c# - 如何从另一个控制器重定向到随机 ID?
- matlab - 如何从 3D 数组中沿固定维度的元素获取向量?
- java - 钥匙代表什么?
- python - 在运行行为克隆方面需要帮助
- javascript - 使用 lodash 检查数组元素是否包含另一个数组元素的子字符串