buildUserProfile method

Widget buildUserProfile(
  1. BuildContext context
)

Implementation

Widget buildUserProfile(BuildContext context) {
  return PopupMenuButton<String>(
    offset: const Offset(0, 55),
    onSelected: onSelected ??
        (String value) {
          switch (value) {
            case 'birthday':
              homeController.setEndDrawerContent(context, EventsDrawer());
              break;
            case 'change_password':
              homeController.changePassword();
              break;
            case 'settings':
              homeController.navigateToSettingScreen();
              break;
            case 'logout':
              homeController.postLogOutAPI();
              break;
          }
        },
    itemBuilder: (BuildContext context) => [
      PopupMenuItem(
        value: 'birthday',
        child: Row(
          children: [
            const Icon(CupertinoIcons.calendar),
            buildSizeWidth(10.0),
            AppText(AppStrings.birthday, style: TextStyles.normal(context)),
          ],
        ),
      ),
      PopupMenuItem(
        value: 'change_password',
        child: Row(
          children: [
            const Icon(CupertinoIcons.lock_open),
            buildSizeWidth(10.0),
            AppText(AppStrings.changePassword, style: TextStyles.normal(context)),
          ],
        ),
      ),
      PopupMenuItem(
        value: 'settings',
        child: Row(
          children: [
            const Icon(CupertinoIcons.gear),
            buildSizeWidth(10.0),
            AppText(AppStrings.settings, style: TextStyles.normal(context)),
          ],
        ),
      ),
      PopupMenuItem(
        value: 'logout',
        child: Row(
          children: [
            const Icon(CupertinoIcons.square_arrow_right),
            buildSizeWidth(10.0),
            AppText(AppStrings.logout, style: TextStyles.normal(context)),
          ],
        ),
      ),
    ],
    child: Container(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Row(
        children: [
          const ProfileAvatar(
              imagePath: 'assets/images/demo_profile.png',
              height: 35.0,
              width: 35.0),
          buildSizeWidth(10.0),
          AppText(storageUtils.getUserName() ?? '', style: TextStyles.normal(context)),
          buildSizeWidth(5.0),
          const Icon(Icons.keyboard_arrow_down_rounded),
        ],
      ),
    ),
  );
}