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:
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'friend_list_logic.dart';
|
||||
|
||||
class SelectContactsFromFriendsBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsFromFriendsLogic());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim/pages/contacts/friend_list/friend_list_logic.dart';
|
||||
import 'package:openim/routes/app_navigator.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import '../select_contacts_logic.dart';
|
||||
|
||||
class SelectContactsFromFriendsLogic extends FriendListLogic {
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
@override
|
||||
searchFriend() async {
|
||||
final result = await AppNavigator.startSelectContactsFromSearchFriends();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onUserIDList(List<String> userIDList) {
|
||||
selectContactsLogic.updateDefaultCheckedList(userIDList);
|
||||
super.onUserIDList(userIDList);
|
||||
}
|
||||
|
||||
bool get isSelectAll {
|
||||
if (selectContactsLogic.checkedList.isEmpty) {
|
||||
return false;
|
||||
} else if (operableList
|
||||
.every((item) => selectContactsLogic.isChecked(item))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<ISUserInfo> get operableList => friendList.where(_remove);
|
||||
|
||||
bool _remove(ISUserInfo info) => !selectContactsLogic.isDefaultChecked(info);
|
||||
|
||||
selectAll() {
|
||||
if (isSelectAll) {
|
||||
for (var info in operableList) {
|
||||
selectContactsLogic.removeItem(info);
|
||||
}
|
||||
} else {
|
||||
for (var info in operableList) {
|
||||
final isChecked = selectContactsLogic.isChecked(info);
|
||||
if (!isChecked) {
|
||||
selectContactsLogic.toggleChecked(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import '../select_contacts_logic.dart';
|
||||
import 'friend_list_logic.dart';
|
||||
|
||||
class SelectContactsFromFriendsPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsFromFriendsLogic>();
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsFromFriendsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: TitleBar.back(title: StrRes.myFriend),
|
||||
backgroundColor: Styles.c_F8F9FA,
|
||||
body: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: logic.searchFriend,
|
||||
child: Container(
|
||||
color: Styles.c_FFFFFF,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
child: const SearchBox(),
|
||||
),
|
||||
),
|
||||
if (selectContactsLogic.isMultiModel)
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||
child: Ink(
|
||||
height: 64.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: logic.selectAll,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(() => Padding(
|
||||
padding: EdgeInsets.only(right: 10.w),
|
||||
child: ChatRadio(checked: logic.isSelectAll),
|
||||
)),
|
||||
10.horizontalSpace,
|
||||
StrRes.selectAll.toText..style = Styles.ts_0C1C33_17sp,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Obx(
|
||||
() => WrapAzListView<ISUserInfo>(
|
||||
data: logic.friendList,
|
||||
itemCount: logic.friendList.length,
|
||||
itemBuilder: (_, data, index) => _buildItemView(data),
|
||||
),
|
||||
),
|
||||
),
|
||||
selectContactsLogic.checkedConfirmView,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(ISUserInfo 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: info.faceURL,
|
||||
text: info.showName,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
info.showName.toText..style = Styles.ts_0C1C33_17sp,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return selectContactsLogic.isMultiModel ? Obx(buildChild) : buildChild();
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'search_friend_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchFriendsBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsFromSearchFriendsLogic());
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import '../friend_list_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchFriendsLogic extends GetxController {
|
||||
final logic = Get.find<SelectContactsFromFriendsLogic>();
|
||||
final focusNode = FocusNode();
|
||||
final searchCtrl = TextEditingController();
|
||||
final resultList = <ISUserInfo>[].obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
searchCtrl.addListener(_clearInput);
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
focusNode.dispose();
|
||||
searchCtrl.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
bool get isSearchNotResult => searchCtrl.text.trim().isNotEmpty && resultList.isEmpty;
|
||||
|
||||
_clearInput() {
|
||||
final key = searchCtrl.text.trim();
|
||||
if (key.isEmpty) {
|
||||
resultList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
search() {
|
||||
var key = searchCtrl.text.trim();
|
||||
resultList.clear();
|
||||
if (key.isNotEmpty) {
|
||||
for (var element in logic.friendList) {
|
||||
if (element.showName.toUpperCase().contains(key.toUpperCase())) {
|
||||
resultList.add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.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_friend_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchFriendsPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsFromSearchFriendsLogic>();
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsFromSearchFriendsPage({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[index]),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(ISUserInfo 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: info.faceURL,
|
||||
text: info.showName,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
SearchKeywordText(
|
||||
text: info.showName,
|
||||
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,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'group_list_logic.dart';
|
||||
|
||||
class SelectContactsFromGroupBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsFromGroupLogic());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../routes/app_navigator.dart';
|
||||
import '../select_contacts_logic.dart';
|
||||
|
||||
class SelectContactsFromGroupLogic extends GetxController {
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
final allList = <GroupInfo>[].obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
_getGroupRelatedToMe();
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
void _getGroupRelatedToMe() async {
|
||||
final list = await OpenIM.iMManager.groupManager.getJoinedGroupList();
|
||||
allList.addAll(list);
|
||||
}
|
||||
|
||||
Iterable<GroupInfo> get operableList => allList.where(_remove);
|
||||
|
||||
bool _remove(GroupInfo info) => !selectContactsLogic.isDefaultChecked(info);
|
||||
|
||||
bool get isSelectAll {
|
||||
if (selectContactsLogic.checkedList.isEmpty) {
|
||||
return false;
|
||||
} else if (operableList
|
||||
.every((item) => selectContactsLogic.isChecked(item))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
selectAll() {
|
||||
if (isSelectAll) {
|
||||
for (var info in operableList) {
|
||||
selectContactsLogic.removeItem(info);
|
||||
}
|
||||
} else {
|
||||
for (var info in operableList) {
|
||||
final isChecked = selectContactsLogic.isChecked(info);
|
||||
if (!isChecked) {
|
||||
selectContactsLogic.toggleChecked(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void searchGroup() async {
|
||||
final result = await AppNavigator.startSelectContactsFromSearchGroup();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
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:sprintf/sprintf.dart';
|
||||
|
||||
import '../select_contacts_logic.dart';
|
||||
import 'group_list_logic.dart';
|
||||
|
||||
class SelectContactsFromGroupPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsFromGroupLogic>();
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsFromGroupPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: TitleBar.back(title: StrRes.myGroup),
|
||||
backgroundColor: Styles.c_F8F9FA,
|
||||
body: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: logic.searchGroup,
|
||||
child: Container(
|
||||
color: Styles.c_FFFFFF,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
child: const SearchBox(),
|
||||
),
|
||||
),
|
||||
if (selectContactsLogic.isMultiModel)
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||
child: Ink(
|
||||
height: 64.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: logic.selectAll,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(() => Padding(
|
||||
padding: EdgeInsets.only(right: 10.w),
|
||||
child: ChatRadio(checked: logic.isSelectAll),
|
||||
)),
|
||||
10.horizontalSpace,
|
||||
StrRes.selectAll.toText..style = Styles.ts_0C1C33_17sp,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() => ListView.builder(
|
||||
itemCount: logic.allList.length,
|
||||
itemBuilder: (_, index) =>
|
||||
_buildItemView(logic.allList[index]),
|
||||
))),
|
||||
selectContactsLogic.checkedConfirmView,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(GroupInfo 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: info.faceURL,
|
||||
text: info.groupName,
|
||||
isGroup: true,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
(info.groupName ?? '').toText
|
||||
..style = Styles.ts_0C1C33_17sp
|
||||
..maxLines = 1
|
||||
..overflow = TextOverflow.ellipsis,
|
||||
sprintf(StrRes.nPerson, [info.memberCount]).toText
|
||||
..style = Styles.ts_8E9AB0_14sp,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return selectContactsLogic.isMultiModel ? Obx(buildChild) : buildChild();
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'search_group_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchGroupBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsFromSearchGroupLogic());
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../group_list_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchGroupLogic extends GetxController {
|
||||
final logic = Get.find<SelectContactsFromGroupLogic>();
|
||||
final focusNode = FocusNode();
|
||||
final searchCtrl = TextEditingController();
|
||||
final resultList = <GroupInfo>[].obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
searchCtrl.addListener(_clearInput);
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
focusNode.dispose();
|
||||
searchCtrl.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
bool get isSearchNotResult =>
|
||||
searchCtrl.text.trim().isNotEmpty && resultList.isEmpty;
|
||||
|
||||
_clearInput() {
|
||||
final key = searchCtrl.text.trim();
|
||||
if (key.isEmpty) {
|
||||
resultList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
search() {
|
||||
var key = searchCtrl.text.trim();
|
||||
resultList.clear();
|
||||
if (key.isNotEmpty) {
|
||||
for (var element in logic.allList) {
|
||||
if ((element.groupName ?? '')
|
||||
.toUpperCase()
|
||||
.contains(key.toUpperCase())) {
|
||||
resultList.add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
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 'package:sprintf/sprintf.dart';
|
||||
|
||||
import '../../select_contacts_logic.dart';
|
||||
import 'search_group_logic.dart';
|
||||
|
||||
class SelectContactsFromSearchGroupPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsFromSearchGroupLogic>();
|
||||
final selectContactsLogic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsFromSearchGroupPage({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[index]),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(GroupInfo info) {
|
||||
Widget buildChild() => Ink(
|
||||
height: 64.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
selectContactsLogic.toggleChecked(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),
|
||||
),
|
||||
),
|
||||
AvatarView(
|
||||
url: info.faceURL,
|
||||
text: info.groupName,
|
||||
isGroup: true,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SearchKeywordText(
|
||||
text: info.groupName ?? '',
|
||||
keyText: logic.searchCtrl.text.trim(),
|
||||
style: Styles.ts_0C1C33_17sp,
|
||||
keyStyle: Styles.ts_0089FF_17sp,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
sprintf(StrRes.nPerson, [info.memberCount]).toText..style = Styles.ts_8E9AB0_14sp,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
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,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
+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,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'select_contacts_logic.dart';
|
||||
|
||||
class SelectContactsBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SelectContactsLogic());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:openim/pages/conversation/conversation_logic.dart';
|
||||
import 'package:openim/routes/app_navigator.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
import 'select_contacts_view.dart';
|
||||
|
||||
enum SelAction {
|
||||
forward,
|
||||
|
||||
carte,
|
||||
|
||||
crateGroup,
|
||||
|
||||
addMember,
|
||||
|
||||
recommend,
|
||||
}
|
||||
|
||||
class SelectContactsLogic extends GetxController implements OrganizationMultiSelBridge {
|
||||
final checkedList = <String, dynamic>{}.obs; // 已经选中的
|
||||
final defaultCheckedIDList = <String>{}.obs; // 默认选中,且不能修改
|
||||
List<String>? excludeIDList; // 剔除某些数据
|
||||
late SelAction action;
|
||||
late bool openSelectedSheet;
|
||||
String? groupID;
|
||||
final conversationList = <ConversationInfo>[].obs;
|
||||
String? ex;
|
||||
final inputCtrl = TextEditingController();
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
action = Get.arguments['action'];
|
||||
groupID = Get.arguments['groupID'];
|
||||
excludeIDList = Get.arguments['excludeIDList'];
|
||||
defaultCheckedIDList.addAll(Get.arguments['defaultCheckedIDList'] ?? []);
|
||||
checkedList.addAll(Get.arguments['checkedList'] ?? {});
|
||||
openSelectedSheet = Get.arguments['openSelectedSheet'];
|
||||
ex = Get.arguments['ex'];
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
inputCtrl.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
_queryConversationList();
|
||||
if (openSelectedSheet) viewSelectedContactsList();
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isMultiModel => action != SelAction.carte;
|
||||
|
||||
bool get hiddenGroup => action == SelAction.carte || action == SelAction.crateGroup || action == SelAction.addMember;
|
||||
|
||||
bool get hiddenConversations =>
|
||||
action == SelAction.carte || action == SelAction.crateGroup || action == SelAction.addMember;
|
||||
|
||||
_queryConversationList() async {
|
||||
if (!hiddenConversations) {
|
||||
final cons = Get.find<ConversationLogic>().list;
|
||||
|
||||
final futures = cons.map((con) async {
|
||||
if (con.isGroupChat) {
|
||||
final result = await OpenIM.iMManager.groupManager.isJoinedGroup(groupID: con.groupID!);
|
||||
return result ? con : null;
|
||||
}
|
||||
return con.conversationType == ConversationType.notification ? null : con;
|
||||
}).toList();
|
||||
|
||||
final results = await Future.wait(futures);
|
||||
final filteredCons = results.where((con) => con != null).cast<ConversationInfo>().toList();
|
||||
|
||||
conversationList.addAll(filteredCons);
|
||||
}
|
||||
}
|
||||
|
||||
static String? parseID(e) {
|
||||
if (e is ConversationInfo) {
|
||||
return e.isSingleChat ? e.userID : e.groupID;
|
||||
} else if (e is GroupInfo) {
|
||||
return e.groupID;
|
||||
} else if (e is UserInfo || e is FriendInfo || e is UserFullInfo) {
|
||||
return e.userID;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static String? parseName(e) {
|
||||
if (e is ConversationInfo) {
|
||||
return e.showName;
|
||||
} else if (e is GroupInfo) {
|
||||
return e.groupName;
|
||||
} else if (e is UserInfo || e is FriendInfo || e is UserFullInfo) {
|
||||
return e.nickname;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static String? parseFaceURL(e) {
|
||||
if (e is ConversationInfo) {
|
||||
return e.faceURL;
|
||||
} else if (e is GroupInfo) {
|
||||
return e.faceURL;
|
||||
} else if (e is UserInfo || e is FriendInfo || e is UserFullInfo) {
|
||||
return e.faceURL;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool isChecked(info) => checkedList.containsKey(parseID(info));
|
||||
|
||||
@override
|
||||
bool isDefaultChecked(info) => defaultCheckedIDList.contains(parseID(info));
|
||||
|
||||
@override
|
||||
Function()? onTap(dynamic info) => isDefaultChecked(info) ? null : () => toggleChecked(info);
|
||||
|
||||
@override
|
||||
removeItem(dynamic info) {
|
||||
checkedList.remove(parseID(info));
|
||||
}
|
||||
|
||||
@override
|
||||
toggleChecked(dynamic info) {
|
||||
if (isMultiModel) {
|
||||
final key = parseID(info);
|
||||
if (checkedList.containsKey(key)) {
|
||||
checkedList.remove(key);
|
||||
} else {
|
||||
checkedList.putIfAbsent(key ?? '', () => info);
|
||||
}
|
||||
} else {
|
||||
confirmSelectedItem(info);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
updateDefaultCheckedList(List<String> userIDList) async {
|
||||
if (groupID != null) {
|
||||
var list = await OpenIM.iMManager.groupManager.getGroupMembersInfo(
|
||||
groupID: groupID!,
|
||||
userIDList: userIDList,
|
||||
);
|
||||
defaultCheckedIDList.addAll(list.map((e) => e.userID!));
|
||||
}
|
||||
}
|
||||
|
||||
String get checkedStrTips => checkedList.values.map(parseName).join('、');
|
||||
|
||||
viewSelectedContactsList() => Get.bottomSheet(
|
||||
SelectedContactsListView(),
|
||||
isScrollControlled: true,
|
||||
);
|
||||
|
||||
selectFromMyFriend() async {
|
||||
final result = await AppNavigator.startSelectContactsFromFriends();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
|
||||
selectFromMyGroup() async {
|
||||
final result = await AppNavigator.startSelectContactsFromGroup();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
|
||||
void selectFromSearch() async {
|
||||
final result = await AppNavigator.startSelectContactsFromSearch();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
|
||||
selectTagGroup() async {
|
||||
final result = await await AppNavigator.startSelectContactsFromTag();
|
||||
if (null != result) {
|
||||
Get.back(result: result);
|
||||
}
|
||||
}
|
||||
|
||||
confirmSelectedList() async {
|
||||
if (action == SelAction.forward || action == SelAction.recommend) {
|
||||
final sure = await Get.dialog(ForwardHintDialog(
|
||||
title: ex ?? '',
|
||||
checkedList: checkedList.values.toList(),
|
||||
));
|
||||
if (sure == true) {
|
||||
Get.back(result: {
|
||||
"checkedList": checkedList.values,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Get.back(result: checkedList.value);
|
||||
}
|
||||
}
|
||||
|
||||
confirmSelectedItem(dynamic info) async {
|
||||
if (action == SelAction.carte) {
|
||||
final sure = await Get.dialog(CustomDialog(
|
||||
title: StrRes.sendCarteConfirmHint,
|
||||
));
|
||||
if (sure == true) {
|
||||
Get.back(result: UserInfo.fromJson(info.toJson()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool get enabledConfirmButton => checkedList.isNotEmpty;
|
||||
|
||||
@override
|
||||
Widget get checkedConfirmView => isMultiModel ? CheckedConfirmView() : const SizedBox();
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
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:sprintf/sprintf.dart';
|
||||
|
||||
import 'select_contacts_logic.dart';
|
||||
|
||||
class SelectContactsPage extends StatelessWidget {
|
||||
final logic = Get.find<SelectContactsLogic>();
|
||||
|
||||
SelectContactsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: TitleBar.back(),
|
||||
backgroundColor: Styles.c_F8F9FA,
|
||||
body: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: logic.selectFromSearch,
|
||||
child: Container(
|
||||
color: Styles.c_FFFFFF,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
child: const SearchBox(),
|
||||
),
|
||||
),
|
||||
10.verticalSpace,
|
||||
Flexible(
|
||||
child: Obx(() => CustomScrollView(
|
||||
slivers: [
|
||||
SliverFixedExtentList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildCategoryItemView(
|
||||
label: StrRes.myFriend,
|
||||
onTap: logic.selectFromMyFriend,
|
||||
),
|
||||
if (!logic.hiddenGroup)
|
||||
_buildCategoryItemView(
|
||||
label: StrRes.myGroup,
|
||||
onTap: logic.selectFromMyGroup,
|
||||
),
|
||||
],
|
||||
),
|
||||
itemExtent: 56.h,
|
||||
),
|
||||
if (logic.conversationList.isNotEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
height: 29.h,
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: StrRes.recentConversations.toText..style = Styles.ts_8E9AB0_12sp,
|
||||
),
|
||||
),
|
||||
SliverFixedExtentList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: logic.conversationList.length,
|
||||
(_, index) => _buildRecentConversationsItemView(
|
||||
logic.conversationList.elementAt(index),
|
||||
),
|
||||
),
|
||||
itemExtent: 64.h,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
logic.checkedConfirmView,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCategoryItemView({
|
||||
required String label,
|
||||
Function()? onTap,
|
||||
}) =>
|
||||
Ink(
|
||||
height: 56.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
label.toText..style = Styles.ts_0C1C33_17sp,
|
||||
const Spacer(),
|
||||
ImageRes.rightArrow.toImage
|
||||
..width = 24.w
|
||||
..height = 24.h,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _buildRecentConversationsItemView(ConversationInfo info) {
|
||||
Widget buildChild() => Ink(
|
||||
height: 56.h,
|
||||
color: Styles.c_FFFFFF,
|
||||
child: InkWell(
|
||||
onTap: logic.onTap(info),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Row(
|
||||
children: [
|
||||
if (logic.isMultiModel)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.w),
|
||||
child: ChatRadio(
|
||||
checked: logic.isChecked(info),
|
||||
),
|
||||
),
|
||||
AvatarView(
|
||||
url: info.faceURL,
|
||||
text: info.showName,
|
||||
isGroup: !info.isSingleChat,
|
||||
),
|
||||
10.horizontalSpace,
|
||||
Flexible(
|
||||
child: (info.showName ?? '').toText
|
||||
..style = Styles.ts_0C1C33_17sp
|
||||
..maxLines = 1
|
||||
..overflow = TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return logic.isMultiModel ? Obx(buildChild) : buildChild();
|
||||
}
|
||||
}
|
||||
|
||||
class CheckedConfirmView extends StatelessWidget {
|
||||
CheckedConfirmView({Key? key}) : super(key: key);
|
||||
final logic = Get.find<SelectContactsLogic>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 66.h,
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.c_FFFFFF,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: Offset(0, -1.h),
|
||||
blurRadius: 4.r,
|
||||
spreadRadius: 1.r,
|
||||
color: Styles.c_000000_opacity4,
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
child: Obx(() => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: logic.viewSelectedContactsList,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
sprintf(StrRes.selectedPeopleCount, [logic.checkedList.length]).toText
|
||||
..style = Styles.ts_0089FF_14sp,
|
||||
ImageRes.expandUpArrow.toImage
|
||||
..width = 24.w
|
||||
..height = 24.h,
|
||||
],
|
||||
),
|
||||
if (logic.checkedList.isNotEmpty) 4.verticalSpace,
|
||||
logic.checkedStrTips.toText
|
||||
..style = Styles.ts_8E9AB0_14sp
|
||||
..maxLines = 1
|
||||
..overflow = TextOverflow.ellipsis,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Button(
|
||||
height: 40.h,
|
||||
enabled: logic.enabledConfirmButton,
|
||||
padding: EdgeInsets.symmetric(horizontal: 14.w),
|
||||
text: sprintf(StrRes.confirmSelectedPeople, [
|
||||
logic.checkedList.length,
|
||||
'999',
|
||||
]),
|
||||
textStyle: Styles.ts_FFFFFF_14sp,
|
||||
onTap: logic.confirmSelectedList,
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SelectedContactsListView extends StatelessWidget {
|
||||
SelectedContactsListView({Key? key}) : super(key: key);
|
||||
final logic = Get.find<SelectContactsLogic>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxHeight: 548.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.c_FFFFFF,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(6.r),
|
||||
topRight: Radius.circular(6.r),
|
||||
),
|
||||
),
|
||||
child: Obx(() => Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
decoration: BoxDecoration(
|
||||
border: BorderDirectional(
|
||||
bottom: BorderSide(color: Styles.c_E8EAEF, width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
sprintf(StrRes.selectedPeopleCount, [logic.checkedList.length]).toText
|
||||
..style = Styles.ts_0C1C33_17sp_medium,
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 52.h,
|
||||
alignment: Alignment.center,
|
||||
child: StrRes.confirm.toText..style = Styles.ts_0089FF_17sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: logic.checkedList.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index) => _buildItemView(index),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView(int index) {
|
||||
final info = logic.checkedList.values.elementAt(index);
|
||||
String? name;
|
||||
String? faceURL;
|
||||
bool isGroup = false;
|
||||
name = SelectContactsLogic.parseName(info);
|
||||
faceURL = SelectContactsLogic.parseFaceURL(info);
|
||||
if (info is ConversationInfo) {
|
||||
isGroup = !info.isSingleChat;
|
||||
} else if (info is GroupInfo) {
|
||||
isGroup = true;
|
||||
name = info.groupName;
|
||||
faceURL = info.faceURL;
|
||||
} else if (info is UserInfo) {
|
||||
name = info.nickname;
|
||||
faceURL = info.faceURL;
|
||||
}
|
||||
return Container(
|
||||
height: 64.h,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
||||
color: Styles.c_FFFFFF,
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarView(url: faceURL, text: name, isGroup: isGroup),
|
||||
10.horizontalSpace,
|
||||
Expanded(
|
||||
child: (name ?? '').toText
|
||||
..style = Styles.ts_0C1C33_17sp
|
||||
..maxLines = 1
|
||||
..overflow = TextOverflow.ellipsis,
|
||||
),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () => logic.removeItem(info),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 13.w, vertical: 4.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(2.r),
|
||||
border: Border.all(
|
||||
color: Styles.c_E8EAEF,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: StrRes.remove.toText..style = Styles.ts_0089FF_17sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user