未定义命名参数 'child'。 - 在容器中
The named parameter 'child' isn't defined. - in container
我想使用“child”在容器中创建一行,但不幸的是我收到了这个错误:
The named parameter 'child' isn't defined.:29
我做错了什么?我试图在 2 天内找到错误,但找不到。结合容器,它实际上应该定义一个“child”吗?希望你能帮帮我。
这是我的程序代码:
错误发生在第 29 行
import 'package:fitness_webserver/constants/style.dart';
import 'package:fitness_webserver/pages/overview/widgets/bar_chart.dart';
import 'package:fitness_webserver/pages/overview/widgets/revenue_info.dart';
import 'package:fitness_webserver/widgets/custom_text.dart';
import 'package:flutter/material.dart';
class RevenueSectionLarge extends StatelessWidget {
const RevenueSectionLarge({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
margin: EdgeInsets.symmetric(vertical: 30),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
offset: Offset(0,6),
color: lightGrey.withOpacity(.1),
blurRadius: 12
),
],
border: Border.all(
color: lightGrey,
width: .5,
),
child: Row( //here is the error
children: [
Expanded(child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomText(
text: "Revenue Chart",
size: 20,
weight: FontWeight.bold,
color: lightGrey,
),
Container(
width: 600,
height: 200,
child: SimpleBarChart.withSampleData(),
)
],
),),
Container(
width: 1,
height: 120,
color: lightGrey,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
RevenueInfo(
title: "Today\'s revenue",
amount: "23",
),
RevenueInfo(
title: "Last 7 days",
amount: "150",
),
],
),
SizedBox(
height: 30,
),
Row(
children: [
RevenueInfo(
title: "Last 30 days",
amount: "1,203",
),
RevenueInfo(
title: "Last 12 months",
amount: "3,234",
),
],
),
],
)
)
],
),
)
);
}
}
非常感谢你帮助我。
“BoxDecoration(”未关闭
我想使用“child”在容器中创建一行,但不幸的是我收到了这个错误:
The named parameter 'child' isn't defined.:29
我做错了什么?我试图在 2 天内找到错误,但找不到。结合容器,它实际上应该定义一个“child”吗?希望你能帮帮我。
这是我的程序代码: 错误发生在第 29 行
import 'package:fitness_webserver/constants/style.dart';
import 'package:fitness_webserver/pages/overview/widgets/bar_chart.dart';
import 'package:fitness_webserver/pages/overview/widgets/revenue_info.dart';
import 'package:fitness_webserver/widgets/custom_text.dart';
import 'package:flutter/material.dart';
class RevenueSectionLarge extends StatelessWidget {
const RevenueSectionLarge({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
margin: EdgeInsets.symmetric(vertical: 30),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
offset: Offset(0,6),
color: lightGrey.withOpacity(.1),
blurRadius: 12
),
],
border: Border.all(
color: lightGrey,
width: .5,
),
child: Row( //here is the error
children: [
Expanded(child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomText(
text: "Revenue Chart",
size: 20,
weight: FontWeight.bold,
color: lightGrey,
),
Container(
width: 600,
height: 200,
child: SimpleBarChart.withSampleData(),
)
],
),),
Container(
width: 1,
height: 120,
color: lightGrey,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
RevenueInfo(
title: "Today\'s revenue",
amount: "23",
),
RevenueInfo(
title: "Last 7 days",
amount: "150",
),
],
),
SizedBox(
height: 30,
),
Row(
children: [
RevenueInfo(
title: "Last 30 days",
amount: "1,203",
),
RevenueInfo(
title: "Last 12 months",
amount: "3,234",
),
],
),
],
)
)
],
),
)
);
}
}
非常感谢你帮助我。
“BoxDecoration(”未关闭