chatAppBar method

dynamic chatAppBar(
  1. BuildContext context
)

Implementation

chatAppBar(BuildContext context) {
  return Obx(() {
    return AppBar(
      automaticallyImplyLeading: false,
      leadingWidth: 80,
      leading: InkWell(
        onTap: () {
          if (controller.showEmoji.value) {
            controller.showEmoji(false);
          } else if (NavUtils.previousRoute.isEmpty) {
            NavUtils.offAllNamed(Routes.dashboard);
          } else {
            Navigator.pop(context);
          }
        },
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            const SizedBox(
              width: 10,
            ),
            const Icon(Icons.arrow_back),
            const SizedBox(
              width: 10,
            ),
            ImageNetwork(
              url: controller.profile.image.checkNull(),
              width: AppStyleConfig.chatPageStyle.chatUserAppBarStyle
                  .profileImageSize.width, //35,
              height: AppStyleConfig.chatPageStyle.chatUserAppBarStyle
                  .profileImageSize.height, //35,
              clipOval: true,
              isGroup: controller.profile.isGroupProfile.checkNull(),
              errorWidget: controller.profile.isGroupProfile ?? false
                  ? ClipOval(
                      child: AppUtils.assetIcon(
                        assetName: groupImg,
                        width: AppStyleConfig.chatPageStyle
                            .chatUserAppBarStyle.profileImageSize.width, //35,
                        height: AppStyleConfig
                            .chatPageStyle
                            .chatUserAppBarStyle
                            .profileImageSize
                            .height, //35,
                        fit: BoxFit.cover,
                      ),
                    )
                  : ProfileTextImage(
                      text: controller.profile.getName(),
                      /*controller.profile.name.checkNull().isEmpty
                          ? controller.profile.nickName.checkNull().isEmpty
                              ? controller.profile.mobileNumber.checkNull()
                              : controller.profile.nickName.checkNull()
                          : controller.profile.name.checkNull(),*/
                      radius: 18,
                    ),
              blocked: controller.profile.isBlockedMe.checkNull() ||
                  controller.profile.isAdminBlocked.checkNull(),
              unknown: (!controller.profile.isItSavedContact.checkNull() ||
                  controller.profile.isDeletedContact()),
            ),
          ],
        ),
      ),
      title: SizedBox(
        width: (NavUtils.width) / 1.9,
        child: InkWell(
          highlightColor: Colors.transparent,
          onTap: (controller.arguments?.chatInfoPageRedirect).checkNull()
              ? () {
                  LogMessage.d("title clicked",
                      controller.profile.isGroupProfile.toString());
                  controller.infoPage();
                }
              : null,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                controller.profile.getName(),
                /*controller.profile.name.checkNull().isEmpty
                    ? controller.profile.nickName.checkNull()
                    : controller.profile.name.checkNull(),*/
                overflow: TextOverflow.fade,
                style: AppStyleConfig
                    .chatPageStyle.chatUserAppBarStyle.titleTextStyle,
              ),
              Obx(() {
                return controller.groupParticipantsName.isNotEmpty
                    ? SizedBox(
                        width: NavUtils.width * 0.90,
                        height: 15,
                        child: Marquee(
                          text: "${controller.groupParticipantsName}",
                          style: AppStyleConfig.chatPageStyle
                              .chatUserAppBarStyle.subtitleTextStyle,
                          blankSpace: 25,
                        ))
                    : controller.subtitle.isNotEmpty
                        ? Text(
                            controller.subtitle,
                            style: AppStyleConfig
                                .chatPageStyle
                                .chatUserAppBarStyle
                                .subtitleTextStyle, //const TextStyle(fontSize: 12),
                            overflow: TextOverflow.fade,
                          )
                        : const SizedBox();
              })
            ],
          ),
        ),
      ),
      actions: (controller.arguments?.menuActionsEnabled).checkNull()
          ? actionBarItems(context, isSelected: false)
          : const [],
    );
  });
}