我试图在我的颤振页面中有另一个小部件,所以我因为 RadarChart.light 而收到此错误:
════════渲染库捕获的异常 ════════════════════════════════════ 渲染填充对象在布局期间被赋予了无限大小。 导致错误的相关小部件是 填充 ══
══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════我该如何解决这个问题
法典
SafeArea(
child: Scaffold(
body: AppBackground(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 9.0),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
const HeadWidget(title: "Computer Science"),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RadarChart.light(
ticks: ticks,
features: features,
data: data,
),
Text(
"PERFORMANCE BY COURSE",
style: GoogleFonts.roboto(
color: Kwhite, fontWeight: FontWeight.w700),
),
const PerformanceByCourseCard(),
SizedBox(
height: MediaQuery.of(context).size.height / 20,
),
Text(
"PERFORMANCE SUMMARY",
style: GoogleFonts.roboto(
color: KRedOrange, fontWeight: FontWeight.w700),
),
const PerformanceSummaryCards(),
Text(
"PERFORMANCE BY PLO",
style: GoogleFonts.roboto(
color: KRedOrange, fontWeight: FontWeight.w700),
),
const PerformanceByPLOCard(),
Text(
"PERFORMANCE BY GA",
style: GoogleFonts.roboto(
color: KRedOrange, fontWeight: FontWeight.w700),
),
const PerformanceByGACard(),
],
),
RoundedButton(
text: "DOWNLOAD YOUR TRANSCRIPT",
press: (context) {},
fontSize: 12,
margin: 0,
paddingHorizontal: 0,
paddingVertical: 0,
borderRadius: 5,
),
]),
)))));
您不能将列小部件放在列内,这意味着无限高度的父母不能抱着被赋予无限高度的孩子。 同样在放置 singleChildScrollView 的顶层,不要使用它或使用固定高度的 ssizeBox 包装您的列。它将解决您的问题。