【发布时间】:2020-11-13 18:56:02
【问题描述】:
Anyne 知道这个错误是什么吗?我认为有些孩子不能放在里面?
接收到不兼容父数据的 RenderObject 的所有权链是: _GestureSemantics ← RawGestureDetector ← GestureDetector ← Expanded ← ColoredBox ← Container ← Padding ← ColoredBox ← ConstrainedBox ← Container ← ⋯
Container(
height: 35,
width: 150,
color: Colors.blueGrey,
child: Row(
children: [
Container(
width: 35,
height: double.infinity,
color: Colors.blue,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.black,
child: Expanded(
child: GestureDetector(
onTap: () {
setState(() {
intAmount = int.parse(amount);
intAmount--;
amount = intAmount.toString();
print(intAmount);
});
},
child: SizedBox(
child: Image(
image:
AssetImage('images/plus.png'),
),
),
),
),
),
),
),
Expanded(
child: Container(
height: double.infinity,
color: Colors.black,
child: Center(
child: GestureDetector(
onTap: () {},
child: Text(
'$intAmount',
style: TextStyle(
color: Colors.amber,
),
),
),
),
),
),
Container(
width: 35,
height: double.infinity,
color: Colors.orange,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.black,
child: GestureDetector(
onTap: () {
setState(() {
intAmount = int.parse(amount);
intAmount++;
amount = intAmount.toString();
print(intAmount);
});
//*********************************** */
},
child: Expanded(
child: SizedBox(
child: Image(
image: AssetImage(
'images/minus.png'),
),
),
),
),
),
),
)
],
),
)
【问题讨论】:
-
指出错误出现的行
标签: flutter