skip to Main Content

Friends, my codes are as follows, but I get the error I wrote in the title on line 51, which is the drawer. I would appreciate your help.

I marked the part with the error

enter image description here

2

Answers


  1. NavigationDrawer required parameter children, add this parameter like below

          drawer: const NavigationDrawer(
            children: [],
          ),
    
    
    Login or Signup to reply.
  2. For drawer you have provide required children parameter

     drawer: const NavigationDrawer(
                children: <Widget>[
                 //widgets here
                 
                ],
              ),
    

    you can also accomplish drawer by using Drawer widget
    I have used ListView as child of Drawer

    drawer: Drawer(
            backgroundColor: kPrimaryBackGroundColor,
            child: ListView(
              children: [
                NavHeader(),
                const Divider(
                  color: kPrimaryBorderColor,
                ),
                DrawerItem("About Us", Icons.local_offer_outlined ,  AboutUs()),
                DrawerItem("Account", Icons.account_circle, ProfileScreen()),
                DrawerItem("Stats", Icons.query_stats, UserStats())
    
              ],
            ),
          )
    

    ,

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search