From 3ec13714c97926969cbd6b88646c4f9684bc4756 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 29 May 2023 09:44:38 +0800 Subject: [PATCH 1/2] opt mobile chat page style Signed-off-by: 21pages --- flutter/lib/common/widgets/chat_page.dart | 36 +++++++++-------------- flutter/lib/common/widgets/overlay.dart | 10 +++++-- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/flutter/lib/common/widgets/chat_page.dart b/flutter/lib/common/widgets/chat_page.dart index 6106bade5..affe94091 100644 --- a/flutter/lib/common/widgets/chat_page.dart +++ b/flutter/lib/common/widgets/chat_page.dart @@ -47,7 +47,6 @@ class ChatPage extends StatelessWidget implements PageShape { value: chatModel, child: Container( color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(14.0), child: Consumer( builder: (context, chatModel, child) { final currentUser = chatModel.currentUser; @@ -76,27 +75,20 @@ class ChatPage extends StatelessWidget implements PageShape { fontSize: 14, color: Theme.of(context).textTheme.titleLarge?.color), - inputDecoration: isDesktop - ? InputDecoration( - isDense: true, - hintText: translate('Write a message'), - filled: true, - fillColor: - Theme.of(context).colorScheme.background, - contentPadding: EdgeInsets.all(10), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10.0), - borderSide: const BorderSide( - width: 1, - style: BorderStyle.solid, - ), - ), - ) - : defaultInputDecoration( - hintText: translate('Write a message'), - fillColor: - Theme.of(context).colorScheme.background, - ), + inputDecoration: InputDecoration( + isDense: true, + hintText: translate('Write a message'), + filled: true, + fillColor: Theme.of(context).colorScheme.background, + contentPadding: EdgeInsets.all(10), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + borderSide: const BorderSide( + width: 1, + style: BorderStyle.solid, + ), + ), + ), sendButtonBuilder: defaultSendButton( padding: EdgeInsets.symmetric(horizontal: 6, vertical: 0), diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index 8c44e7ee4..73210b5fe 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -71,13 +71,19 @@ class DraggableChatWindow extends StatelessWidget { onPressed: () { chatModel.hideChatWindowOverlay(); }, - icon: const Icon(Icons.keyboard_arrow_down)), + icon: const Icon( + Icons.keyboard_arrow_down, + color: Colors.white, + )), IconButton( onPressed: () { chatModel.hideChatWindowOverlay(); chatModel.hideChatIconOverlay(); }, - icon: const Icon(Icons.close)) + icon: const Icon( + Icons.close, + color: Colors.white, + )) ], ) ], From b58fbb26ba670f05aa763bccd29ed8c80db4677b Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 29 May 2023 09:46:16 +0800 Subject: [PATCH 2/2] close chat page bofore remote page Signed-off-by: 21pages --- flutter/lib/common.dart | 1 + flutter/lib/models/chat_model.dart | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 544dabaf7..bd5005ffa 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -526,6 +526,7 @@ String formatDurationToTime(Duration duration) { closeConnection({String? id}) { if (isAndroid || isIOS) { + gFFI.chatModel.hideChatOverlay(); Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/")); } else { final controller = Get.find(); diff --git a/flutter/lib/models/chat_model.dart b/flutter/lib/models/chat_model.dart index ae8689dbb..21ffc1eef 100644 --- a/flutter/lib/models/chat_model.dart +++ b/flutter/lib/models/chat_model.dart @@ -7,7 +7,7 @@ import 'package:flutter_hbb/models/platform_model.dart'; import 'package:get/get_rx/src/rx_types/rx_types.dart'; import 'package:get/get.dart'; import 'package:window_manager/window_manager.dart'; - import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import '../consts.dart'; import '../common.dart'; @@ -185,6 +185,13 @@ class ChatModel with ChangeNotifier { } } + hideChatOverlay() { + if (!_isChatOverlayHide()) { + hideChatIconOverlay(); + hideChatWindowOverlay(); + } + } + showChatPage(int id) async { if (isConnManager) { if (!_isShowCMChatPage) {