通讯录完成
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:chat/services/tim_service.dart';
|
||||
import 'package:chat/utils/im_tools.dart';
|
||||
import 'package:chat/utils/network/http.dart';
|
||||
import 'package:chat/utils/ui_tools.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:lpinyin/lpinyin.dart';
|
||||
import 'package:tencent_im_sdk_plugin/enum/friend_type_enum.dart';
|
||||
@@ -27,6 +28,30 @@ class TimFriendService extends GetxService {
|
||||
/// 格式化后的联系人信息
|
||||
var contacts = List<ContactInfoModel>.empty(growable: true).obs;
|
||||
|
||||
final List<ContactInfoModel> _topList = [
|
||||
ContactInfoModel(
|
||||
name: '新的朋友',
|
||||
userID: '',
|
||||
tagIndex: '@',
|
||||
icon: Icons.person_add_alt,
|
||||
color: Colors.amber,
|
||||
),
|
||||
ContactInfoModel(
|
||||
name: '群聊',
|
||||
userID: '',
|
||||
tagIndex: '@',
|
||||
icon: Icons.group,
|
||||
color: Colors.green,
|
||||
),
|
||||
ContactInfoModel(
|
||||
name: '订阅消息',
|
||||
userID: '',
|
||||
tagIndex: '@',
|
||||
icon: Icons.mark_email_read,
|
||||
color: Colors.blue,
|
||||
),
|
||||
];
|
||||
|
||||
Future<void> fetchList() async {
|
||||
var result = await friendshipManager.getFriendList();
|
||||
if (result.code == 0) {
|
||||
@@ -52,6 +77,7 @@ class TimFriendService extends GetxService {
|
||||
|
||||
SuspensionUtil.sortListBySuspensionTag(contacts);
|
||||
SuspensionUtil.setShowSuspensionStatus(contacts);
|
||||
contacts.insertAll(0, _topList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user