This commit is contained in:
2022-10-26 14:09:51 +08:00
parent 76bd3f94fd
commit 72807d7233
3 changed files with 62 additions and 3 deletions

View File

@@ -38,7 +38,6 @@ class PrivateController extends GetxController {
true) {
currentFriend.value.shopId =
info.friendInfo!.userProfile?.customInfo!['Staffer'];
currentFriend.value.isStaffer = true;
}
/// 通过用户自定义字段,判断是否允许陌生人消息

View File

@@ -9,7 +9,6 @@ class PrivateConversationModel {
String friendRemark;
V2TimConversation? conversation;
V2TimUserFullInfo? userProfile;
bool isStaffer;
bool allowStranger; // 允许陌生人消息
String? shopId; // 他是哪个店铺的客服
@@ -19,7 +18,6 @@ class PrivateConversationModel {
this.isFriend = false,
this.conversation,
this.userProfile,
this.isStaffer = false,
this.allowStranger = true,
this.shopId,
});

View File

@@ -1,7 +1,11 @@
import 'package:chat/configs/app_colors.dart';
import 'package:chat/controllers/group_controller.dart';
import 'package:chat/controllers/private_controller.dart';
import 'package:chat/routes/contact_routes.dart';
import 'package:chat/routes/conversation_routes.dart';
import 'package:chat/services/tim/conversation_service.dart';
import 'package:chat/views/conversation/widgets/message_field.dart';
import 'package:chat/views/conversation/widgets/message_list.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tencent_im_sdk_plugin/enum/conversation_type.dart';
@@ -61,7 +65,65 @@ class _ConversationPageState extends State<ConversationPage> {
_topRightAction(),
],
),
body: Column(
children: [
if (conversation.type == ConversationType.V2TIM_C2C)
_isFriendWidget(),
Expanded(
child: MessageList(conversation),
),
],
),
bottomNavigationBar: MessageField(
conversation,
key: inputextField,
),
),
);
}
Widget _isFriendWidget() {
return GetX<PrivateController>(
builder: (_) {
if (!_.currentFriend.value.isFriend) {
return Container(
color: AppColors.warning.withOpacity(0.2),
width: Get.width,
padding: const EdgeInsets.all(8),
child: Row(
children: [
const Text(
'你们还不是好友,请先',
style: TextStyle(
color: AppColors.unactive,
fontSize: 12,
),
),
const SizedBox(width: 4),
InkWell(
onTap: () {
Get.toNamed(
ContactRoutes.friendRequestApply,
arguments: {
'userID': conversation.userID!,
},
);
},
child: const Text(
'添加好友',
style: TextStyle(
color: AppColors.primary,
fontSize: 12,
),
),
),
],
),
);
} else {
return Container();
}
},
);
}