Browse Source

优化

dev-2.0
王子贤 7 hours ago
parent
commit
dbc8dc30af
9 changed files with 126 additions and 64 deletions
  1. 8
      lib/controller/message/call_controller.dart
  2. 28
      lib/controller/message/chat_settings_controller.dart
  3. 40
      lib/pages/home/timeline_info.dart
  4. 9
      lib/pages/home/user_information_page.dart
  5. 18
      lib/pages/message/chat_settings_page.dart
  6. 18
      lib/pages/message/message_page.dart
  7. 44
      lib/pages/mine/mine_page.dart
  8. 19
      lib/pages/mine/my_friend_page.dart
  9. 6
      lib/widget/live/live_room_user_profile_dialog.dart

8
lib/controller/message/call_controller.dart

@ -851,8 +851,12 @@ class CallController extends GetxController {
print('📞 [CallController] 扬声器${isSpeakerOn.value ? "已开启" : "已关闭"}');
}
bool isClick = false;
///
Future<void> hangUpCall() async {
if(isClick) return;
isClick = true;
final callSession = currentCall.value;
//
@ -875,6 +879,7 @@ class CallController extends GetxController {
}
} catch (e) {
print('⚠️ [CallController] 调用取消接口异常: $e');
isClick = false;
}
} else if (callSession != null &&
callDurationSeconds.value > 0 &&
@ -892,6 +897,7 @@ class CallController extends GetxController {
}
} catch (e) {
print('⚠️ [CallController] 调用终止接口异常: $e');
isClick = false;
}
}
@ -900,6 +906,7 @@ class CallController extends GetxController {
await RTCManager.instance.leaveChannel();
} catch (e) {
print('⚠️ [CallController] 离开RTC频道异常: $e');
isClick = false;
}
// callStatus为'cancelled''terminated'onMessageContentChanged收到通知
@ -924,6 +931,7 @@ class CallController extends GetxController {
}
print('✅ [CallController] 通话已挂断');
isClick = false;
}
/// callStatus变化onMessageContentChanged调用

28
lib/controller/message/chat_settings_controller.dart

@ -1,3 +1,4 @@
import 'package:dating_touchme_app/network/user_api.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
@ -14,6 +15,7 @@ class ChatSettingsController extends GetxController {
final MarriageData? userData;
final _storage = GetStorage();
late UserApi _userApi;
//
final Rx<EMUserInfo?> userInfo = Rx<EMUserInfo?>(null);
@ -37,6 +39,7 @@ class ChatSettingsController extends GetxController {
@override
void onInit() {
super.onInit();
_userApi = Get.find<UserApi>();
try {
// userId
@ -358,7 +361,7 @@ class ChatSettingsController extends GetxController {
//
await IMManager.instance.addToBlacklist(userId);
isBlacklisted.value = true;
SmartDialog.showToast('已加入黑名单');
createUserBlack();
} else {
//
await IMManager.instance.removeFromBlacklist(userId);
@ -374,6 +377,29 @@ class ChatSettingsController extends GetxController {
}
}
createUserBlack() async {
try {
final response = await _userApi.userCreateUserBlacklist({
"blackUserId": userId,
});
if (response.data.isSuccess) {
SmartDialog.showToast('已拉黑成功');
} else {
//
throw Exception(response.data.message ?? '获取数据失败');
}
} catch(e){
print('拉黑失败: $e');
SmartDialog.showToast('拉黑失败');
rethrow;
} finally {
}
}
///
Future<void> toggleFollow() async {
try {

40
lib/pages/home/timeline_info.dart

@ -345,26 +345,26 @@ class TimelineInfo extends StatelessWidget {
//
// }),
// ),
ListenableBuilder(
listenable: controller.focusNode.value, //
builder: (context, child) {
// builder
return Visibility(
visible: controller.focusNode.value.hasFocus,
child: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
controller.parentId.value = "0";
},
child: Container(
color: const Color.fromRGBO(0, 0, 0, .4),
//
),
),
);
},
),
// ListenableBuilder(
// listenable: controller.focusNode.value, //
// builder: (context, child) {
// // builder
// return Visibility(
// visible: controller.focusNode.value.hasFocus,
// child: GestureDetector(
// onTap: () {
//
// FocusScope.of(context).unfocus();
// controller.parentId.value = "0";
// },
// child: Container(
// color: const Color.fromRGBO(0, 0, 0, .4),
// //
// ),
// ),
// );
// },
// ),
Positioned(
left: 0,
bottom: 0,

9
lib/pages/home/user_information_page.dart

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dating_touchme_app/controller/global.dart';
import 'package:dating_touchme_app/controller/home/user_information_controller.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/model/home/marriage_data.dart';
import 'package:dating_touchme_app/pages/home/report_page.dart';
@ -91,12 +92,16 @@ class UserInformationPage extends StatelessWidget {
width: 375.w,
height: 384.w,
fit: BoxFit.cover,
) : CachedNetworkImage(
).onTap((){
TDImageViewer.showImageViewer(context: context, images: controller.userData.value.photoList!.map((e) => e.photoUrl.toString()).toList());
}) : CachedNetworkImage(
imageUrl: "${controller.userData.value.profilePhoto}?x-oss-process=image/format,webp",
width: 375.w,
height: 384.w,
fit: BoxFit.cover,
),
).onTap((){
TDImageViewer.showImageViewer(context: context, images: [controller.userData.value.profilePhoto]);
}),
Positioned(
left: 120.w,
top: miId != GlobalData().userData!.id ? 300.w : 310.w,

18
lib/pages/message/chat_settings_page.dart

@ -220,16 +220,16 @@ class ChatSettingsPage extends StatelessWidget {
return Column(
children: [
//
_buildSettingItem(
title: '设置备注名',
showArrow: true,
onTap: () {
// TODO:
_showSetRemarkDialog(controller);
},
),
// _buildSettingItem(
// title: '设置备注名',
// showArrow: true,
// onTap: () {
// // TODO:
// _showSetRemarkDialog(controller);
// },
// ),
_buildDivider(),
// _buildDivider(),
//
_buildSwitchItem(

18
lib/pages/message/message_page.dart

@ -78,7 +78,7 @@ class _MessagePageState extends State<MessagePage> with AutomaticKeepAliveClient
children: [
if(controller.showSearch.value) Expanded(
child: Container(
height: 27.w,
height: 35.w,
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(27.w)),
@ -130,16 +130,22 @@ class _MessagePageState extends State<MessagePage> with AutomaticKeepAliveClient
SizedBox(width: 10,),
Row(
children: [
Icon(Icons.close, size: 15,).onTap((){
controller.searchController.value.clear();
controller.onTextChanged("");
controller.search();
}),
SizedBox(width: 5,),
Text(
"搜索",
style: TextStyle(
fontSize: 12
fontSize: 15
),
)
).onTap((){
controller.search();
})
],
).onTap((){
controller.search();
})
)
],
),
),

44
lib/pages/mine/mine_page.dart

@ -16,6 +16,7 @@ import 'package:dating_touchme_app/pages/mine/user_help_center_page.dart';
import 'package:dating_touchme_app/pages/mine/vip_page.dart';
import 'package:dating_touchme_app/pages/setting/setting_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@ -203,13 +204,42 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
)
],
),
Text(
"ID:${controller.userId.value ?? ""}",
style: TextStyle(
fontSize: 10.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w500
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"ID:${controller.userId.value ?? ""}",
style: TextStyle(
fontSize: 10.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w500
),
),
Container(
width: 33.w,
height: 13.w,
margin: EdgeInsets.only(left: 5.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(13.w)),
color: const Color.fromRGBO(
201, 201, 201, 1.0)
),
child: Center(
child: Text(
"复制",
style: TextStyle(
fontSize: 11.w,
color: Colors.white
),
),
),
).onTap(() async {
await Clipboard.setData(
ClipboardData(text: controller.userId.value ?? ""),
);
SmartDialog.showToast('复制成功');
}),
],
),
if(controller.userData.value?.matchmakerFlag ?? false) Text(
"邀请码:${controller.userData.value?.code ?? ""}",

19
lib/pages/mine/my_friend_page.dart

@ -265,24 +265,7 @@ class _UserItemState extends State<UserItem> {
)
],
),
Container(
width: 60.w,
height: 22.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(22.w)),
color: const Color.fromRGBO(224, 224, 224, .5)
),
child: Center(
child: Text(
"已关注",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
),
),
)
],
),
).onTap((){

6
lib/widget/live/live_room_user_profile_dialog.dart

@ -5,6 +5,7 @@ import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/model/home/user_info_data.dart';
import 'package:dating_touchme_app/model/live/live_chat_message.dart';
import 'package:dating_touchme_app/pages/home/report_page.dart';
import 'package:dating_touchme_app/pages/home/user_information_page.dart';
import 'package:dating_touchme_app/pages/message/chat_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -503,7 +504,10 @@ void showUserProfileDialog(
height: 60.w,
),
),
),
).onTap((){
Get.to(() => UserInformationPage(miId: userData.miId ?? ""));
}),
],
);
},

Loading…
Cancel
Save