gpt4 book ai didi

flutter - 得到错误 `Failed assertion: line 1687 pos 12: ' hasSize '` when render ListTile inside ` Row`

转载 作者:行者123 更新时间:2023-12-03 15:23:56 27 4
gpt4 key购买 nike

我在 flutter 中有以下代码。

Widget build(BuildContext context) {
return Center(
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
height: 100,
child: ListTile(
leading: IconButton(
iconSize: 30,
icon: roundImage(post.userPicture, Icon(Icons.person)),
onPressed: () {},
),
subtitle: Text(this.post.message),
)),
],
),
],
),
),
);
}

但我收到此错误:
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#7713c relayoutBoundary=up3
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1687 pos 12: 'hasSize'
The relevant error-causing widget was
Card

我已添加 SizedBoxRow但它仍然提示 hasSize错误。我该如何解决这个问题?

最佳答案

目前尚不清楚您要实现的目标,而是使用 SizedBox你可以试试包裹在里面 ExpandedFlexible小部件。

关于flutter - 得到错误 `Failed assertion: line 1687 pos 12: ' hasSize '` when render ListTile inside ` Row`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61847782/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com