[英]The relevant error-causing widget was: Scaffold
dashboardScreen() {
return Scaffold(
backgroundColor: Colors.white,
body: Positioned(child:
SingleChildScrollView(
child: Positioned(child: Column(
//margin: const EdgeInsets.fromLTRB(0, 40, 0, 30),
children: persons.map((p) {
return personDetailCard(p);
}).toList()
),
),
),
),
);
}
I'm getting this error how can i solve it?我收到此错误,我该如何解决?
The following assertion was thrown building AnimatedBuilder(animation: AnimationController#e4385(⏭ 1.000; paused), state: _AnimatedState#3a637): 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4957 pos 16: 'child is: ParentDataElement'.
抛出以下断言构建 AnimatedBuilder(animation: AnimationController#e4385(⏭ 1.000; paused), state: _AnimatedState#3a637): 'package:flutter/src/widgets/framework.dart': 断言失败: line 4957 pos 16: '孩子是:ParentDataElement'。 is not true.
不是真的。
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
断言表明框架本身存在错误,或者我们应该在此错误消息中提供更多信息,以帮助您确定和修复根本原因。 In either case, please report this assertion by filing a bug on GitHub:
无论哪种情况,请通过在 GitHub 上提交错误来报告此断言:
https://github.com/flutter/flutter/issues/new?template=2_bug.mdhttps://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was: Scaffold file:///C:/Users/Saffar%20Khan/Documents/GitHub/flutter_app_afs/afs_mobile_flutter/lib/dashboard_Receiver.dart:190:12 When the exception was thrown, this was the stack: #2 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4957:16) #3 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #4 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4958:15) #5 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #6 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4958:15)
相关的导致错误的小部件是: Scaffold file:///C:/Users/Saffar%20Khan/Documents/GitHub/flutter_app_afs/afs_mobile_flutter/lib/dashboard_Receiver.dart:190:12 抛出异常时,这是堆栈: #2 ParentDataElement._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4957:16) #3 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #4 ParentDataElement ._applyParentData.applyParentDataToChild (package:flutter/src/widgets/framework.dart:4958:15) #5 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14) #6 ParentDataElement._applyParentData.applyParentDataToChild (包:flutter/src/widgets/framework.dart:4958:15)
As you're not using Stack
, you must remove Positioned
widget.由于您没有使用
Stack
,因此您必须删除Positioned
小部件。
Try this tree:试试这棵树:
Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Column(
//margin: const EdgeInsets.fromLTRB(0, 40, 0, 30),
children: persons.map((p) {
return personDetailCard(p);
}).toList(),
),
),
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.