修改登录页面点击背景键盘无法收起,增加聊天屏蔽词无法发出功能

This commit is contained in:
CYH 2023-08-10 14:39:38 +03:00
parent 030041e5ca
commit b3e43fd187
3 changed files with 25 additions and 16 deletions

View File

@ -332,8 +332,9 @@ bool isSendLoging = false;
var data = await DioManager.instance var data = await DioManager.instance
.post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2});
isSendLoging = false; isSendLoging = false;
List words = [];
if (data['data']['code'] == 10000) { if (data['data']['code'] == 10000) {
List words = data['data']['words']; words = data['data']['words'];
if (words.isNotEmpty) { if (words.isNotEmpty) {
for (int i = 0; i < words.length; i++) { for (int i = 0; i < words.length; i++) {
text = text.replaceAll(words[i], '*'); text = text.replaceAll(words[i], '*');
@ -341,10 +342,17 @@ bool isSendLoging = false;
} }
} }
MessageUtils.handleMessageError( if (words.isEmpty) {
widget.model.sendTextMessage( MessageUtils.handleMessageError(
text: text, convID: widget.conversationID, convType: convType), widget.model.sendTextMessage(
context); text: text, convID: widget.conversationID, convType: convType),
context);
} else {
textEditingController.text = text;
showOKToast('含违规词汇,无法发送');
return;
}
} }
textEditingController.clear(); textEditingController.clear();
currentCursor = null; currentCursor = null;

View File

@ -174,9 +174,10 @@ class Complete_materialPage extends StatelessWidget {
left: 28.sp, left: 28.sp,
right: 28.sp), right: 28.sp),
height: 116.sp, height: 116.sp,
width: Get.width - 50.sp,
child: Stack( child: Stack(
children: [ children: [
Image.asset(getLoginImage('desc_bg')), Image.asset(getLoginImage('desc_bg'),width: Get.width - 50.sp,fit: BoxFit.fill,),
TextField( TextField(
maxLines: 4, maxLines: 4,
controller: controller:

View File

@ -26,14 +26,14 @@ class LoginPage extends StatelessWidget {
width: Get.width, width: Get.width,
height: Get.height, height: Get.height,
), ),
Scaffold( GestureDetector(
resizeToAvoidBottomInset: false, onTap: () {
backgroundColor: Colors.transparent, FocusManager.instance.primaryFocus?.unfocus();
body: GestureDetector( },
onTap: () { child: Scaffold(
FocusManager.instance.primaryFocus?.unfocus(); resizeToAvoidBottomInset: false,
}, backgroundColor: Colors.transparent,
child: GetBuilder<LoginLogic>(builder: (logic) { body: GetBuilder<LoginLogic>(builder: (logic) {
return Stack( return Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
@ -287,8 +287,8 @@ class LoginPage extends StatelessWidget {
], ],
); );
}), })),
)), ),
], ],
); );
} }