The named parameter 'child' isn't defined. – in container

I want to use "child" to create a row in a container, but unfortunatly I am getting this error:

The named parameter 'child' isn't defined.:29

What I am doing wrong? I tried to find the mistake over 2 days, but I can’t find it. In combination with a container it should actually work to define a "child" or not? I hope u can help me.

Here is the code of my program:
the error occur in row 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",
                        ),
                      ],
                    ),
                  ],
                )
            )
        ],
      ),
      )
    );
  }
}

Thank you a lot for helping me.

>Solution :

The "BoxDecoration(" is not closed

Leave a Reply