Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#187 feat] : Timestamps for messages in chat made visible #204

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/view/reusable_components/custom_textbox_for_comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class CustomTextBoxForComments extends StatelessWidget {
),
header ?? const SizedBox.shrink(),
ListTile(
visualDensity: VisualDensity(horizontal: -2),
tileColor: backgroundColor,

leading: CircleAvatar(
radius: 20,
backgroundImage: (imageUrl != null && imageUrl!.isNotEmpty)
Expand Down
81 changes: 58 additions & 23 deletions lib/view/reusable_components/message_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class MessageContainer extends StatelessWidget {
required this.sender,
required this.message});

final double fontsize = 14;

@override
Widget build(BuildContext context) {
return (sender.id == currentUser.id)
Expand All @@ -32,14 +34,33 @@ class MessageContainer extends StatelessWidget {
borderRadius: BorderRadius.circular(14),
),
padding: const EdgeInsets.all(10.0),
child: Text(
message.message,
style: TextStyle(
color: Colors.black87,
letterSpacing: 0.08,
fontFamily: CustomFont.inter,
fontSize: displayWidth(context) * 0.038,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
message.message,
style: TextStyle(
color: Colors.black87,
letterSpacing: 0.08,
fontFamily: CustomFont.poppins,
fontSize: fontsize,
),
),
Wrap(
textDirection: TextDirection.rtl,
verticalDirection: VerticalDirection.down,
children: [
Text(
'${message.createdAt.hour}:${message.createdAt.minute}',
style: const TextStyle(
fontSize: 8,
color: Colors.green,
fontWeight: FontWeight.bold),
),
],
)
],
),
),
)
Expand All @@ -50,7 +71,7 @@ class MessageContainer extends StatelessWidget {
children: [
InkWell(
onTap: () {
Get.toNamed(AppRoutes.profileScreen,arguments: sender.id);
Get.toNamed(AppRoutes.profileScreen, arguments: sender.id);
},
child: CircleAvatar(
backgroundImage: (sender.displayPicture != null &&
Expand All @@ -71,23 +92,37 @@ class MessageContainer extends StatelessWidget {
constraints:
BoxConstraints(maxWidth: displayWidth(context) * 0.7),
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Color(0xfb2193b0),
Color(0xfb6dd5ed)
// Colors.orange[600]!,
]),
color: Colors.grey.shade200,
borderRadius: BorderRadius.circular(14),
),
padding: const EdgeInsets.all(7.0),
child: Text(
message.message,
style: TextStyle(
color: Colors.white,
fontSize: displayWidth(context) * 0.036,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
message.message,
style: TextStyle(
color: Colors.black87,
letterSpacing: 0.08,
fontFamily: CustomFont.poppins,
fontSize: fontsize,
),
),
Wrap(
textDirection: TextDirection.rtl,
verticalDirection: VerticalDirection.down,
children: [
Text(
'${message.createdAt.hour}:${message.createdAt.minute}',
style: const TextStyle(
fontSize: 8,
color: Colors.teal,
fontWeight: FontWeight.bold),
),
],
)
],
),
),
)
Expand Down
6 changes: 4 additions & 2 deletions lib/view/screens/ChatScreen/inbox_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _InboxScreenState extends State<InboxScreen> {
leadingWidth: displayWidth(context) * 0.1,
title: InkWell(
onTap: () {
Get.toNamed(AppRoutes.profileScreen,arguments: otherUser!.id);
Get.toNamed(AppRoutes.profileScreen, arguments: otherUser!.id);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
Expand Down Expand Up @@ -106,7 +106,9 @@ class _InboxScreenState extends State<InboxScreen> {
),
body: CustomTextBoxForComments(
commentController: messageController,
sendWidget: const Icon(Bootstrap.send_plus),
sendWidget: Container(
padding: const EdgeInsets.all(8),
child: const Icon(Bootstrap.send_plus)),
labelText: "Message",
sendButtonMethod: () async {
if (messageController!.text.trim().isNotEmpty) {
Expand Down