chat improvements

design_3.0_cx_module
Sikander Saleem 2 weeks ago
parent f3aa929cb1
commit e52caee730

@ -34,10 +34,13 @@ class ServiceRequestDetailMain extends StatefulWidget {
class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
late ServiceRequestDetailProvider _requestProvider;
static const int moduleId = 3;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
Provider.of<ChatProvider>(context, listen: false).reset();
getInitialData();
});
}
@ -93,7 +96,7 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
} else {
ServiceRequestDetailProvider provider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
if (provider.currentWorkOrder?.data?.status?.value == 2) {
getChatToken(1, provider.currentWorkOrder?.data?.workOrderNo ?? "");
getChatToken(moduleId, provider.currentWorkOrder?.data?.workOrderNo ?? "");
return Consumer<ChatProvider>(builder: (pContext, requestProvider, _) {
return IconButton(
icon: const Icon(Icons.chat_bubble),
@ -102,7 +105,7 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
context,
CupertinoPageRoute(
builder: (context) => ChatPage(
moduleId: 1,
moduleId: 3,
requestId: widget.requestId,
title: _requestProvider.currentWorkOrder?.data?.workOrderNo ?? "",
readOnly: _requestProvider.isReadOnlyRequest,

@ -164,7 +164,7 @@ class _ChatPageState extends State<ChatPage> {
decorationColor: AppColor.white10,
),
).onPress(() {
Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: 1, requestId: widget.requestId)));
Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: widget.moduleId, requestId: widget.requestId)));
}),
],
),
@ -744,12 +744,12 @@ class _ChatPageState extends State<ChatPage> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
if (chatResponse?.downloadUrl != null) ...[
if (chatResponse!.fileTypeResponse!.fileKind.toString().toLowerCase() == "audio") ChatAudioPlayer(chatResponse!.fileTypeResponse!, chatResponse.downloadUrl!)
],
Text(
contentMsg,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.white10),
).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading),
ChatFileViewer(chatResponse!.downloadUrl!, chatResponse.fileTypeResponse!),
] else
Text(
contentMsg,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.white10),
).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading),
if (loading) 4.height,
Align(
alignment: Alignment.centerRight,

@ -194,7 +194,6 @@ class ChatProvider with ChangeNotifier, DiagnosticableTreeMixin {
// } catch (e) {}
// }
Future<void> connectToHub(int moduleId, int requestId, String myId, String assigneeEmployeeNumber) async {
userChatHistoryLoading = true;
notifyListeners();

Loading…
Cancel
Save