Skip to content

Commit

Permalink
[#194 feat] : User profile redirection from Chat by clicking username…
Browse files Browse the repository at this point in the history
… or display picture (#203)
  • Loading branch information
Alpha17-2 authored Jun 20, 2024
2 parents d39db67 + 2cc36ca commit e82864a
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 48 deletions.
25 changes: 16 additions & 9 deletions lib/view/reusable_components/message_container.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wave/models/message_model.dart';
import 'package:wave/models/user_model.dart';
import 'package:wave/utils/constants/custom_fonts.dart';

import 'package:wave/utils/device_size.dart';
import 'package:wave/utils/routing.dart';

class MessageContainer extends StatelessWidget {
Message message;
Expand Down Expand Up @@ -46,15 +48,20 @@ class MessageContainer extends StatelessWidget {
: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
CircleAvatar(
backgroundImage: (sender.displayPicture != null &&
sender.displayPicture!.isNotEmpty)
? CachedNetworkImageProvider(sender.displayPicture!)
: null,
child: sender.displayPicture == null ||
sender.displayPicture!.isEmpty
? const Icon(Icons.person)
: null,
InkWell(
onTap: () {
Get.toNamed(AppRoutes.profileScreen,arguments: sender.id);
},
child: CircleAvatar(
backgroundImage: (sender.displayPicture != null &&
sender.displayPicture!.isNotEmpty)
? CachedNetworkImageProvider(sender.displayPicture!)
: null,
child: sender.displayPicture == null ||
sender.displayPicture!.isEmpty
? const Icon(Icons.person)
: null,
),
),
const SizedBox(
width: 4,
Expand Down
83 changes: 44 additions & 39 deletions lib/view/screens/ChatScreen/inbox_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:developer';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
Expand All @@ -15,6 +14,7 @@ import 'package:wave/utils/constants/custom_fonts.dart';
import 'package:wave/utils/constants/database_endpoints.dart';
import 'package:wave/utils/device_size.dart';
import 'package:wave/utils/enums.dart';
import 'package:wave/utils/routing.dart';
import 'package:wave/view/reusable_components/custom_textbox_for_comment.dart';
import 'package:wave/view/reusable_components/message_container.dart';
import 'package:wave/view/screens/ChatScreen/more_options_message.dart';
Expand Down Expand Up @@ -56,44 +56,49 @@ class _InboxScreenState extends State<InboxScreen> {
appBar: AppBar(
backgroundColor: CustomColor.primaryBackGround,
leadingWidth: displayWidth(context) * 0.1,
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
CircleAvatar(
backgroundImage: (otherUser!.displayPicture != null &&
otherUser!.displayPicture!.isNotEmpty)
? CachedNetworkImageProvider(otherUser!.displayPicture!)
: null,
radius: 20,
child: otherUser!.displayPicture == null ||
otherUser!.displayPicture!.isEmpty
? const Icon(Icons.person)
: null,
),
const SizedBox(
width: 20,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
otherUser!.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
fontFamily: CustomFont.poppins),
),
Text(
otherUser!.username,
style: TextStyle(
fontSize: 13,
color: Colors.grey,
fontFamily: CustomFont.poppins),
),
],
)
],
title: InkWell(
onTap: () {
Get.toNamed(AppRoutes.profileScreen,arguments: otherUser!.id);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
CircleAvatar(
backgroundImage: (otherUser!.displayPicture != null &&
otherUser!.displayPicture!.isNotEmpty)
? CachedNetworkImageProvider(otherUser!.displayPicture!)
: null,
radius: 20,
child: otherUser!.displayPicture == null ||
otherUser!.displayPicture!.isEmpty
? const Icon(Icons.person)
: null,
),
const SizedBox(
width: 20,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
otherUser!.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
fontFamily: CustomFont.poppins),
),
Text(
otherUser!.username,
style: TextStyle(
fontSize: 13,
color: Colors.grey,
fontFamily: CustomFont.poppins),
),
],
)
],
),
),
actions: [
IconButton(onPressed: () {}, icon: const Icon(AntDesign.more_outline))
Expand Down

0 comments on commit e82864a

Please sign in to comment.