[英]Flutter The relevant error-causing widget was Scaffold lib\main.dart:14
This is My Code Block这是我的代码块
MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
centerTitle: true,
title: Text("Resume"),
//shadowColor: Colors.grey,
),
body: SingleChildScrollView(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 70),
child: Image.asset("images/kafa.jpeg"),
),
ListTile(leading: Padding(padding: const EdgeInsets.only(top: 8 , left: 20),
child: Icon(
Icons.library_books_outlined,
size: 12,
color: Colors.black54,
),
),
title: Text("TRY"),
)
],
)
),
),
);
This is the error这是错误
════════ Exception caught by rendering library ═════════════════════════════════
Assertion failed:
D:\…\rendering\box.dart:1927
hasSize
"RenderBox was not laid out: RenderRepaintBoundary#10e41 relayoutBoundary=up1 NEEDS-PAINT"
The relevant error-causing widget was
Scaffold
lib\main.dart:14
When I delete these lines当我删除这些行时
ListTile(leading: Padding(padding: const EdgeInsets.only(top: 8 , left: 20),
child: Icon(
Icons.library_books_outlined,
size: 12,
color: Colors.black54,
),
),
title: Text("TRY"),
It's working.它的工作。
But I can't figure out how I can do that.但我不知道我该怎么做。 I just get this error我刚收到这个错误
Wrap the ListView with an Expanded
so it fills up the available space.用Expanded
包装 ListView 以填充可用空间。
Update your code to this:将您的代码更新为:
Expanded(
child: ListTile(
leading: Padding(
padding: const EdgeInsets.only(top: 8, left: 20),
child: Icon(
Icons.library_books_outlined,
size: 12,
color: Colors.black54,
),
),
title: Text("TRY"),
))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.