Browse Source

完善功能

dev-2.0
YakumoChen 1 day ago
parent
commit
1d5f161cc3
6 changed files with 91 additions and 3 deletions
  1. 2
      android/gradle.properties
  2. 1
      lib/controller/home/home_controller.dart
  3. 37
      lib/controller/message/chat_controller.dart
  4. 37
      lib/pages/home/report_page.dart
  5. 14
      lib/pages/message/chat_page.dart
  6. 3
      lib/pages/setting/blacklist_page.dart

2
android/gradle.properties

@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m
android.useAndroidX=true
android.enableJetifier=true
#org.gradle.java.home=D:/jdk-17.0.11
org.gradle.java.home=D:/jdk-17.0.11
#systemProp.http.proxyHost=127.0.0.1
#systemProp.http.proxyPort=10810
#systemProp.https.proxyHost=127.0.0.1

1
lib/controller/home/home_controller.dart

@ -99,6 +99,7 @@ class HomeController extends GetxController {
try {
print(1);
print(await _locationPlugin.getCurrentLocation());
final location = await _locationPlugin.getCurrentLocation();
print(2);

37
lib/controller/message/chat_controller.dart

@ -1,4 +1,5 @@
import 'package:dating_touchme_app/controller/discover/svga_player_manager.dart';
import 'package:dating_touchme_app/model/home/check_black_data.dart';
import 'package:get/get.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter/material.dart';
@ -120,6 +121,28 @@ class ChatController extends GetxController {
if (_externalNickName != null || _externalAvatarUrl != null) {
update();
}
getCheckBlack();
}
final blackData = Rx(CheckBlackData());
getCheckBlack() async {
try {
final response = await _networkService.userApi.userCheckUserBlacklist(targetUserId: userId);
if (response.data.isSuccess && response.data.data != null) {
blackData.value = response.data.data ?? CheckBlackData();
} else {
//
throw Exception(response.data.message ?? '获取数据失败');
}
} catch(e){
print('黑名单数据获取失败: $e');
SmartDialog.showToast('黑名单数据获取失败');
rethrow;
}
}
void setDialogDismiss(bool flag){
@ -314,6 +337,13 @@ class ChatController extends GetxController {
///
Future<bool> sendMessage(String content) async {
if(blackData.value.activeBlack == true){
SmartDialog.showToast('您已将对方拉黑,不能进行这项操作');
return false;
} else if(blackData.value.passiveBlack == true){
SmartDialog.showToast('您已被对方拉黑,不能进行这项操作');
return false;
}
EMMessage? tempMessage;
try {
if (Get.isLogEnable) {
@ -558,6 +588,13 @@ class ChatController extends GetxController {
///
Future<bool> sendVoiceMessage(String filePath, int seconds) async {
if(blackData.value.activeBlack == true){
SmartDialog.showToast('您已将对方拉黑,不能进行这项操作');
return false;
} else if(blackData.value.passiveBlack == true){
SmartDialog.showToast('您已被对方拉黑,不能进行这项操作');
return false;
}
//
if (isSendingVoice.value) {
if (Get.isLogEnable) {

37
lib/pages/home/report_page.dart

@ -302,7 +302,7 @@ class ReportPage extends StatelessWidget {
),
SizedBox(height: 29.w ,),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"图片证据(选填)",
@ -311,6 +311,18 @@ class ReportPage extends StatelessWidget {
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
Row(
children: [
Text(
"${controller.imgList.length}/9",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
SizedBox(width: 15,)
],
),
],
),
SizedBox(height: 13.w ,),
@ -370,7 +382,7 @@ class ReportPage extends StatelessWidget {
),
SizedBox(height: 15.w ,),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"投诉内容(选填)",
@ -379,6 +391,18 @@ class ReportPage extends StatelessWidget {
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
Row(
children: [
Text(
"${controller.message.value.length}/200",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
SizedBox(width: 15,)
],
),
],
),
Container(
@ -391,6 +415,15 @@ class ReportPage extends StatelessWidget {
controller: controller.messageController.value,
minLines: 3, //
maxLines: 3, //
maxLength: 200,
buildCounter: (
context, {
required int currentLength,
required bool isFocused,
required int? maxLength,
}) {
return null; // 👈
},
style: TextStyle(
fontSize: ScreenUtil().setWidth(12),
height: 1

14
lib/pages/message/chat_page.dart

@ -402,6 +402,13 @@ class _ChatPageState extends State<ChatPage> {
await controller.sendMessage(message);
},
onImageSelected: (imagePaths) async {
if(controller.blackData.value.activeBlack == true){
SmartDialog.showToast('您已将对方拉黑,不能进行这项操作');
return;
} else if(controller.blackData.value.passiveBlack == true){
SmartDialog.showToast('您已被对方拉黑,不能进行这项操作');
return;
}
//
for (var imagePath in imagePaths) {
await controller.sendImageMessage(imagePath);
@ -417,6 +424,13 @@ class _ChatPageState extends State<ChatPage> {
},
//
onVideoCall: () async {
if(controller.blackData.value.activeBlack == true){
SmartDialog.showToast('您已将对方拉黑,不能进行这项操作');
return;
} else if(controller.blackData.value.passiveBlack == true){
SmartDialog.showToast('您已被对方拉黑,不能进行这项操作');
return;
}
//
final products = await CallController.instance.listChatAudioProduct(widget.userId);
//

3
lib/pages/setting/blacklist_page.dart

@ -183,6 +183,7 @@ class _BlackItemState extends State<BlackItem> {
),
).onTap((){
Get.back();
Get.to(() => UserInformationPage(miId: widget.item.miId ?? ""));
}),
Container(
@ -199,6 +200,7 @@ class _BlackItemState extends State<BlackItem> {
),
),
).onTap((){
Get.back();
widget.controller.unBlack(widget.item.id ?? "");
}),
Container(
@ -216,6 +218,7 @@ class _BlackItemState extends State<BlackItem> {
),
),
).onTap((){
Get.back();
Get.to(() => ReportPage(id: widget.item.blackUserId ?? "", userId: widget.item.blackUserId ?? "", type: 1,));
}),

Loading…
Cancel
Save