menuBody method

dynamic menuBody(
  1. BuildContext context, {
  2. bool separator = false,
  3. FontWeight textWeight = FontWeight.w500,
  4. Color color = Colors.black,
  5. double padding = 12.0,
  6. TemplateRF? template,
  7. Function? onTap,
})

Implementation

menuBody(
  BuildContext context, {
  bool separator = false,
  FontWeight textWeight = FontWeight.w500,
  Color color = Colors.black,
  double padding = 12.0,
  TemplateRF? template,
  Function? onTap,
}) {
  //template = TemplateRF.get();
  if (template!.name == TemplateNameRF.modern && template.version == 'Oval') {
    separator = true;
    textWeight = FontWeight.w500;
    color = Colors.black;
    padding = 12.0;
  } else if (template.name == TemplateNameRF.modern) {
    separator = false;
    textWeight = FontWeight.w500;
    color = Colors.white;
    padding = 6.0;
  } else if (template.name == TemplateNameRF.material) {
    separator = true;
    textWeight = FontWeight.w500;
    color = Colors.black;
    padding = 12.0;
  }

  if (Libs.config.app.outline?.customOutline().drawerItems == null) {
    var sciStandard = [
      DrawerItemRF(
        icon: FontAwesomeIcons.userAlt,
        text: 'My Profile',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFFf77f00),
        padding: padding,
        template: _template,
        onTap: () {
          return onTap!("My Profile");
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.userLock,
        text: 'Change Password',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFF2a9d8f),
        padding: padding,
        template: _template,
        onTap: () {
          rf.page.call(context, ChangePass(), refreshCaller: true);
          return onTap!("Change Password");
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.cloudMeatball,
        text: 'Internet Usage',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFFe63946),
        padding: padding,
        template: _template,
        onTap: () {
          rf.page.call(context, InternetUsage(), refreshCaller: true);
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.database,
        text: 'Email Data Backup',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFF7209b7),
        padding: padding,
        template: _template,
        onTap: () {
          return onTap!("Email Data Backup");
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.microphone,
        text: 'Language Setting',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFF27AE60),
        padding: padding,
        template: _template,
        onTap: () {
          rf.page.call(
              context,
              LanguageSelection(
                  title: Libs.config.app.title,
                  languages: [
                     LanguageItems(
                      isOnboarding: false,
                      name: "English",
                      text: "This is English Language",
                      img: 'assets/images/lan-en.png',
                      locale: 'en',
                    ),
                     LanguageItems(
                      isOnboarding: false,
                      name: "Bangla",
                      text: "এটি বাংলা ভাষা",
                      img: "assets/images/lan-bg.png",
                      locale: 'bn',
                    )
                  ],
                  isOnboarding: false),
              refreshCaller: true);
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.cog,
        text: 'Data Download',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFF01baef),
        padding: padding,
        template: _template,
        onTap: () {
          return onTap!("Data Setting");
        },
      ),
      DrawerItemRF(
        icon: FontAwesomeIcons.signOutAlt,
        text: 'LogOut',
        separator: separator,
        textWeight: textWeight,
        color: Color(0xFFffc300),
        padding: padding,
        template: _template,
        onTap: () {
          return onTap!("logout");
        },
      ),
    ];

    if (template.directives != null) if (template.directives['DrawerMenuBodySetVersion'] ==
        'SCI') {
      return Libs.config.app.outline!.customOutline().drawerItems ?? sciStandard;
    }
    if (template.name == TemplateNameRF.modern && template.version == 'SCI') {
      return Libs.config.app.outline?.customOutline().drawerItems ?? sciStandard;
    }
    if (template.name == TemplateNameRF.modern || template.name == TemplateNameRF.material) {
      return Libs.config.app.outline?.customOutline().drawerItems ?? sciStandard;
    }
  } else {
    return Libs.config.app.outline?.customOutline(onDrawerItemClick: onTap!).drawerItems;
  }
}