|
|
|
|
@ -93,20 +93,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
|
|
|
|
|
void getSingleUserChatHistory({required String senderUID, required int receiverUID, required bool loadMore}) async {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
print(loadMore);
|
|
|
|
|
print(senderUID);
|
|
|
|
|
print(receiverUID);
|
|
|
|
|
if (!loadMore) paginationVal = 0;
|
|
|
|
|
print(paginationVal);
|
|
|
|
|
isChatScreenActive = true;
|
|
|
|
|
Response response = await ApiClient().getJsonForResponse(
|
|
|
|
|
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$paginationVal",
|
|
|
|
|
token: AppState().chatDetails!.response!.token,
|
|
|
|
|
);
|
|
|
|
|
logger.d("${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$paginationVal");
|
|
|
|
|
logger.d("${AppState().chatDetails!.response!.token}");
|
|
|
|
|
logger.d(jsonEncode(response.body));
|
|
|
|
|
logger.d(jsonEncode(response.statusCode));
|
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
|
if (!loadMore) userChatHistory = [];
|
|
|
|
|
Utils.showToast("No More Data To Load");
|
|
|
|
|
@ -119,10 +111,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isLoading = false;
|
|
|
|
|
//Timer(const Duration(milliseconds: 100),() => scrollToBottom());
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
|
|
// scrollToBottom();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SingleUserChatModel> getSingleUserChatModel(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
|
|
|
|
|
@ -364,15 +353,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void scrollDown() {
|
|
|
|
|
// scrollController.animateTo(
|
|
|
|
|
// scrollController.position.maxScrollExtent + 100,
|
|
|
|
|
// curve: Curves.easeOut,
|
|
|
|
|
// duration: const Duration(milliseconds: 300),
|
|
|
|
|
// );
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Future<void> sendChatToServer(
|
|
|
|
|
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
|
|
|
|
|
Uuid uuid = const Uuid();
|
|
|
|
|
@ -605,22 +585,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void scrollToBottom() {
|
|
|
|
|
//scrollController.jumpTo(scrollController.position.maxScrollExtent + 100 );
|
|
|
|
|
scrollController.animateTo(
|
|
|
|
|
scrollController.position.maxScrollExtent + 100,
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
curve: Curves.easeIn,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void scrollToMaxExtent() {
|
|
|
|
|
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
// scrollController.animateTo(
|
|
|
|
|
// scrollController.position.maxScrollExtent,
|
|
|
|
|
// duration: const Duration(milliseconds: 100),
|
|
|
|
|
// curve: Curves.easeIn,
|
|
|
|
|
// );
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|