listtilechat static method
Widget
listtilechat(
- BuildContext context, {
- required Chat chat,
- required dynamic onPressed(
- Chat chat
- required VoidCallback onDelete,
- bool showlastlogindate = false,
Implementation
static Widget listtilechat(
BuildContext context, {
required Chat chat,
required Function(Chat chat) onPressed,
required VoidCallback onDelete,
bool showlastlogindate = false,
}) {
return ListTile(
contentPadding: const EdgeInsets.symmetric(vertical: 0, horizontal: 5),
leading: CircleAvatar(
backgroundColor: Colors.transparent,
foregroundImage: CachedNetworkImageProvider(
chat.user.avatar!.mediaURL.minURL.value,
),
radius: 28,
),
tileColor: chat.chatNotification.value ? Colors.red.shade900 : null,
title: CustomText.costum1(chat.user.displayName!.value),
subtitle: chat.lastmessage!.value.messageContext == "null"
? const Text("")
: Row(
children: [
Expanded(
child: RichText(
maxLines: 2,
overflow: TextOverflow.ellipsis,
text: TextSpan(
children: [
if (chat.lastmessage!.value.messageContext == "null")
const WidgetSpan(
child: Icon(
Icons.done_all,
color: Color.fromRGBO(116, 243, 20, 1),
size: 14,
),
),
if (chat.lastmessage!.value.messageContext == "null")
const WidgetSpan(
child: SizedBox(width: 5),
),
showlastlogindate
? TextSpan(
text: chat.user.detailInfo!.value!.lastloginDate
.toString(),
style: TextStyle(
color: Get.theme.primaryColor
.withValues(alpha: 0.8),
),
)
: TextSpan(
text: chat.lastmessage!.value.messageContext,
style: TextStyle(
color: Get.theme.primaryColor
.withValues(alpha: 0.8),
),
),
],
),
),
),
],
),
trailing: chat.chatType == APIChat.ozel
? const Icon(Icons.person)
: const Icon(Icons.people_alt),
onTap: () {
chat.chatNotification.value = false;
onPressed(chat);
},
onLongPress: () {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
builder: (context) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
leading: const Icon(Icons.delete, color: Colors.red),
title: const Text('Sil'),
onTap: () {
Navigator.pop(context);
onDelete();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Öğe silindi.'),
),
);
},
),
],
),
),
);
},
);
},
);
}