当前位置:网站首页>Incorrect use of parentdatawidget when the exception was thrown, this was the stack:
Incorrect use of parentdatawidget when the exception was thrown, this was the stack:
2022-07-26 12:55:00 【Flutter Mengxin College】
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.
The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type StackParentData.
Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a Stack widget.
The ownership chain for the RenderObject that received the incompatible parent data was:
ConstrainedBox ← Container ← Expanded ← Stack ← Column ← Padding ← ColoredBox ← ConstrainedBox ← Container ← Consumer<InvestmentModel> ← ⋯
When the exception was thrown, this was the stack:
#0 RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:5816:11)
#1 RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:5832:6)
#2 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:5066:15)
#3 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4729:14)
#4 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:5069:15)
...
====================================================================================================
flutter: ViewStateModel---constructor--->DocumentaryModel
Error reporting discovery Stack I don't know what is wrong in the layout , Look at the code
It turns out that
Expanded Components , stay “Container、Padding、Stack” Caused in the component .
Expanded、Flexible Only in Row、Column In other components , Not used in other components .
Modify the method to remove Expanded
return Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.fromLTRB(16, 6, 16, 0),
color: appWhite,
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Stack(children: [
Expanded( // Get rid of this
child: Container(
width: MediaQuery.of(context).size.width,
child: _buildAmountTextField(model)),
),
Positioned(
right: 1.0,
bottom: 0,
child: Container(
margin: EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 42,
child: CupertinoButtonWidget(
radius: 4,
color: appWhite,
child: Text(
S().string_documentary_investment_max,
style: t14blue),
onPressed: () {
model.setMax(context);
})),
SizedBox(
width: 4,
),
Container(
width: 1,
height: 42,
color: colorD8D8D8,
),
SizedBox(
width: 12,
),
Text(data?.investmentCoinSymbol ?? "",
style: t16blackNormal),
]),
))
]),
边栏推荐
- Transactional transaction propagation behavior?
- Problems encountered in byte stream exercises and Solutions
- LCD notes (7) LCD driver framework_ Configure clock
- (int argc, char** argv) command line parameters in visual stdio (VS)
- 今日睡眠质量记录75分
- LCD笔记(6)LCD驱动程序框架_配置引脚
- 数据查询WHERE
- JDBC从连接池获取连接(Druid连接池)
- 【5GC】什么是5G切片?5G切片如何工作?
- Interviewer: how to deal with high concurrency?
猜你喜欢

今日睡眠质量记录75分
![[wechat applet] read the article, data request](/img/9a/3b9aef6c5f5735b886252ec830798c.png)
[wechat applet] read the article, data request

Transformer dominates the world? Depth wise conv has something to say

食品安全 | 微波炉什么食品都能加热?这些安全隐患要知道

LCD笔记(4)分析内核自带的LCD驱动程序

Detailed interpretation of hole convolution (input and output size analysis)

Kubernetes----PV和PVC的生命周期简介

Visual stdio(VS)中的(int argc、char** argv)命令行参数

Sword finger offer 24. reverse the linked list

什么是回调函数,对于“回”字的理解
随机推荐
Ue5 official case Lyra full feature explanation 7. resource management
Tencent cloud and smart industry business group (CSIG) adjusted the organizational structure and established the digital twin product department
QT introduction and case explanation
Kubernetes----PV和PVC的生命周期简介
LCD笔记(6)LCD驱动程序框架_配置引脚
最好的工程师,就是这样被你“逼”走的!
Removable tablespace
Detailed interpretation of hole convolution (input and output size analysis)
After being fined "paid leave" for one month, Google fired him who "loves" AI
Optical distance sensing chip 4530a combining ambient light, proximity sensing and infrared ranging
RMII, smii, gmii, rgmii interfaces of Ethernet Driver
数据查询函数
Access database cannot connect
[wechat applet] read the article, data request
jvm:类加载子系统干什么的?由什么组成?需要记住哪些八股文?
Code error reporting and problem solving experience II: test error reporting in yolov5
Minesweeping games - easy to play addictive (C language version)
2022 employment season! Adobe helps creative industry workers break through the shackles of skills and return to the source of ability
What is a callback function? Understanding of the word "back"
Yolov7 training dangerous goods identification pytorch