Home > Back-end >  Too many arguments found but 0 expected
Too many arguments found but 0 expected

Time:05-24

I keep getting these messages saying too many arguments 0 expected but 4 found and also positional arguments must occur before named arguments. Here's my code

  @override
  Widget build(BuildContext context) {
    return Container(
      height: double.infinity,
      width: 280.0,
      color: Theme.of(context).primaryColor,
      child: Row(
        children: [
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Column(
              children: const [
                // logo
              ],
            ),
          ),
        ],
      ),
      _SideMenuIconTab(
        iconData: Icons.home_outlined,
        title: "Home",
        onTap: () {},
      ),
      _SideMenuIconTab(
        iconData: Icons.search,
        title: "Search",
        onTap: () {},
      ),
      _SideMenuIconTab(
        iconData: Icons.download_for_offline,
        title: "Offline",
        onTap: () {},
      ),

CodePudding user response:

See how you have your _SideMenuIconTab inside Container but not in Row Add this inside of Row

enter image description here

CodePudding user response:

Please update your code with below

      @override
      Widget build(BuildContext context) {
        return Container(
          height: double.infinity,
          width: 280.0,
          color: Theme.of(context).primaryColor,
          child: Row(
            children: [
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: Column(
                  children: const [
                    // logo
                  ],
                ),
              ),
            ],
          ),
          );
}

If you want to add _SideMenuIconTab please share complete code along with the what you want to achieve. so we can check your code and find the exact solution. For now by updating your code with this, you will not face any error.

CodePudding user response:

Well, your structure is just wrong. That is the fact and that is what your compiler is telling you. What you wanted it to look like is not something we could find out from the code you posted, so it's guesswork.

Maybe you meant the three _SideMenuIconTabs to go into one of the arrays that you created as the children: property of your Row and Column? Maybe you meant to create another Row or Column to put them in? Whatever it was you wanted to do, you need to find a widget that can hold multiple other widgets to put them in. They cannot just "be there".

  • Related