|
|
|
@ -7,7 +7,6 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:http/http.dart';
|
|
|
|
|
import 'package:logger/logger.dart' as L;
|
|
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/consts.dart';
|
|
|
|
@ -112,8 +111,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
List<SingleUserChatModel> temp = getSingleUserChatModel(response.body).reversed.toList();
|
|
|
|
|
userChatHistory.addAll(temp);
|
|
|
|
|
} else {
|
|
|
|
|
userChatHistory = getSingleUserChatModel(response.body);
|
|
|
|
|
userChatHistory = userChatHistory.reversed.toList();
|
|
|
|
|
userChatHistory = getSingleUserChatModel(response.body).reversed.toList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isLoading = false;
|
|
|
|
@ -400,12 +398,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
String chatData =
|
|
|
|
|
'{"contant":"${message.text}","contantNo":"${uuid.v4()}","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"${uuid.v4()}"}';
|
|
|
|
|
await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
|
|
|
|
|
userChatHistory.add(data);
|
|
|
|
|
|
|
|
|
|
userChatHistory.insert(0, data);
|
|
|
|
|
|
|
|
|
|
isFileSelected = false;
|
|
|
|
|
isMsgReply = false;
|
|
|
|
|
sFileType = "";
|
|
|
|
|
message.clear();
|
|
|
|
|
scrollToBottom();
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -622,4 +621,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
curve: Curves.easeIn,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void msgScroll() {
|
|
|
|
|
scrollController.animateTo(
|
|
|
|
|
scrollController.position.minScrollExtent - 100,
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
curve: Curves.easeIn,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|