unread messages api added.
parent
5dee736d28
commit
4fdd04b106
@ -0,0 +1,153 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/modules/cx_module/chat/chat_provider.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
|
||||
import '../../../widgets/loaders/no_data_found.dart';
|
||||
|
||||
class UnReadChatList extends StatelessWidget {
|
||||
UnReadChatList({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const DefaultAppBar(title: "Unread Messages"),
|
||||
body: FutureBuilder<List>(
|
||||
future: Provider.of<ChatProvider>(context, listen: false).getUnReadMessages(context.userProvider.user!.employeeId ?? context.userProvider.user!.username!),
|
||||
builder: (BuildContext context, AsyncSnapshot<List> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
|
||||
if (snapshot.data == null) return const NoDataFound().center;
|
||||
|
||||
return SizedBox();
|
||||
|
||||
// List<LoanAttachmentModel> allAttachments = snapshot.data!.loanAttachments!;
|
||||
//
|
||||
// return Column(
|
||||
// children: [
|
||||
// ListView(
|
||||
// padding: const EdgeInsets.all(16),
|
||||
// children: [
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// StatusLabel(
|
||||
// label: snapshot.data!.loanStatusName!,
|
||||
// textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.loanStatusName!),
|
||||
// backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.loanStatusName!),
|
||||
// ),
|
||||
// 1.width.expanded,
|
||||
// Text(
|
||||
// snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
|
||||
// textAlign: TextAlign.end,
|
||||
// style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// 12.height,
|
||||
// ...requesterDetails(context, snapshot.data!),
|
||||
// const Divider().defaultStyle(context),
|
||||
// ...requestDetails(context, snapshot.data!),
|
||||
// const Divider().defaultStyle(context),
|
||||
// ...assetDetails(context, snapshot.data!),
|
||||
// const Divider().defaultStyle(context),
|
||||
// ...installationDetails(context, snapshot.data!),
|
||||
// const Divider().defaultStyle(context),
|
||||
// ...doctorDetails(context, snapshot.data!),
|
||||
// const Divider().defaultStyle(context),
|
||||
// ...vendorDetails(context, snapshot.data!),
|
||||
// if (allAttachments.isNotEmpty) ...[
|
||||
// const Divider().defaultStyle(context),
|
||||
// Text(
|
||||
// "Attachments".addTranslation,
|
||||
// style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
||||
// ),
|
||||
// FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
||||
// ],
|
||||
// ],
|
||||
// ).toShadowContainer(context, padding: 12),
|
||||
// ],
|
||||
// ).expanded,
|
||||
// // @todo ask backend to add loanTypeValue, so we can show or hide the buttons
|
||||
// if (snapshot.data?.loanTypeName == "Standard" &&
|
||||
// context.userProvider.isEngineer &&
|
||||
// (snapshot.data?.loanStatusValue == 4 || snapshot.data?.loanStatusValue == 5 || snapshot.data?.loanStatusValue == 8))
|
||||
// FooterActionButton.footerContainer(
|
||||
// context: context,
|
||||
// child: AppFilledButton(
|
||||
// onPressed: () async {
|
||||
// if (snapshot.data?.loanStatusValue == 4) {
|
||||
// String comment = "";
|
||||
// context.showBottomSheet(
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// 'Estimated Date: ${snapshot.data?.installationEDD?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
|
||||
// 16.height,
|
||||
// AppTextFormField(
|
||||
// labelText: context.translation.comments,
|
||||
// showSpeechToText: true,
|
||||
// textInputType: TextInputType.multiline,
|
||||
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
||||
// showWithoutDecoration: true,
|
||||
// backgroundColor: context.isDarkNotListen ? AppColor.neutral20 : AppColor.neutral100,
|
||||
// alignLabelWithHint: true,
|
||||
// onChange: (text) {
|
||||
// comment = text;
|
||||
// },
|
||||
// ),
|
||||
// 16.height,
|
||||
// AppFilledButton(
|
||||
// onPressed: () async {
|
||||
// Utils.showLoading(context);
|
||||
// LoanProvider loanProvider = Provider.of<LoanProvider>(context, listen: false);
|
||||
// bool isSuccess = await loanProvider.loanWorkflowAction({
|
||||
// "userId": context.userProvider.user!.userID,
|
||||
// "isFromMobile": true,
|
||||
// "commentsFromMobile": comment,
|
||||
// 'loanId': snapshot.data?.id,
|
||||
// 'loanStatusId': snapshot.data?.loanStatusValue,
|
||||
// });
|
||||
// Utils.hideLoading(context);
|
||||
// if (isSuccess) {
|
||||
// Navigator.pop(context, true);
|
||||
// setState(() {});
|
||||
// }
|
||||
// },
|
||||
// label: "Delivered"),
|
||||
// ],
|
||||
// ),
|
||||
// title: "EDD & Comments",
|
||||
// showCancelButton: true);
|
||||
// return;
|
||||
// }
|
||||
// if (snapshot.data?.loanStatusValue == 5) {
|
||||
// bool isSuccess = await Navigator.push(context, MaterialPageRoute(builder: (context) => InstallationFormView(loanData: snapshot.data))) ?? false;
|
||||
// if (isSuccess) {
|
||||
// setState(() {});
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// bool isSuccess = await Navigator.push(context, MaterialPageRoute(builder: (context) => PullOutDetailsPage(loanData: snapshot.data))) ?? false;
|
||||
// if (isSuccess) {
|
||||
// setState(() {});
|
||||
// }
|
||||
// },
|
||||
// label: snapshot.data?.loanStatusValue == 4
|
||||
// ? "Delivered"
|
||||
// : snapshot.data?.loanStatusValue == 5
|
||||
// ? 'Installation Report'
|
||||
// : 'PullOut Report',
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// );
|
||||
}));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue