appBar method

Widget appBar()

Implementation

Widget appBar() {
  return SafeArea(
    child: Container(
      color: widget.theme!.palette.getAccent200(),
      padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
      child: Row(
        children: [
          const SizedBox(width: 10),
          InkWell(
              onTap: () {
                willPop();
              },
              child:  Icon(Platform.isAndroid?Icons.arrow_back:Icons.arrow_back_ios,color: widget.theme!.palette.getAccent800(),)),
          const SizedBox(width: 8),
          GestureDetector(
            onTap: () {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => !widget.isGroup!
                        ? ContactInfoView(userId: opponentUserId,theme: widget.theme,)
                        : GroupInfoView(groupId: groupId),
                  ));
            },
            child: Obx(() => Common.profileNetworkImage(
              borderRadius: 60.0,
              height: 40.0,
              width: 40.0,
              placeHolder: widget.isGroup!
                  ? ImageResource.groupPlaceHolder
                  : ImageResource.profilePlaceHolder,
              imageUrl: groupImage.value,
            )),
          ),
          const SizedBox(width: 8),
          Obx(
                () => Expanded(
              child: GestureDetector(
                onTap: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => !widget.isGroup!
                          ? ContactInfoView(userId: opponentUserId,theme: widget.theme,)
                          : GroupInfoView(groupId: groupId),
                    ),
                  );
                },
                child: isUserOnline.value || otherUserTyping.value
                    ? Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(groupName.value,
                        style: CustomTextStyles.semiBold(
                            fontSize: 18.0, fontColor: widget.theme!.palette.accent.light)),
                    otherUserTyping.value
                        ? Text(
                      otherUserTyping.value
                          ? widget.isGroup!
                          ? "${otherTyingUserName.value} ${AppStorages.languageKey!["typing"]!}"
                          : AppStorages.languageKey!["typing"]!
                          : "",
                      style: CustomTextStyles.medium(
                          fontSize: 14.0, fontColor: Colors.blue),
                    )
                        : isUserOnline.value && !widget.isGroup!
                        ? Text(
                      " ${AppStorages.languageKey!["online"]!}",
                      style: CustomTextStyles.medium(
                          fontSize: 14.0,
                          fontColor: Colors.green),
                    )
                        : const SizedBox.shrink(),
                  ],
                )
                    : Text(groupName.value,
                    style: CustomTextStyles.semiBold(
                        fontSize: 18.0, fontColor: widget.theme!.palette.accent.light)),
              ),
            ),
          ),
          Obx(() => !hasActionPermission.value
              ? const SizedBox.shrink()
              : PopupMenuButton<int>(
            icon:  Icon(
              Icons.more_vert_outlined,
              color: widget.theme!.palette.accent.light,
            ),
            // ignore: invalid_use_of_protected_member
            itemBuilder: (context) => actionList.value,
            offset: const Offset(0, 50),
            color: widget.theme!.palette.primary.light,
            elevation: 2,
          )),
        ],
      ),
    ),
  );
}