chatItem method
Implementation
chatItem(GroupListModel data, index) {
return Padding(
padding: const EdgeInsets.only(left: 12, right: 12),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MessageView(
groupId: data.groupId,
title: data.groupName,
//opponentUserId: data.opponentUserId,
theme: theme,
isGroup: data.isGroup,userBlocked: data.isBlocked)));
},
child: Row(
children: [
Common.profileNetworkImage(
borderRadius: 56.0,
height: 56.0,
width: 56.0,
placeHolder: data.isGroup!
? ImageResource.groupPlaceHolder
: ImageResource.profilePlaceHolder,
imageUrl: data.imagePath),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
data.groupName!,
style: CustomTextStyles.semiBold(
fontSize: 16.0,
fontColor: theme.palette.getAccent800(),
),
),
),
const SizedBox(width: 10),
data.latestTime == null
? const SizedBox.shrink()
: Text(
Utilities.convertTimeStampToDate(
data.latestTime!.seconds ?? ""),
style: CustomTextStyles.normal(
fontSize: 10.0, fontColor: theme.palette.mode == PaletteThemeModes.light?Colors.black38:Colors.white38),
)
],
),
const SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
data.msgType == "text" ||
data.recentMsg == null ||
data.msgType == ""
? const SizedBox.shrink()
: Image.asset(
data.msgType == "audio"
? ImageResource.audioIc
: data.msgType == "video"
? ImageResource.videoIc
: data.msgType == "image"
? ImageResource.imageIc
: ImageResource.documentIc,
height: 20,
width: 20,
package: "aplus_chat",
),
Container(
width: MediaQuery.of(context).size.width/2,
child: Text(
data.msgType! == ""
? AppStorages.languageKey!["start_your_conversation"]!
: data.msgType! == "text"
? data.recentMsg!
: " ${data.msgType!}",
style: CustomTextStyles.normal(
fontSize: 12.0,
fontColor: theme.palette.getAccent500(),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
data.unreadCount == 0
? const SizedBox.shrink()
: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: theme.palette.getAccent800()),
padding: const EdgeInsets.only(
left: 4.5, right: 4, top: 1.5, bottom: 1),
child: Text(
"${data.unreadCount}",
style: CustomTextStyles.medium(
fontSize: 10.0,
fontColor: Colors.white,
),
),
)
// CircleAvatar(
// backgroundColor: Colors.red,
// radius: 10,
// child: Text(
// "100",
// style: CustomTextStyles.medium(
// fontSize: 8.0,
// fontColor: Colors.white,
// ),
// ),
// )
],
)
],
),
)
],
),
),
);
}