Houzi Docs logo Houzi Docs

Houzi proivdes you with the getDrawerMenuItemDesignHook() for providing widget for custom drawer menu row design. Simply open the file from the following path:

Project_HOME > lib > hooks_v2.dart

Look for the getDrawerMenuItemDesignHook() method.

@override
  DrawerMenuItemDesignHook? getDrawerMenuItemDesignHook() {
    DrawerMenuItemDesignHook drawerMenuItemDesignHook = ({
      required iconData, required label, required onTap, required selectedItem}) {
      // return your design widget here
      return null;
    };

    // return drawerMenuItemDesignHook;
    return null;
  }

You are provided with the following parameter:

Let’s dive into the details of each parameter.

label

You are provided with the String type label parameter which is the label of the row. You can use the this parameter as label text in your custom design widget.

iconData

You are provided with the IconData type iconData parameter which is used in the Icon widget of the row. You can use the this parameter in the Icon widget of your custom design widget.

selectedItem

You are provided with the String type selectedItem parameter which is the current selected item of the drawer menu. You can use the this parameter in your custom design widget accordingly.

onTap

You are provided with the VoidCallback type onTap parameter which is the callback on drawer menu row. You can use the this parameter in your custom design widget accordingly.

Return drawerMenuItemDesignHook instead of null for the modifications to work.

@override
  DrawerMenuItemDesignHook? getDrawerMenuItemDesignHook() {
    DrawerMenuItemDesignHook drawerMenuItemDesignHook = ({
      required iconData, required label, required onTap, required selectedItem}) {
      // return your design widget here
    };

    return drawerMenuItemDesignHook;
  }

After modifications, restart the app and the changes will reflect in your app.

Previous: Perform Action on Add Property Next: Add item in Settings