chat fix
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:community_material_icon/community_material_icon.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/chat_model.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
@@ -53,9 +55,38 @@ class _MessagesScreenState extends State<MessagesScreen> {
|
||||
child: ListView.builder(
|
||||
itemCount: list.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final user = list[index].user;
|
||||
final lastMsg = list[index].messages.last;
|
||||
|
||||
return ListTile(
|
||||
title: Text(
|
||||
list[index].user?.name ?? '',
|
||||
(user?.name ?? ''),
|
||||
),
|
||||
subtitle: Text(
|
||||
'" ${lastMsg.content} "',
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
leading: ReferencePhoto(
|
||||
ref: user?.photo,
|
||||
size: 55,
|
||||
sizeCircle: 60,
|
||||
),
|
||||
trailing: Column(
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.black,
|
||||
),
|
||||
Text(
|
||||
lastMsg.timestamp.day >= DateTime.now().day
|
||||
? DateFormat('h:mm a').format(lastMsg.timestamp)
|
||||
: DateFormat('dd/MM/yyyy', 'es')
|
||||
.format(lastMsg.timestamp),
|
||||
style:
|
||||
const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Event.getEventById(list[index].id).then((value) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:community_material_icon/community_material_icon.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/chat_model.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
@@ -57,9 +59,33 @@ class _MessagesUserScreenState extends State<MessagesUserScreen> {
|
||||
|
||||
return ListTile(
|
||||
title: Text(
|
||||
(pro?.name ?? '') +
|
||||
' "' +
|
||||
(lastMsg.content + lastMsg.timestamp.toString()),
|
||||
(pro?.name ?? ''),
|
||||
),
|
||||
subtitle: Text(
|
||||
'" ${lastMsg.content} "',
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
leading: ReferencePhoto(
|
||||
ref: pro?.photo,
|
||||
size: 55,
|
||||
sizeCircle: 60,
|
||||
),
|
||||
trailing: Column(
|
||||
children: [
|
||||
SizedBox(height: 8),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.black,
|
||||
),
|
||||
Text(
|
||||
lastMsg.timestamp.day >= DateTime.now().day
|
||||
? DateFormat('h:mm a').format(lastMsg.timestamp)
|
||||
: DateFormat('dd/MM/yyyy', 'es')
|
||||
.format(lastMsg.timestamp),
|
||||
style:
|
||||
const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Event.getEventById(list[index].id).then((value) {
|
||||
|
||||
Reference in New Issue
Block a user