页面与路由完善
This commit is contained in:
@@ -48,7 +48,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "site.zhchain.chat"
|
applicationId "site.zhchain.chat"
|
||||||
// minSdkVersion flutter.minSdkVersion
|
// minSdkVersion flutter.minSdkVersion
|
||||||
minSdkVersion 21
|
minSdkVersion 28
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|||||||
BIN
assets/images/default_avatar.png
Normal file
BIN
assets/images/default_avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -30,7 +30,7 @@ class PrivateController extends GetxController {
|
|||||||
currentFriend.value.isFriend =
|
currentFriend.value.isFriend =
|
||||||
info.relation == UserRelationEnum.V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY;
|
info.relation == UserRelationEnum.V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY;
|
||||||
|
|
||||||
currentFriend.value.friendRemark = info.friendInfo!.friendRemark!;
|
currentFriend.value.friendRemark = info.friendInfo!.friendRemark ?? '';
|
||||||
currentFriend.value.userProfile = info.friendInfo!.userProfile;
|
currentFriend.value.userProfile = info.friendInfo!.userProfile;
|
||||||
|
|
||||||
/// 通过自定义Staffer字段,判断是否是客服,属于哪个店铺
|
/// 通过自定义Staffer字段,判断是否是客服,属于哪个店铺
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import 'package:chat/middleware/auth_middleware.dart';
|
import 'package:chat/middleware/auth_middleware.dart';
|
||||||
|
import 'package:chat/views/contact/firend/profile/index_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/profile/more_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/recommend/friend_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/recommend/group_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/recommend/index_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/remark/index_page.dart';
|
||||||
|
import 'package:chat/views/contact/firend/search/index_page.dart';
|
||||||
import 'package:chat/views/contact/group/create/index_page.dart';
|
import 'package:chat/views/contact/group/create/index_page.dart';
|
||||||
import 'package:chat/views/contact/group/index_page.dart';
|
import 'package:chat/views/contact/group/index_page.dart';
|
||||||
import 'package:chat/views/contact/group/manage/index_page.dart';
|
import 'package:chat/views/contact/group/manage/index_page.dart';
|
||||||
@@ -13,10 +20,13 @@ abstract class ContactRoutes {
|
|||||||
static const String friend = '/contact/friend';
|
static const String friend = '/contact/friend';
|
||||||
static const String friendSearch = '/contact/friend/search';
|
static const String friendSearch = '/contact/friend/search';
|
||||||
static const String friendProfile = '/contact/friend/profile';
|
static const String friendProfile = '/contact/friend/profile';
|
||||||
static const String friendProfileMore = '/contact/friend/profile';
|
static const String friendProfileMore = '/contact/friend/profile/more';
|
||||||
static const String friendRemark = '/contact/friend/profile';
|
static const String friendRemark = '/contact/friend/remark';
|
||||||
static const String friendApply = '/contact/friend/profile';
|
static const String friendApply = '/contact/friend/profile';
|
||||||
static const String friendRecommend = '/contact/friend/profile';
|
static const String friendRecommend = '/contact/friend/recommend';
|
||||||
|
static const String friendRecommendFriend =
|
||||||
|
'/contact/friend/recommend/friend';
|
||||||
|
static const String friendRecommendGroup = '/contact/friend/recommend/group';
|
||||||
|
|
||||||
static const String group = '/contact/group';
|
static const String group = '/contact/group';
|
||||||
static const String groupQrCode = '/contact/group/qrCode';
|
static const String groupQrCode = '/contact/group/qrCode';
|
||||||
@@ -40,7 +50,35 @@ abstract class ContactRoutes {
|
|||||||
children: [
|
children: [
|
||||||
GetPage(
|
GetPage(
|
||||||
name: '/search',
|
name: '/search',
|
||||||
page: () => const ContactGroupCreatePage(),
|
page: () => const ContactFriendSearchPage(),
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: '/profile',
|
||||||
|
page: () => const ContactFriendProfilePage(),
|
||||||
|
children: [
|
||||||
|
GetPage(
|
||||||
|
name: '/more',
|
||||||
|
page: () => const ContactFriendProfileMorePage(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: '/remark',
|
||||||
|
page: () => const ContactFriendRemarkPage(),
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: '/recommend',
|
||||||
|
page: () => const ContactFriendRecommendPage(),
|
||||||
|
children: [
|
||||||
|
GetPage(
|
||||||
|
name: '/friend',
|
||||||
|
page: () => const ContactFriendRecommendFriendPage(),
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: '/group',
|
||||||
|
page: () => const ContactFriendRecommendGroupPage(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ class ImTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String parseNicknameFromInfo(V2TimFriendInfo infoResult) {
|
static String parseNicknameFromInfo(V2TimFriendInfo infoResult) {
|
||||||
if (infoResult.friendRemark != '') {
|
if (infoResult.friendRemark != null &&
|
||||||
return infoResult.friendRemark!;
|
infoResult.friendRemark!.isNotEmpty) {
|
||||||
|
return infoResult.friendRemark ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return infoResult.userProfile!.nickName!;
|
return infoResult.userProfile!.nickName!;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:chat/configs/app_colors.dart';
|
|||||||
import 'package:chat/controllers/private_controller.dart';
|
import 'package:chat/controllers/private_controller.dart';
|
||||||
import 'package:chat/routes/contact_routes.dart';
|
import 'package:chat/routes/contact_routes.dart';
|
||||||
import 'package:chat/routes/conversation_routes.dart';
|
import 'package:chat/routes/conversation_routes.dart';
|
||||||
import 'package:chat/routes/moments_routes.dart';
|
|
||||||
import 'package:chat/services/tim/conversation_service.dart';
|
import 'package:chat/services/tim/conversation_service.dart';
|
||||||
import 'package:chat/utils/im_tools.dart';
|
import 'package:chat/utils/im_tools.dart';
|
||||||
import 'package:chat/views/home/widgets/action_button.dart';
|
import 'package:chat/views/home/widgets/action_button.dart';
|
||||||
@@ -11,8 +10,8 @@ import 'package:chat/widgets/custom_avatar.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class ImFriendProfilePage extends StatelessWidget {
|
class ContactFriendProfilePage extends StatelessWidget {
|
||||||
const ImFriendProfilePage({Key? key}) : super(key: key);
|
const ContactFriendProfilePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -76,18 +75,18 @@ class ImFriendProfilePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
// const SizedBox(height: 8),
|
||||||
ActionItem(
|
// ActionItem(
|
||||||
'他的动态',
|
// '他的动态',
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Get.toNamed(
|
// Get.toNamed(
|
||||||
MomentsRoutes.user,
|
// MomentsRoutes.user,
|
||||||
arguments: {
|
// arguments: {
|
||||||
'userId': _.currentFriend.value.userID,
|
// 'userId': _.currentFriend.value.userID,
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !_.currentFriend.value.isFriend,
|
visible: !_.currentFriend.value.isFriend,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||||
import 'package:chat/controllers/private_controller.dart';
|
import 'package:chat/controllers/private_controller.dart';
|
||||||
import 'package:chat/routes/contact_routes.dart';
|
import 'package:chat/routes/contact_routes.dart';
|
||||||
|
import 'package:chat/services/tim/block_service.dart';
|
||||||
import 'package:chat/services/tim/friend_service.dart';
|
import 'package:chat/services/tim/friend_service.dart';
|
||||||
import 'package:chat/utils/ui_tools.dart';
|
import 'package:chat/utils/ui_tools.dart';
|
||||||
import 'package:chat/views/home/widgets/action_button.dart';
|
import 'package:chat/views/home/widgets/action_button.dart';
|
||||||
@@ -8,8 +9,8 @@ import 'package:chat/views/home/widgets/action_item.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class ImFriendProfileMorePage extends StatelessWidget {
|
class ContactFriendProfileMorePage extends StatelessWidget {
|
||||||
const ImFriendProfileMorePage({Key? key}) : super(key: key);
|
const ContactFriendProfileMorePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:chat/controllers/private_controller.dart';
|
|||||||
import 'package:chat/models/im/contact_info_model.dart';
|
import 'package:chat/models/im/contact_info_model.dart';
|
||||||
import 'package:chat/models/im/name_card_model.dart';
|
import 'package:chat/models/im/name_card_model.dart';
|
||||||
import 'package:chat/models/im/private_conversation_model.dart';
|
import 'package:chat/models/im/private_conversation_model.dart';
|
||||||
|
import 'package:chat/routes/contact_routes.dart';
|
||||||
import 'package:chat/services/tim/conversation_service.dart';
|
import 'package:chat/services/tim/conversation_service.dart';
|
||||||
import 'package:chat/services/tim/friend_service.dart';
|
import 'package:chat/services/tim/friend_service.dart';
|
||||||
import 'package:chat/utils/im_tools.dart';
|
import 'package:chat/utils/im_tools.dart';
|
||||||
@@ -14,8 +15,8 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import 'package:tencent_im_sdk_plugin/models/v2_tim_conversation.dart';
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_conversation.dart';
|
||||||
|
|
||||||
class ImFriendRecommendFriendsPage extends StatelessWidget {
|
class ContactFriendRecommendFriendPage extends StatelessWidget {
|
||||||
const ImFriendRecommendFriendsPage({Key? key}) : super(key: key);
|
const ContactFriendRecommendFriendPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -65,7 +66,7 @@ class ImFriendRecommendFriendsPage extends StatelessWidget {
|
|||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||||
// Get.offNamed(ImRoutes.friendRecommendGroups);
|
Get.offNamed(ContactRoutes.friendRecommendGroup);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
@@ -11,8 +11,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:tencent_im_sdk_plugin/models/v2_tim_conversation.dart';
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_conversation.dart';
|
||||||
import 'package:tencent_im_sdk_plugin/models/v2_tim_group_info.dart';
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_group_info.dart';
|
||||||
|
|
||||||
class ImFriendRecommendGroupsPage extends StatelessWidget {
|
class ContactFriendRecommendGroupPage extends StatelessWidget {
|
||||||
const ImFriendRecommendGroupsPage({Key? key}) : super(key: key);
|
const ContactFriendRecommendGroupPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -4,6 +4,7 @@ import 'package:chat/configs/app_size.dart';
|
|||||||
import 'package:chat/controllers/private_controller.dart';
|
import 'package:chat/controllers/private_controller.dart';
|
||||||
import 'package:chat/models/im/name_card_model.dart';
|
import 'package:chat/models/im/name_card_model.dart';
|
||||||
import 'package:chat/models/im/private_conversation_model.dart';
|
import 'package:chat/models/im/private_conversation_model.dart';
|
||||||
|
import 'package:chat/routes/contact_routes.dart';
|
||||||
import 'package:chat/services/tim/conversation_service.dart';
|
import 'package:chat/services/tim/conversation_service.dart';
|
||||||
import 'package:chat/views/home/widgets/group_avatar.dart';
|
import 'package:chat/views/home/widgets/group_avatar.dart';
|
||||||
import 'package:chat/widgets/custom_avatar.dart';
|
import 'package:chat/widgets/custom_avatar.dart';
|
||||||
@@ -12,8 +13,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tencent_im_sdk_plugin/enum/conversation_type.dart';
|
import 'package:tencent_im_sdk_plugin/enum/conversation_type.dart';
|
||||||
|
|
||||||
class ImFriendRecommendPage extends StatelessWidget {
|
class ContactFriendRecommendPage extends StatelessWidget {
|
||||||
const ImFriendRecommendPage({Key? key}) : super(key: key);
|
const ContactFriendRecommendPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -68,7 +69,7 @@ class ImFriendRecommendPage extends StatelessWidget {
|
|||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||||
// Get.offNamed(ImRoutes.friendRecommendFriends);
|
Get.offNamed(ContactRoutes.friendRecommendFriend);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ import 'package:chat/controllers/private_controller.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class ImFriendRemarkPage extends StatefulWidget {
|
class ContactFriendRemarkPage extends StatefulWidget {
|
||||||
const ImFriendRemarkPage({Key? key}) : super(key: key);
|
const ContactFriendRemarkPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ImFriendRemarkPage> createState() => _ImFriendRemarkPageState();
|
State<ContactFriendRemarkPage> createState() =>
|
||||||
|
_ContactFriendRemarkPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ImFriendRemarkPageState extends State<ImFriendRemarkPage> {
|
class _ContactFriendRemarkPageState extends State<ContactFriendRemarkPage> {
|
||||||
final TextEditingController _controller = TextEditingController();
|
final TextEditingController _controller = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ import 'package:chat/widgets/custom_primary_button.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class ImFriendRequestApplyPage extends StatefulWidget {
|
class ContactFriendRequestApplyPage extends StatefulWidget {
|
||||||
const ImFriendRequestApplyPage({Key? key}) : super(key: key);
|
const ContactFriendRequestApplyPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ImFriendRequestApplyPage> createState() =>
|
State<ContactFriendRequestApplyPage> createState() =>
|
||||||
_ImFriendRequestApplyPageState();
|
_ContactFriendRequestApplyPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ImFriendRequestApplyPageState extends State<ImFriendRequestApplyPage> {
|
class _ContactFriendRequestApplyPageState
|
||||||
|
extends State<ContactFriendRequestApplyPage> {
|
||||||
late final String userID;
|
late final String userID;
|
||||||
String _remark = '';
|
String _remark = '';
|
||||||
String _wording = '';
|
String _wording = '';
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import 'package:tencent_im_sdk_plugin/enum/friend_type.dart';
|
|||||||
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_application.dart';
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_application.dart';
|
||||||
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_check_result.dart';
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_check_result.dart';
|
||||||
|
|
||||||
class ImFriendRequestPage extends StatefulWidget {
|
class ContactFriendRequestPage extends StatefulWidget {
|
||||||
const ImFriendRequestPage({Key? key}) : super(key: key);
|
const ContactFriendRequestPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ImFriendRequestPage> createState() => _ImFriendRequestState();
|
State<ContactFriendRequestPage> createState() => _ImFriendRequestState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ImFriendRequestState extends State<ImFriendRequestPage> {
|
class _ImFriendRequestState extends State<ContactFriendRequestPage> {
|
||||||
List<SearchUserModel>? searchList;
|
List<SearchUserModel>? searchList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import 'package:chat/configs/app_colors.dart';
|
import 'package:chat/configs/app_colors.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ImFriendSearchPage extends StatefulWidget {
|
class ContactFriendSearchPage extends StatefulWidget {
|
||||||
const ImFriendSearchPage({Key? key}) : super(key: key);
|
const ContactFriendSearchPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ImFriendSearchPage> createState() => _ImFriendSearchPageState();
|
State<ContactFriendSearchPage> createState() =>
|
||||||
|
_ContactFriendSearchPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ImFriendSearchPageState extends State<ImFriendSearchPage> {
|
class _ContactFriendSearchPageState extends State<ContactFriendSearchPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -1,15 +1,174 @@
|
|||||||
|
import 'package:chat/configs/app_colors.dart';
|
||||||
|
import 'package:chat/routes/conversation_routes.dart';
|
||||||
|
import 'package:chat/services/tim/conversation_service.dart';
|
||||||
|
import 'package:chat/services/tim/friend_service.dart';
|
||||||
|
import 'package:chat/services/tim/group_service.dart';
|
||||||
|
import 'package:chat/views/home/widgets/friend_selector.dart';
|
||||||
|
import 'package:chat/widgets/custom_avatar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tencent_im_sdk_plugin/enum/group_type.dart';
|
||||||
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_info.dart';
|
||||||
|
|
||||||
class ContactGroupCreatePage extends StatefulWidget {
|
class ContactGroupCreatePage extends StatefulWidget {
|
||||||
const ContactGroupCreatePage({Key? key}) : super(key: key);
|
const ContactGroupCreatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ContactGroupCreatePageState createState() => _ContactGroupCreatePageState();
|
State<ContactGroupCreatePage> createState() => _ContactGroupCreatePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ContactGroupCreatePageState extends State<ContactGroupCreatePage> {
|
class _ContactGroupCreatePageState extends State<ContactGroupCreatePage> {
|
||||||
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
|
/// 选中的好友列表
|
||||||
|
List<V2TimFriendInfo> _selectList =
|
||||||
|
List<V2TimFriendInfo>.empty(growable: true);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
TimFriendService.to.fetchList();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text(
|
||||||
|
'发起群聊',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
top: false,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 58,
|
||||||
|
padding: const EdgeInsets.all(
|
||||||
|
4,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: _selectList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_selectList.removeAt(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: CustomAvatar(
|
||||||
|
_selectList[index].userProfile!.faceUrl,
|
||||||
|
size: 42,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(height: 0),
|
||||||
|
Container(
|
||||||
|
color: AppColors.unactive.withOpacity(0.1),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 16,
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
width: double.infinity,
|
||||||
|
child: const Text(
|
||||||
|
'选择群成员',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: FriendSelector(
|
||||||
|
onChanged: onChanged,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 16,
|
||||||
|
left: 16,
|
||||||
|
top: 4,
|
||||||
|
),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: Colors.black12,
|
||||||
|
width: 0.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'已选 ${_selectList.length}',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed:
|
||||||
|
_selectList.isNotEmpty && _selectList.length < 200
|
||||||
|
? _createGroup
|
||||||
|
: null,
|
||||||
|
child: const Text(
|
||||||
|
'完成',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 好友选择,添加到选择列表
|
||||||
|
Future onChanged(e) async {
|
||||||
|
setState(() {
|
||||||
|
_selectList = e;
|
||||||
|
|
||||||
|
Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
|
_scrollController.animateTo(
|
||||||
|
_scrollController.position.maxScrollExtent,
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
curve: Curves.bounceIn,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 创建群聊
|
||||||
|
Future<void> _createGroup() async {
|
||||||
|
String groupName = '创建的群聊';
|
||||||
|
var result = await TimGroupService.to.create(
|
||||||
|
groupName,
|
||||||
|
_selectList,
|
||||||
|
groupType: GroupType.Public,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
Get.offNamed(
|
||||||
|
ConversationRoutes.index,
|
||||||
|
arguments: {
|
||||||
|
'conversation': await TimConversationService.to.getById(
|
||||||
|
'group_' + result,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
179
lib/views/contact/group/create/user_page.dart
Normal file
179
lib/views/contact/group/create/user_page.dart
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
import 'package:chat/configs/app_colors.dart';
|
||||||
|
import 'package:chat/routes/conversation_routes.dart';
|
||||||
|
import 'package:chat/services/tim/conversation_service.dart';
|
||||||
|
import 'package:chat/services/tim/friend_service.dart';
|
||||||
|
import 'package:chat/services/tim/group_service.dart';
|
||||||
|
import 'package:chat/views/home/widgets/friend_selector.dart';
|
||||||
|
import 'package:chat/widgets/custom_avatar.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tencent_im_sdk_plugin/enum/group_type.dart';
|
||||||
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_friend_info.dart';
|
||||||
|
|
||||||
|
class ContactGroupCreateUserPage extends StatefulWidget {
|
||||||
|
const ContactGroupCreateUserPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ContactGroupCreateUserPage> createState() =>
|
||||||
|
_ContactGroupCreateUserPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ContactGroupCreateUserPageState
|
||||||
|
extends State<ContactGroupCreateUserPage> {
|
||||||
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
|
late final String groupType;
|
||||||
|
|
||||||
|
/// 选中的好友列表
|
||||||
|
List<V2TimFriendInfo> _selectList =
|
||||||
|
List<V2TimFriendInfo>.empty(growable: true);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
groupType = Get.arguments['groupType'];
|
||||||
|
TimFriendService.to.fetchList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text(
|
||||||
|
'发起群聊',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
top: false,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: 58,
|
||||||
|
padding: const EdgeInsets.all(
|
||||||
|
4,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: _selectList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_selectList.removeAt(index);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: CustomAvatar(
|
||||||
|
_selectList[index].userProfile!.faceUrl,
|
||||||
|
size: 42,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(height: 0),
|
||||||
|
Container(
|
||||||
|
color: AppColors.unactive.withOpacity(0.1),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 16,
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
width: double.infinity,
|
||||||
|
child: const Text(
|
||||||
|
'选择群成员',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: FriendSelector(
|
||||||
|
onChanged: onChanged,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 16,
|
||||||
|
left: 16,
|
||||||
|
top: 4,
|
||||||
|
),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: Border(
|
||||||
|
top: BorderSide(
|
||||||
|
color: Colors.black12,
|
||||||
|
width: 0.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'已选 ${_selectList.length}',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed:
|
||||||
|
_selectList.isNotEmpty && _selectList.length < 200
|
||||||
|
? _createGroup
|
||||||
|
: null,
|
||||||
|
child: const Text(
|
||||||
|
'完成',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 好友选择,添加到选择列表
|
||||||
|
Future onChanged(e) async {
|
||||||
|
setState(() {
|
||||||
|
_selectList = e;
|
||||||
|
|
||||||
|
Future.delayed(const Duration(milliseconds: 200), () {
|
||||||
|
_scrollController.animateTo(
|
||||||
|
_scrollController.position.maxScrollExtent,
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
curve: Curves.bounceIn,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 创建群聊
|
||||||
|
Future<void> _createGroup() async {
|
||||||
|
String groupName = '创建的群聊';
|
||||||
|
var result = await TimGroupService.to.create(
|
||||||
|
groupName,
|
||||||
|
_selectList,
|
||||||
|
groupType: GroupType.Public,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
Get.offNamed(
|
||||||
|
ConversationRoutes.index,
|
||||||
|
arguments: {
|
||||||
|
'conversation': await TimConversationService.to.getById(
|
||||||
|
'group_' + result,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ import 'package:chat/configs/app_colors.dart';
|
|||||||
import 'package:chat/services/tabbar_service.dart';
|
import 'package:chat/services/tabbar_service.dart';
|
||||||
import 'package:chat/views/contact/index/index_page.dart';
|
import 'package:chat/views/contact/index/index_page.dart';
|
||||||
import 'package:chat/views/home/index_page.dart';
|
import 'package:chat/views/home/index_page.dart';
|
||||||
import 'package:chat/views/moments/index/index_page.dart';
|
|
||||||
import 'package:chat/views/user/index/user_page.dart';
|
import 'package:chat/views/user/index/user_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -14,7 +13,7 @@ class AppPage extends StatelessWidget {
|
|||||||
final List<IndexedStackChild> _tabBarPageList = [
|
final List<IndexedStackChild> _tabBarPageList = [
|
||||||
IndexedStackChild(child: const HomePage()),
|
IndexedStackChild(child: const HomePage()),
|
||||||
IndexedStackChild(child: const ContactPage()),
|
IndexedStackChild(child: const ContactPage()),
|
||||||
IndexedStackChild(child: const MomentsPage()),
|
// IndexedStackChild(child: const MomentsPage()),
|
||||||
IndexedStackChild(child: const UserPage()),
|
IndexedStackChild(child: const UserPage()),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -29,11 +28,11 @@ class AppPage extends StatelessWidget {
|
|||||||
'active_icon': Icons.contact_page,
|
'active_icon': Icons.contact_page,
|
||||||
'label': '通讯录',
|
'label': '通讯录',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
'icon': Icons.explore_outlined,
|
// 'icon': Icons.explore_outlined,
|
||||||
'active_icon': Icons.explore,
|
// 'active_icon': Icons.explore,
|
||||||
'label': '发现',
|
// 'label': '发现',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
'icon': Icons.person_outline,
|
'icon': Icons.person_outline,
|
||||||
'active_icon': Icons.person,
|
'active_icon': Icons.person,
|
||||||
|
|||||||
@@ -1,15 +1,131 @@
|
|||||||
|
import 'package:chat/configs/app_colors.dart';
|
||||||
|
import 'package:chat/views/home/widgets/pop_menu_item.dart';
|
||||||
|
import 'package:chat/views/public/scan_page.dart';
|
||||||
|
import 'package:chat/widgets/custom_avatar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class UserQrCodePage extends StatefulWidget {
|
class UserQrCodePage extends StatefulWidget {
|
||||||
const UserQrCodePage({Key? key}) : super(key: key);
|
const UserQrCodePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_UserQrCodePageState createState() => _UserQrCodePageState();
|
State<UserQrCodePage> createState() => _UserQrCodePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _UserQrCodePageState extends State<UserQrCodePage> {
|
class _UserQrCodePageState extends State<UserQrCodePage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('我的二维码'),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
_showLongPressMenu();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.more_horiz),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
width: Get.width - 32,
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.white,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
CustomAvatar(
|
||||||
|
'',
|
||||||
|
size: 64,
|
||||||
|
radius: 6,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Jason',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 32),
|
||||||
|
QrImage(
|
||||||
|
data: 'BEFRIEND|5',
|
||||||
|
version: 3,
|
||||||
|
size: Get.width * 0.8,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 32),
|
||||||
|
const Text(
|
||||||
|
'扫一扫上面的二维码,加我共力好友',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.unactive,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showLongPressMenu() async {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: Get.context!,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: AppColors.white,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.vertical(top: Radius.circular(8)),
|
||||||
|
),
|
||||||
|
builder: (context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
PopMenuItem(
|
||||||
|
'保存到手机',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
const Divider(height: 0),
|
||||||
|
PopMenuItem(
|
||||||
|
'扫描二维码',
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
Permission.camera.request().isGranted.then((value) {
|
||||||
|
if (value) {
|
||||||
|
Get.to(const ScanPage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Divider(height: 0),
|
||||||
|
const Divider(height: 0.4),
|
||||||
|
Container(
|
||||||
|
color: AppColors.page,
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
const Divider(height: 0.4),
|
||||||
|
PopMenuItem(
|
||||||
|
'取消',
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class CustomAvatar extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (avtarUrl == null || avtarUrl == '') {
|
if (avtarUrl == null || avtarUrl == '') {
|
||||||
avtarUrl = 'assets/chats/default_avatar.png';
|
avtarUrl = 'assets/images/default_avatar.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
avtarUrl = avtarUrl!.trim();
|
avtarUrl = avtarUrl!.trim();
|
||||||
|
|||||||
@@ -542,14 +542,14 @@ packages:
|
|||||||
name: permission_handler
|
name: permission_handler
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.2.0"
|
version: "9.2.0"
|
||||||
permission_handler_android:
|
permission_handler_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: permission_handler_android
|
name: permission_handler_android
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.2.0"
|
version: "9.0.2+1"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -572,12 +572,12 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.1.2"
|
||||||
photo_manager:
|
photo_manager:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: photo_manager
|
name: photo_manager
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.2.1"
|
||||||
photo_view:
|
photo_view:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ dependencies:
|
|||||||
video_player: ^2.4.7
|
video_player: ^2.4.7
|
||||||
scroll_to_index: ^2.1.1
|
scroll_to_index: ^2.1.1
|
||||||
dart_date: ^1.1.1
|
dart_date: ^1.1.1
|
||||||
permission_handler: ^10.2.0
|
permission_handler: ^9.2.0
|
||||||
tuple: ^2.0.1
|
tuple: ^2.0.1
|
||||||
photo_view: ^0.14.0
|
photo_view: ^0.14.0
|
||||||
|
photo_manager: 2.2.1
|
||||||
chewie: ^1.3.5
|
chewie: ^1.3.5
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
@@ -56,4 +57,5 @@ flutter:
|
|||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- assets/icons/
|
- assets/icons/
|
||||||
|
- assets/images/
|
||||||
- assets/transits/
|
- assets/transits/
|
||||||
|
|||||||
Reference in New Issue
Block a user