cm unread message count
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
769e46d3e6
commit
7c4c69aa75
@ -160,8 +160,22 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
child: label),
|
child: label),
|
||||||
Obx(() => Offstage(
|
Obx(() => Offstage(
|
||||||
offstage:
|
offstage:
|
||||||
!(client?.hasUnreadChatMessage.value ?? false),
|
!((client?.unreadChatMessageCount.value ?? 0) > 0),
|
||||||
child: Icon(Icons.circle, color: Colors.red, size: 10)))
|
child: Container(
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.red,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"${client?.unreadChatMessageCount.value ?? 0}",
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white, fontSize: 10)),
|
||||||
|
),
|
||||||
|
).marginOnly(left: 4)))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -318,7 +318,7 @@ class ChatModel with ChangeNotifier {
|
|||||||
final currentSelectedTab =
|
final currentSelectedTab =
|
||||||
session.serverModel.tabController.state.value.selectedTabInfo;
|
session.serverModel.tabController.state.value.selectedTabInfo;
|
||||||
if (currentSelectedTab.key != id.toString() && inputNode.hasFocus) {
|
if (currentSelectedTab.key != id.toString() && inputNode.hasFocus) {
|
||||||
client.hasUnreadChatMessage.value = true;
|
client.unreadChatMessageCount.value += 1;
|
||||||
} else {
|
} else {
|
||||||
parent.target?.serverModel.jumpTo(id);
|
parent.target?.serverModel.jumpTo(id);
|
||||||
toId = id;
|
toId = id;
|
||||||
|
@ -463,8 +463,8 @@ class ServerModel with ChangeNotifier {
|
|||||||
label: client.name,
|
label: client.name,
|
||||||
closable: false,
|
closable: false,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (client.hasUnreadChatMessage.value) {
|
if (client.unreadChatMessageCount.value > 0) {
|
||||||
client.hasUnreadChatMessage.value = false;
|
client.unreadChatMessageCount.value = 0;
|
||||||
final chatModel = parent.target!.chatModel;
|
final chatModel = parent.target!.chatModel;
|
||||||
chatModel.showChatPage(client.id);
|
chatModel.showChatPage(client.id);
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ class Client {
|
|||||||
bool inVoiceCall = false;
|
bool inVoiceCall = false;
|
||||||
bool incomingVoiceCall = false;
|
bool incomingVoiceCall = false;
|
||||||
|
|
||||||
RxBool hasUnreadChatMessage = false.obs;
|
RxInt unreadChatMessageCount = 0.obs;
|
||||||
|
|
||||||
Client(this.id, this.authorized, this.isFileTransfer, this.name, this.peerId,
|
Client(this.id, this.authorized, this.isFileTransfer, this.name, this.peerId,
|
||||||
this.keyboard, this.clipboard, this.audio);
|
this.keyboard, this.clipboard, this.audio);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user