fix chat model

This commit is contained in:
rustdesk
2022-05-16 00:01:27 +08:00
parent 0b869e89a3
commit c3bc539a61
7 changed files with 91 additions and 57 deletions

View File

@@ -21,10 +21,9 @@ class ChatPage extends StatelessWidget implements PageShape {
icon: Icon(Icons.group),
itemBuilder: (context) {
final chatModel = FFI.chatModel;
final serverModel = FFI.serverModel;
return chatModel.messages.entries.map((entry) {
final id = entry.key;
final user = serverModel.clients[id]?.chatUser ?? chatModel.me;
final user = entry.value.chatUser;
return PopupMenuItem<int>(
child: Text("${user.name} ${user.uid}"),
value: id,
@@ -54,7 +53,9 @@ class ChatPage extends StatelessWidget implements PageShape {
chatModel.send(chatMsg);
},
user: chatModel.me,
messages: chatModel.messages[chatModel.currentID] ?? [],
messages:
chatModel.messages[chatModel.currentID]?.chatMessages ??
[],
// default scrollToBottom has bug https://github.com/fayeed/dash_chat/issues/53
scrollToBottom: false,
scrollController: chatModel.scroller,

View File

@@ -91,7 +91,9 @@ class _RemotePageState extends State<RemotePage> {
if (v < 100) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: []);
if (chatWindowOverlayEntry == null) {
// [pi.version.isNotEmpty] -> check ready or not,avoid login without soft-keyboard
if (chatWindowOverlayEntry == null &&
FFI.ffiModel.pi.version.isNotEmpty) {
FFI.invokeMethod("enable_soft_keyboard", false);
}
}
@@ -397,33 +399,33 @@ class _RemotePageState extends State<RemotePage> {
] +
(isDesktop
? []
: [
IconButton(
color: Colors.white,
icon: Icon(Icons.keyboard),
onPressed: openKeyboard),
FFI.ffiModel.isPeerAndroid
? (keyboard
? IconButton(
color: Colors.white,
icon: Icon(Icons.build),
onPressed: () {
if (mobileActionsOverlayEntry == null) {
showMobileActionsOverlay();
} else {
hideMobileActionsOverlay();
}
},
)
: SizedBox.shrink())
: IconButton(
: FFI.ffiModel.isPeerAndroid
? [
IconButton(
color: Colors.white,
icon: Icon(Icons.build),
onPressed: () {
if (mobileActionsOverlayEntry == null) {
showMobileActionsOverlay();
} else {
hideMobileActionsOverlay();
}
},
)
]
: [
IconButton(
color: Colors.white,
icon: Icon(FFI.ffiModel.touchMode
? Icons.touch_app
: Icons.mouse),
onPressed: changeTouchMode,
)
]) +
icon: Icon(Icons.keyboard),
onPressed: openKeyboard),
IconButton(
color: Colors.white,
icon: Icon(FFI.ffiModel.touchMode
? Icons.touch_app
: Icons.mouse),
onPressed: changeTouchMode,
),
]) +
(isWeb
? []
: <Widget>[