feat(mobile-next): 导入官方 openim-flutter-demo 固定基线 3.8.3-patch.3 并完成双构建
- 上游: github.com/OpenIMSDK/openim-flutter-demo tag 3.8.3-patch.3 commit b3dfdb1e8aaeaaf6f0793e10cadd20d5c184a31f - 并行目录 mobile-next/ 原样导入(含 LICENSE),不覆盖现网 mobile/ - 锁定 Flutter 3.24.5 / Dart 3.5.4 / JDK 17 / Gradle 7.6.3 / AGP 7.3.1 - 实测 Android debug 与 release 构建均成功(见 docs/mobile-next-baseline-import.md) - 本提交可单独回退:git revert 1db1229(重写前) Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'search_contacts_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsFromSearchLogic());
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import '../../../global_search/global_search_logic.dart';
|
||||
import '../select_contacts_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchLogic extends CommonSearchLogic {
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
final resultList = <dynamic>{}.obs;
|
||||
|
||||
bool get isSearchNotResult => searchCtrl.text.trim().isNotEmpty && resultList.isEmpty;
|
||||
|
||||
@override
|
||||
void clearList() {
|
||||
resultList.clear();
|
||||
}
|
||||
|
||||
void search() async {
|
||||
final result = await LoadingView.singleton.wrap(
|
||||
asyncFunction: () => Future.wait([
|
||||
searchFriend(),
|
||||
if (!selectContactsLogic.hiddenGroup) searchGroup(),
|
||||
]));
|
||||
final friendList = result[0] as List<FriendInfo>;
|
||||
clearList();
|
||||
resultList
|
||||
..addAll(friendList);
|
||||
if (selectContactsLogic.action == SelAction.addMember) {
|
||||
var memberInfoList = await getMemberInfo(friendList.map((e) => e.userID!).toList());
|
||||
for (var element in memberInfoList) {
|
||||
selectContactsLogic.defaultCheckedIDList.add(element.userID!);
|
||||
}
|
||||
}
|
||||
if (result.length == 3) {
|
||||
final groupList = result[2] as List<GroupInfo>;
|
||||
resultList.addAll(groupList);
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<GroupMembersInfo>> getMemberInfo(List<String> uidList) async {
|
||||
return await OpenIM.iMManager.groupManager
|
||||
.getGroupMembersInfo(groupID: selectContactsLogic.groupID!, userIDList: uidList);
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
import 'package:search_keyword_text/search_keyword_text.dart';
|
||||
|
||||
import '../select_contacts_logic.dart';
|
||||
import 'search_contacts_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsFromSearchLogic>();
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsFromSearchPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TouchCloseSoftKeyboard(
|
||||
child: Scaffold(
|
||||
appBar: TitleBar.search(
|
||||
focusNode: logic.focusNode,
|
||||
controller: logic.searchCtrl,
|
||||
onSubmitted: (_) => logic.search(),
|
||||
onCleared: () => logic.focusNode.requestFocus(),
|
||||
),
|
||||
backgroundColor: Styles.c_F8F9FA,
|
||||
body: Obx(() => logic.isSearchNotResult
|
||||
? _emptyListView
|
||||
: ListView.builder(
|
||||
itemCount: logic.resultList.length,
|
||||
itemBuilder: (_, index) => _buildItemView(logic.resultList.elementAt(index)),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(dynamic info) {
|
||||
Widget buildChild() => Ink(
|
||||
height: 64.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: selectContactsLogic.onTap(info),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
if (selectContactsLogic.isMultiModel)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.w),
|
||||
child: ChatRadio(
|
||||
checked: selectContactsLogic.isChecked(info),
|
||||
enabled: !selectContactsLogic.isDefaultChecked(info),
|
||||
),
|
||||
),
|
||||
AvatarView(
|
||||
url: logic.parseFaceURL(info),
|
||||
text: logic.parseNickname(info),
|
||||
isGroup: info is GroupInfo,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SearchKeywordText(
|
||||
text: logic.parseNickname(info) ?? '',
|
||||
keyText: logic.searchCtrl.text.trim(),
|
||||
style: Styles.ts_0C1C33_17sp,
|
||||
keyStyle: Styles.ts_0089FF_17sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return selectContactsLogic.isMultiModel ? Obx(buildChild) : buildChild();
|
||||
}
|
||||
|
||||
Widget get _emptyListView => SizedBox(
|
||||
width: 1.sw,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
44.verticalSpace,
|
||||
StrRes.searchNotFound.toText..style = Styles.ts_8E9AB0_17sp,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user