我得到了SinglechildScrollview的StackoverFlowerRor
在运行调试应用程序时,我遇到了一个错误,但我不知道为什么显示此错误,我尝试排除singlechildScrollview
,但是出现了另一个错误,我不知道如何解决它。
我遇到的错误:
════════ Exception caught by widgets library ═══════════════════════════════════
The following StackOverflowError was thrown building NotificationListener<ScrollMetricsNotification>:
Stack Overflow
The relevant error-causing widget was
SingleChildScrollView
When the exception was thrown, this was the stack
#0 _StringBase.indexOf (dart:core-patch/string_patch.dart:359:7)
#1 String.indexOf (dart:core-patch/string_patch.dart:1068:18)
#2 _StringAllMatchesIterator.moveNext (dart:core-patch/string_patch.dart:1445:24)
#3 _StringBase.replaceAll (dart:core-patch/string_patch.dart:649:35)
#4 StackFrame.fromStackTraceLine
#5 MappedIterator.moveNext (dart:_internal/iterable.dart:391:20)
#6 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:869:20)
#7 new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#8 new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#9 new List.of (dart:core-patch/array_patch.dart:51:28)
#10 Iterable.toList (dart:core/iterable.dart:470:12)
#11 StackFrame.fromStackString
#12 FlutterError.defaultStackFilter
#13 DiagnosticsStackTrace._applyStackFilter
#14 new DiagnosticsStackTrace
#15 FlutterErrorDetails.debugFillProperties
#16 DiagnosticableNode.builder.<anonymous closure>
#17 DiagnosticableNode.builder
#18 _FlutterErrorDetailsNode.builder
#19 DiagnosticableNode.emptyBodyDescription
#20 DiagnosticsNode.toJsonMap.<anonymous closure>
#21 DiagnosticsNode.toJsonMap
#22 WidgetInspectorService._nodeToJson
#23 WidgetInspectorService._reportStructuredError
#24 FlutterError.reportError
#25 _debugReportException
#26 ComponentElement.performRebuild
#27 Element.rebuild
#28 ComponentElement._firstBuild
#29 ComponentElement.mount
... Normal element mounting (7 frames)
#36 Element.inflateWidget
#37 Element.updateChild
#38 ComponentElement.performRebuild
#39 StatefulElement.performRebuild
#40 Element.rebuild
...
...
#9597 ComponentElement.mount
... Normal element mounting (21 frames)
#9618 Element.inflateWidget
#9619 Element.updateChild
#9620 RenderObjectToWidgetElement._rebuild
#9621 RenderObjectToWidgetElement.mount
#9622 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
#9623 BuildOwner.buildScope
#9624 RenderObjectToWidgetAdapter.attachToRenderTree
#9625 WidgetsBinding.attachRootWidget
#9626 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
Reloaded 1 of 913 libraries in 748ms.
Reloaded 1 of 913 libraries in 514ms.
Reloaded 1 of 913 libraries in 503ms.
代码:
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: const BottomNavigation(),
body: SafeArea(
child: SingleChildScrollView(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(height: 35),
_appBar(),
const SizedBox(
height: 40,
),
const TitleText(text: "My wallet"),
const SizedBox(
height: 20,
),
const BalanceCard(),
const SizedBox(
height: 50,
),
const TitleText(
text: "Operations",
),
const SizedBox(
height: 10,
),
_operationsWidget(),
const SizedBox(
height: 40,
),
],
)),
)));
}
titletext widget:
class TitleText extends StatelessWidget {
final String text;
final double fontSize;
final Color color;
const TitleText(
{Key? key,
this.text = '',
this.fontSize = 18,
this.color = LightColor.navyBlue2})
: super(key: key);
@override
Widget build(BuildContext context) {
return Text(text,
style: GoogleFonts.mulish(
fontSize: fontSize, fontWeight: FontWeight.w800, color: color));
}
}
_operationswidget:
Widget _operationsWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_icon(Icons.transfer_within_a_station, "Transfer"),
_icon(Icons.phone, "Airtime"),
_icon(Icons.payment, "Pay Bills"),
_icon(Icons.code, "Qr Pay"),
],
);
}
非常感谢您提前提供帮助。
I got an error while running my debug app and i do not know why this error is showing, i tried excluding the SingleChildScrollView
but another error showing up and i do not know how to solve it.
The Error i got:
════════ Exception caught by widgets library ═══════════════════════════════════
The following StackOverflowError was thrown building NotificationListener<ScrollMetricsNotification>:
Stack Overflow
The relevant error-causing widget was
SingleChildScrollView
When the exception was thrown, this was the stack
#0 _StringBase.indexOf (dart:core-patch/string_patch.dart:359:7)
#1 String.indexOf (dart:core-patch/string_patch.dart:1068:18)
#2 _StringAllMatchesIterator.moveNext (dart:core-patch/string_patch.dart:1445:24)
#3 _StringBase.replaceAll (dart:core-patch/string_patch.dart:649:35)
#4 StackFrame.fromStackTraceLine
#5 MappedIterator.moveNext (dart:_internal/iterable.dart:391:20)
#6 WhereTypeIterator.moveNext (dart:_internal/iterable.dart:869:20)
#7 new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#8 new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#9 new List.of (dart:core-patch/array_patch.dart:51:28)
#10 Iterable.toList (dart:core/iterable.dart:470:12)
#11 StackFrame.fromStackString
#12 FlutterError.defaultStackFilter
#13 DiagnosticsStackTrace._applyStackFilter
#14 new DiagnosticsStackTrace
#15 FlutterErrorDetails.debugFillProperties
#16 DiagnosticableNode.builder.<anonymous closure>
#17 DiagnosticableNode.builder
#18 _FlutterErrorDetailsNode.builder
#19 DiagnosticableNode.emptyBodyDescription
#20 DiagnosticsNode.toJsonMap.<anonymous closure>
#21 DiagnosticsNode.toJsonMap
#22 WidgetInspectorService._nodeToJson
#23 WidgetInspectorService._reportStructuredError
#24 FlutterError.reportError
#25 _debugReportException
#26 ComponentElement.performRebuild
#27 Element.rebuild
#28 ComponentElement._firstBuild
#29 ComponentElement.mount
... Normal element mounting (7 frames)
#36 Element.inflateWidget
#37 Element.updateChild
#38 ComponentElement.performRebuild
#39 StatefulElement.performRebuild
#40 Element.rebuild
...
...
#9597 ComponentElement.mount
... Normal element mounting (21 frames)
#9618 Element.inflateWidget
#9619 Element.updateChild
#9620 RenderObjectToWidgetElement._rebuild
#9621 RenderObjectToWidgetElement.mount
#9622 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
#9623 BuildOwner.buildScope
#9624 RenderObjectToWidgetAdapter.attachToRenderTree
#9625 WidgetsBinding.attachRootWidget
#9626 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
Reloaded 1 of 913 libraries in 748ms.
Reloaded 1 of 913 libraries in 514ms.
Reloaded 1 of 913 libraries in 503ms.
The Code:
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: const BottomNavigation(),
body: SafeArea(
child: SingleChildScrollView(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(height: 35),
_appBar(),
const SizedBox(
height: 40,
),
const TitleText(text: "My wallet"),
const SizedBox(
height: 20,
),
const BalanceCard(),
const SizedBox(
height: 50,
),
const TitleText(
text: "Operations",
),
const SizedBox(
height: 10,
),
_operationsWidget(),
const SizedBox(
height: 40,
),
],
)),
)));
}
TitleText widget:
class TitleText extends StatelessWidget {
final String text;
final double fontSize;
final Color color;
const TitleText(
{Key? key,
this.text = '',
this.fontSize = 18,
this.color = LightColor.navyBlue2})
: super(key: key);
@override
Widget build(BuildContext context) {
return Text(text,
style: GoogleFonts.mulish(
fontSize: fontSize, fontWeight: FontWeight.w800, color: color));
}
}
_operationsWidget:
Widget _operationsWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
_icon(Icons.transfer_within_a_station, "Transfer"),
_icon(Icons.phone, "Airtime"),
_icon(Icons.payment, "Pay Bills"),
_icon(Icons.code, "Qr Pay"),
],
);
}
Thank you so much for your help in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将
容器
包装在展开
小部件中Try wrapping the
Container
inExpanded
Widget