|
|
@ -146,171 +146,168 @@ class ChatListItem extends StatelessWidget {
|
|
|
|
? 20.0
|
|
|
|
? 20.0
|
|
|
|
: 14.0
|
|
|
|
: 14.0
|
|
|
|
: 0.0;
|
|
|
|
: 0.0;
|
|
|
|
return Center(
|
|
|
|
return ListTile(
|
|
|
|
child: Material(
|
|
|
|
selected: selected,
|
|
|
|
color: FluffyThemes.chatListItemColor(context, activeChat, selected),
|
|
|
|
selectedTileColor:
|
|
|
|
child: ListTile(
|
|
|
|
FluffyThemes.chatListItemColor(context, activeChat, selected),
|
|
|
|
onLongPress: onLongPress,
|
|
|
|
onLongPress: onLongPress,
|
|
|
|
leading: selected
|
|
|
|
leading: selected
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
width: Avatar.defaultSize,
|
|
|
|
width: Avatar.defaultSize,
|
|
|
|
height: Avatar.defaultSize,
|
|
|
|
height: Avatar.defaultSize,
|
|
|
|
child: Material(
|
|
|
|
child: Material(
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
borderRadius: BorderRadius.circular(Avatar.defaultSize),
|
|
|
|
borderRadius: BorderRadius.circular(Avatar.defaultSize),
|
|
|
|
child: Icon(Icons.check, color: Colors.white),
|
|
|
|
child: Icon(Icons.check, color: Colors.white),
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
|
|
|
|
|
|
|
|
title: Row(
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
|
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
|
|
|
softWrap: false,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (isMuted)
|
|
|
|
)
|
|
|
|
Padding(
|
|
|
|
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
|
|
|
|
padding: const EdgeInsets.only(left: 4.0),
|
|
|
|
title: Row(
|
|
|
|
child: Icon(
|
|
|
|
children: <Widget>[
|
|
|
|
Icons.notifications_off_outlined,
|
|
|
|
Expanded(
|
|
|
|
size: 16,
|
|
|
|
child: Text(
|
|
|
|
),
|
|
|
|
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
|
|
|
),
|
|
|
|
maxLines: 1,
|
|
|
|
if (room.isFavourite)
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
Padding(
|
|
|
|
softWrap: false,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
),
|
|
|
|
right: room.notificationCount > 0 ? 4.0 : 0.0),
|
|
|
|
),
|
|
|
|
child: Icon(
|
|
|
|
if (isMuted)
|
|
|
|
Icons.push_pin_outlined,
|
|
|
|
Padding(
|
|
|
|
size: 16,
|
|
|
|
padding: const EdgeInsets.only(left: 4.0),
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
child: Icon(
|
|
|
|
),
|
|
|
|
Icons.notifications_off_outlined,
|
|
|
|
),
|
|
|
|
size: 16,
|
|
|
|
Padding(
|
|
|
|
),
|
|
|
|
padding: const EdgeInsets.only(left: 4.0),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
if (room.isFavourite)
|
|
|
|
room.timeCreated.localizedTimeShort(context),
|
|
|
|
Padding(
|
|
|
|
style: TextStyle(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
fontSize: 13,
|
|
|
|
right: room.notificationCount > 0 ? 4.0 : 0.0),
|
|
|
|
color: room.notificationCount > 0
|
|
|
|
child: Icon(
|
|
|
|
? Theme.of(context).colorScheme.secondary
|
|
|
|
Icons.push_pin_outlined,
|
|
|
|
: null,
|
|
|
|
size: 16,
|
|
|
|
),
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 4.0),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
room.timeCreated.localizedTimeShort(context),
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
|
|
|
color: room.notificationCount > 0
|
|
|
|
|
|
|
|
? Theme.of(context).colorScheme.secondary
|
|
|
|
|
|
|
|
: null,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
subtitle: Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
if (typingText.isEmpty && ownMessage) ...{
|
|
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
|
|
room.lastEvent.statusIcon,
|
|
|
|
|
|
|
|
size: 14,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(width: 4),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
AnimatedContainer(
|
|
|
|
|
|
|
|
width: typingText.isEmpty ? 0 : 18,
|
|
|
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
|
|
|
curve: Curves.bounceInOut,
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(right: 4),
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.edit_outlined,
|
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
|
|
|
|
size: 14,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
subtitle: Row(
|
|
|
|
if (typingText.isEmpty &&
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
!ownMessage &&
|
|
|
|
children: <Widget>[
|
|
|
|
!room.isDirectChat &&
|
|
|
|
if (typingText.isEmpty && ownMessage) ...{
|
|
|
|
room.lastEvent != null &&
|
|
|
|
Icon(
|
|
|
|
room.lastEvent.type == EventTypes.Message &&
|
|
|
|
room.lastEvent.statusIcon,
|
|
|
|
{MessageTypes.Text, MessageTypes.Notice}
|
|
|
|
size: 14,
|
|
|
|
.contains(room.lastEvent.messageType))
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
SizedBox(width: 4),
|
|
|
|
'${room.lastEvent.sender.calcDisplayname()}: ',
|
|
|
|
},
|
|
|
|
style: TextStyle(
|
|
|
|
AnimatedContainer(
|
|
|
|
color: Theme.of(context).textTheme.bodyText1.color,
|
|
|
|
width: typingText.isEmpty ? 0 : 18,
|
|
|
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
|
|
|
curve: Curves.bounceInOut,
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(right: 4),
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
Icons.edit_outlined,
|
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
|
|
|
|
size: 14,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (typingText.isEmpty &&
|
|
|
|
),
|
|
|
|
!ownMessage &&
|
|
|
|
Expanded(
|
|
|
|
!room.isDirectChat &&
|
|
|
|
child: typingText.isNotEmpty
|
|
|
|
room.lastEvent != null &&
|
|
|
|
? Text(
|
|
|
|
room.lastEvent.type == EventTypes.Message &&
|
|
|
|
typingText,
|
|
|
|
{MessageTypes.Text, MessageTypes.Notice}
|
|
|
|
style: TextStyle(
|
|
|
|
.contains(room.lastEvent.messageType))
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
Text(
|
|
|
|
),
|
|
|
|
'${room.lastEvent.sender.calcDisplayname()}: ',
|
|
|
|
softWrap: false,
|
|
|
|
style: TextStyle(
|
|
|
|
)
|
|
|
|
color: Theme.of(context).textTheme.bodyText1.color,
|
|
|
|
: room.membership == Membership.invite
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: typingText.isNotEmpty
|
|
|
|
|
|
|
|
? Text(
|
|
|
|
? Text(
|
|
|
|
typingText,
|
|
|
|
L10n.of(context).youAreInvitedToThisChat,
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
softWrap: false,
|
|
|
|
softWrap: false,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: room.membership == Membership.invite
|
|
|
|
: Text(
|
|
|
|
? Text(
|
|
|
|
room.lastEvent?.getLocalizedBody(
|
|
|
|
L10n.of(context).youAreInvitedToThisChat,
|
|
|
|
MatrixLocals(L10n.of(context)),
|
|
|
|
style: TextStyle(
|
|
|
|
hideReply: true,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
) ??
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
'',
|
|
|
|
),
|
|
|
|
softWrap: false,
|
|
|
|
softWrap: false,
|
|
|
|
maxLines: 1,
|
|
|
|
)
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
: Text(
|
|
|
|
style: TextStyle(
|
|
|
|
room.lastEvent?.getLocalizedBody(
|
|
|
|
color: room.isUnread
|
|
|
|
MatrixLocals(L10n.of(context)),
|
|
|
|
? Theme.of(context).colorScheme.secondary
|
|
|
|
hideReply: true,
|
|
|
|
: null,
|
|
|
|
) ??
|
|
|
|
fontWeight: room.isUnread ? FontWeight.bold : null,
|
|
|
|
'',
|
|
|
|
decoration: room.lastEvent?.redacted == true
|
|
|
|
softWrap: false,
|
|
|
|
? TextDecoration.lineThrough
|
|
|
|
maxLines: 1,
|
|
|
|
: null,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
),
|
|
|
|
color: room.isUnread
|
|
|
|
),
|
|
|
|
? Theme.of(context).colorScheme.secondary
|
|
|
|
SizedBox(width: 8),
|
|
|
|
: null,
|
|
|
|
AnimatedContainer(
|
|
|
|
fontWeight:
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
room.isUnread ? FontWeight.bold : null,
|
|
|
|
curve: Curves.bounceInOut,
|
|
|
|
decoration: room.lastEvent?.redacted == true
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 7),
|
|
|
|
? TextDecoration.lineThrough
|
|
|
|
height: unreadBubbleSize,
|
|
|
|
: null,
|
|
|
|
width: room.notificationCount == 0 && !room.isUnread
|
|
|
|
),
|
|
|
|
? 0
|
|
|
|
),
|
|
|
|
: unreadBubbleSize,
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
SizedBox(width: 8),
|
|
|
|
color: room.highlightCount > 0
|
|
|
|
AnimatedContainer(
|
|
|
|
? Colors.red
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
: Theme.of(context).primaryColor,
|
|
|
|
curve: Curves.bounceInOut,
|
|
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 7),
|
|
|
|
),
|
|
|
|
height: unreadBubbleSize,
|
|
|
|
child: Center(
|
|
|
|
width: room.notificationCount == 0 && !room.isUnread
|
|
|
|
child: room.notificationCount > 0
|
|
|
|
? 0
|
|
|
|
? Text(
|
|
|
|
: unreadBubbleSize,
|
|
|
|
room.notificationCount.toString(),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
style: TextStyle(
|
|
|
|
color: room.highlightCount > 0
|
|
|
|
color: Colors.white,
|
|
|
|
? Colors.red
|
|
|
|
fontSize: 13,
|
|
|
|
: Theme.of(context).primaryColor,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
: Container(),
|
|
|
|
child: Center(
|
|
|
|
),
|
|
|
|
child: room.notificationCount > 0
|
|
|
|
|
|
|
|
? Text(
|
|
|
|
|
|
|
|
room.notificationCount.toString(),
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
fontSize: 13,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: Container(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () => clickAction(context),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: () => clickAction(context),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|