mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
opt chatModel, linux same startup height as dart
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import '../../mobile/pages/home_page.dart';
|
||||
|
||||
enum ChatPageType {
|
||||
mobileMain,
|
||||
desktopCM,
|
||||
}
|
||||
|
||||
class ChatPage extends StatelessWidget implements PageShape {
|
||||
@@ -43,30 +44,39 @@ class ChatPage extends StatelessWidget implements PageShape {
|
||||
// only mobile need [appBarActions], just bind gFFI.chatModel
|
||||
final chatModel = gFFI.chatModel;
|
||||
return chatModel.messages.entries.map((entry) {
|
||||
final id = entry.key;
|
||||
final key = entry.key;
|
||||
final user = entry.value.chatUser;
|
||||
final client = gFFI.serverModel.clients
|
||||
.firstWhereOrNull((e) => e.id == id.connId);
|
||||
.firstWhereOrNull((e) => e.id == key.connId);
|
||||
final connected =
|
||||
gFFI.serverModel.clients.any((e) => e.id == key.connId);
|
||||
return PopupMenuItem<MessageKey>(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
id.isOut
|
||||
key.isOut
|
||||
? Icons.call_made_rounded
|
||||
: Icons.call_received_rounded,
|
||||
color: MyTheme.accent)
|
||||
.marginOnly(right: 6),
|
||||
Text("${user.firstName} ${user.id}"),
|
||||
if (connected)
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle, color: Colors.green),
|
||||
).marginSymmetric(horizontal: 2),
|
||||
if (client != null)
|
||||
unreadMessageCountBuilder(client.unreadChatMessageCount)
|
||||
],
|
||||
),
|
||||
value: id,
|
||||
value: key,
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
onSelected: (id) {
|
||||
gFFI.chatModel.changeCurrentID(id);
|
||||
onSelected: (key) {
|
||||
gFFI.chatModel.changeCurrentKey(key);
|
||||
})
|
||||
];
|
||||
|
||||
@@ -79,6 +89,17 @@ class ChatPage extends StatelessWidget implements PageShape {
|
||||
child: Consumer<ChatModel>(
|
||||
builder: (context, chatModel, child) {
|
||||
final currentUser = chatModel.currentUser;
|
||||
final readOnly = type == ChatPageType.mobileMain &&
|
||||
(chatModel.currentKey.connId == ChatModel.clientModeID ||
|
||||
gFFI.serverModel.clients.every((e) =>
|
||||
e.id != chatModel.currentKey.connId ||
|
||||
chatModel.currentUser == null)) ||
|
||||
type == ChatPageType.desktopCM &&
|
||||
gFFI.serverModel.clients
|
||||
.firstWhereOrNull(
|
||||
(e) => e.id == chatModel.currentKey.connId)
|
||||
?.disconnected ==
|
||||
true;
|
||||
return Stack(
|
||||
children: [
|
||||
LayoutBuilder(builder: (context, constraints) {
|
||||
@@ -88,11 +109,7 @@ class ChatPage extends StatelessWidget implements PageShape {
|
||||
messages: chatModel
|
||||
.messages[chatModel.currentKey]?.chatMessages ??
|
||||
[],
|
||||
readOnly: type == ChatPageType.mobileMain &&
|
||||
(chatModel.currentKey.connId ==
|
||||
ChatModel.clientModeID ||
|
||||
gFFI.serverModel.clients.every(
|
||||
(e) => e.id != chatModel.currentKey.connId)),
|
||||
readOnly: readOnly,
|
||||
inputOptions: InputOptions(
|
||||
focusNode: chatModel.inputNode,
|
||||
textController: chatModel.textController,
|
||||
|
||||
Reference in New Issue
Block a user