会话加好友

This commit is contained in:
2022-10-25 16:50:48 +08:00
parent b8242e66bd
commit 7c5201ea2b
16 changed files with 128 additions and 51 deletions

View File

@@ -2,6 +2,7 @@ import 'package:chat/configs/app_colors.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/routes/moments_routes.dart';
import 'package:chat/services/tim/conversation_service.dart';
import 'package:chat/utils/im_tools.dart';
import 'package:chat/views/home/widgets/action_button.dart';
@@ -75,18 +76,18 @@ class ContactFriendProfilePage extends StatelessWidget {
);
},
),
// const SizedBox(height: 8),
// ActionItem(
// '他的动态',
// onTap: () {
// Get.toNamed(
// MomentsRoutes.user,
// arguments: {
// 'userId': _.currentFriend.value.userID,
// },
// );
// },
// ),
const SizedBox(height: 8),
ActionItem(
'他的动态',
onTap: () {
Get.toNamed(
MomentsRoutes.user,
arguments: {
'userId': _.currentFriend.value.userID,
},
);
},
),
const SizedBox(height: 8),
Visibility(
visible: !_.currentFriend.value.isFriend,
@@ -94,7 +95,7 @@ class ContactFriendProfilePage extends StatelessWidget {
'添加到通讯录',
onTap: () {
Get.toNamed(
ContactRoutes.friendApply,
ContactRoutes.friendRequestApply,
arguments: {
'userID': _.currentFriend.value.userID,
},

View File

@@ -1,4 +1,5 @@
import 'package:chat/configs/app_colors.dart';
import 'package:chat/services/auth_service.dart';
import 'package:chat/services/tim/friend_service.dart';
import 'package:chat/utils/ui_tools.dart';
import 'package:chat/widgets/custom_primary_button.dart';
@@ -26,7 +27,7 @@ class _ContactFriendRequestApplyPageState
super.initState();
userID = Get.arguments['userID'];
_wordingController.text = '我是 ';
_wordingController.text = '我是 ${AuthService.to.userInfo.value.nickname}';
}
@override

View File

@@ -76,7 +76,7 @@ class _ImFriendRequestState extends State<ContactFriendRequestPage> {
);
}
Get.toNamed(
ContactRoutes.friendApply,
ContactRoutes.friendRequestApply,
arguments: {
'userID': user.userID,
},

View File

@@ -1,6 +1,5 @@
import 'package:chat/routes/user_routes.dart';
import 'package:chat/services/auth_service.dart';
import 'package:chat/widgets/custom_avatar.dart';
import 'package:chat/views/user/index/widgets/user_top_bar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -18,34 +17,8 @@ class _UserPageState extends State<UserPage> {
child: Scaffold(
body: Column(
children: [
GetX<AuthService>(builder: (_) {
return Row(
children: [
CustomAvatar(
_.userInfo.value.avatar,
size: 72,
),
Column(
children: [
Text(_.userInfo.value.nickname ?? ''),
Text('${_.userInfo.value.address}'),
],
),
Expanded(child: Container()),
InkWell(
onTap: () {
Get.toNamed(UserRoutes.qrCode);
},
child: Row(
children: const [
Icon(Icons.qr_code),
Icon(Icons.arrow_forward_ios),
],
),
),
],
);
}),
const UserTopBar(),
const SizedBox(height: 8),
ListTile(
onTap: () {
Get.toNamed(UserRoutes.share);

View File

@@ -0,0 +1,72 @@
import 'package:chat/configs/app_colors.dart';
import 'package:chat/routes/user_routes.dart';
import 'package:chat/services/auth_service.dart';
import 'package:chat/utils/convert.dart';
import 'package:chat/widgets/custom_avatar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class UserTopBar extends StatelessWidget {
const UserTopBar({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: AppColors.white,
padding: const EdgeInsets.only(
left: 24,
top: 48,
right: 24,
bottom: 24,
),
height: 64 + 48 + 24,
child: GetX<AuthService>(builder: (_) {
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
CustomAvatar(
_.userInfo.value.avatar,
size: 64,
),
const SizedBox(width: 16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_.userInfo.value.nickname ?? '',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w400,
),
),
Text(Convert.hideCenterStr(_.userInfo.value.address ?? '')),
],
),
Expanded(child: Container()),
InkWell(
onTap: () {
Get.toNamed(UserRoutes.qrCode);
},
child: Row(
children: const [
Icon(
Icons.qr_code,
size: 18,
color: AppColors.unactive,
),
SizedBox(width: 8),
Icon(
Icons.arrow_forward_ios,
size: 16,
color: AppColors.unactive,
),
],
),
),
],
);
}),
);
}
}