From fd7a85f9300705ea98158468ccfab64c5908a7de Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 26 Oct 2025 17:31:26 +0300 Subject: [PATCH] chat ui added --- ios/Runner.xcodeproj/project.pbxproj | 94 +++++++------- lib/dashboard_latest/dashboard_view.dart | 72 +++++------ .../widgets/app_bar_widget.dart | 4 +- .../service_request_detail_main_view.dart | 7 ++ .../my_request/all_requests_filter_page.dart | 4 + .../device_transfer_details.dart | 2 +- lib/views/pages/temporary_chat_ui.dart | 118 ++++++++++++++++++ 7 files changed, 212 insertions(+), 89 deletions(-) create mode 100644 lib/views/pages/temporary_chat_ui.dart diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6d04a2a4..ca71349b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -12,10 +12,10 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 84713E5C1A48D35EB02DB255 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC2334F09AFE7D4C8720A3D2 /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A2260A7AB1A032E28BE67204 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 492AE90B9DF0F0CD3EC80D6B /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -37,12 +37,13 @@ 00C3AFCD29769C37002E7B47 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2E3CB8321FC9463EA4F59770 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 492AE90B9DF0F0CD3EC80D6B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 834C7D121918F9FF211C5314 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 7F2227814B600A00CFEA99D8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 7F3D9B6275D87F5A30423C02 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -50,8 +51,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B01BA1F7378A0B9F7249FF2A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - DC2334F09AFE7D4C8720A3D2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E21ADF0ABBDC16D7ADE23435 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -59,7 +59,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 84713E5C1A48D35EB02DB255 /* Pods_Runner.framework in Frameworks */, + A2260A7AB1A032E28BE67204 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -69,9 +69,9 @@ 577ED37A491ADCF557B4F6D9 /* Pods */ = { isa = PBXGroup; children = ( - 2E3CB8321FC9463EA4F59770 /* Pods-Runner.debug.xcconfig */, - B01BA1F7378A0B9F7249FF2A /* Pods-Runner.release.xcconfig */, - 834C7D121918F9FF211C5314 /* Pods-Runner.profile.xcconfig */, + E21ADF0ABBDC16D7ADE23435 /* Pods-Runner.debug.xcconfig */, + 7F3D9B6275D87F5A30423C02 /* Pods-Runner.release.xcconfig */, + 7F2227814B600A00CFEA99D8 /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -95,7 +95,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 577ED37A491ADCF557B4F6D9 /* Pods */, - ACFB4E3E17DB02D4A9B63D84 /* Frameworks */, + F564DD31C8E362C7E6DB831B /* Frameworks */, ); sourceTree = ""; }; @@ -124,10 +124,10 @@ path = Runner; sourceTree = ""; }; - ACFB4E3E17DB02D4A9B63D84 /* Frameworks */ = { + F564DD31C8E362C7E6DB831B /* Frameworks */ = { isa = PBXGroup; children = ( - DC2334F09AFE7D4C8720A3D2 /* Pods_Runner.framework */, + 492AE90B9DF0F0CD3EC80D6B /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -139,15 +139,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - F8BE49D37BC14FBD6C4F3196 /* [CP] Check Pods Manifest.lock */, + CBBF05D499604DC1E6EE7870 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - B921EEB42AD074FA76A076B1 /* [CP] Embed Pods Frameworks */, - A65B36E3496C62B7D376B428 /* [CP] Copy Pods Resources */, + 7A91DC530917EFFE5E65E531 /* [CP] Embed Pods Frameworks */, + F342829340EC618544BEA3D0 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -225,56 +225,39 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - A65B36E3496C62B7D376B428 /* [CP] Copy Pods Resources */ = { + 7A91DC530917EFFE5E65E531 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - B921EEB42AD074FA76A076B1 /* [CP] Embed Pods Frameworks */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + name = "Run Script"; + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - F8BE49D37BC14FBD6C4F3196 /* [CP] Check Pods Manifest.lock */ = { + CBBF05D499604DC1E6EE7870 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -296,6 +279,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + F342829340EC618544BEA3D0 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -469,8 +469,6 @@ "-framework", "\"nanopb\"", "-framework", - "\"qr_code_scanner\"", - "-framework", "\"speech_to_text\"", "-framework", "\"sqflite\"", @@ -689,8 +687,6 @@ "-framework", "\"nanopb\"", "-framework", - "\"qr_code_scanner\"", - "-framework", "\"speech_to_text\"", "-framework", "\"sqflite\"", @@ -795,8 +791,6 @@ "-framework", "\"nanopb\"", "-framework", - "\"qr_code_scanner\"", - "-framework", "\"speech_to_text\"", "-framework", "\"sqflite\"", diff --git a/lib/dashboard_latest/dashboard_view.dart b/lib/dashboard_latest/dashboard_view.dart index 3e399e41..93e78b53 100644 --- a/lib/dashboard_latest/dashboard_view.dart +++ b/lib/dashboard_latest/dashboard_view.dart @@ -132,42 +132,42 @@ class _DashboardViewState extends State { ), ), ), - if (user != null && user.employeeIsHMG == false) - Positioned( - right: 20.toScreenWidth, - bottom: 20.toScreenHeight, - child: GestureDetector( - onTap: () async { - bool isNfcSupported = await NfcManager.instance.isAvailable(); - SwipeGeneralUtils.instance.showSwipeTypeBottomSheetSheet(isNfcSupported: isNfcSupported); - }, - child: CircularAnimatedContainer( - child: Container( - width: 100.toScreenWidth, - height: 100.toScreenHeight, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: AppColor.background(context), - border: Border.all(color: AppColor.primary10.withOpacity(0.5), width: 2), - ), - child: Consumer(builder: (context, userProvider, child) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 'swipe'.toSvgAsset(width: 32, height: 32), - 8.height, - Text( - ("${context.translation.checkIn}\n${userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.instance.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime!) : '--:--'}"), - style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w500, fontFamily: "Poppins"), - ), - ], - ); - }), - ), - ), - ), - ), + // if (user != null && user.employeeIsHMG == false) + // Positioned( + // right: 20.toScreenWidth, + // bottom: 20.toScreenHeight, + // child: GestureDetector( + // onTap: () async { + // bool isNfcSupported = await NfcManager.instance.isAvailable(); + // SwipeGeneralUtils.instance.showSwipeTypeBottomSheetSheet(isNfcSupported: isNfcSupported); + // }, + // child: CircularAnimatedContainer( + // child: Container( + // width: 100.toScreenWidth, + // height: 100.toScreenHeight, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // color: AppColor.background(context), + // border: Border.all(color: AppColor.primary10.withOpacity(0.5), width: 2), + // ), + // child: Consumer(builder: (context, userProvider, child) { + // return Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // 'swipe'.toSvgAsset(width: 32, height: 32), + // 8.height, + // Text( + // ("${context.translation.checkIn}\n${userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.instance.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime!) : '--:--'}"), + // style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w500, fontFamily: "Poppins"), + // ), + // ], + // ); + // }), + // ), + // ), + // ), + // ), ], ); } diff --git a/lib/dashboard_latest/widgets/app_bar_widget.dart b/lib/dashboard_latest/widgets/app_bar_widget.dart index d78333d6..a716fd58 100644 --- a/lib/dashboard_latest/widgets/app_bar_widget.dart +++ b/lib/dashboard_latest/widgets/app_bar_widget.dart @@ -51,11 +51,11 @@ class AppBarWidget extends StatelessWidget { children: [ Text( snapshot.user?.username ?? "", // Simplified null check - style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600), + style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600, fontSize: context.isTablet() ? 14 : null), ), Text( snapshot.user?.type?.name.toCamelCase ?? "", // Simplified null check - style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20), + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20, fontSize: context.isTablet() ? 12 : null), ), ], ), diff --git a/lib/modules/cm_module/views/service_request_detail_main_view.dart b/lib/modules/cm_module/views/service_request_detail_main_view.dart index bd89910c..e3d66a13 100644 --- a/lib/modules/cm_module/views/service_request_detail_main_view.dart +++ b/lib/modules/cm_module/views/service_request_detail_main_view.dart @@ -12,6 +12,7 @@ import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.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 'package:test_sa/views/pages/temporary_chat_ui.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; import 'components/history_log_view.dart'; import 'components/service_request_detail_view.dart'; @@ -81,6 +82,12 @@ class _ServiceRequestDetailMainState extends State { Navigator.pop(context); }, actions: [ + IconButton( + icon: const Icon(Icons.message_rounded), + onPressed: () { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => TemporaryChatUI())); + }, + ), isNurse ? IconButton( icon: 'qr'.toSvgAsset( diff --git a/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart b/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart index 9cfce9d4..e842eeb0 100644 --- a/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart +++ b/lib/new_views/pages/land_page/my_request/all_requests_filter_page.dart @@ -77,6 +77,10 @@ class _AllRequestsFilterPageState extends State { types['Recall and Alert'] = 7; } + if (isEngineer) { + types['Inventory Session'] = 8; + } + if (!isEngineer) { types['TRAF'] = 9; } diff --git a/lib/views/pages/device_transfer/device_transfer_details.dart b/lib/views/pages/device_transfer/device_transfer_details.dart index 1f857949..20a9acb8 100644 --- a/lib/views/pages/device_transfer/device_transfer_details.dart +++ b/lib/views/pages/device_transfer/device_transfer_details.dart @@ -273,7 +273,7 @@ class _DeviceTransferDetailsState extends State { // ? (!(_model?.senderMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.senderMachineStatusName?.toLowerCase()?.contains("complete") ?? false)) // : (!(_model?.receiverMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.receiverMachineStatusName?.toLowerCase()?.contains("complete") ?? false))) // - "edit".toSvgAsset(height: 48, width: 48).onPress(() async { + "edit".toSvgAsset(height: 48, width: 48).onPress(() async { bool isReload = (await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model!, isSender: isSender)))) as bool; if (isReload ?? false) { setState(() {}); diff --git a/lib/views/pages/temporary_chat_ui.dart b/lib/views/pages/temporary_chat_ui.dart new file mode 100644 index 00000000..3584fe6c --- /dev/null +++ b/lib/views/pages/temporary_chat_ui.dart @@ -0,0 +1,118 @@ +import 'package:date_picker_timeline/extra/color.dart'; +import 'package:flutter/material.dart'; +import 'package:test_sa/extensions/context_extension.dart'; +import 'package:test_sa/extensions/int_extensions.dart'; +import 'package:test_sa/extensions/string_extensions.dart'; +import 'package:test_sa/extensions/text_extensions.dart'; +import 'package:test_sa/extensions/widget_extensions.dart'; +import 'package:test_sa/models/gas_refill_comments_model.dart'; +import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; +import 'package:test_sa/new_views/app_style/app_color.dart'; +import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; +import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; + +class TemporaryChatUI extends StatefulWidget { + TemporaryChatUI({Key? key}) : super(key: key); + + @override + _TemporaryChatUIState createState() { + return _TemporaryChatUIState(); + } +} + +class _TemporaryChatUIState extends State { + List chatList = []; + + bool isSender = true; + TextEditingController textEditingController = TextEditingController(); + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const DefaultAppBar(title: "Comments"), + body: Column( + children: [ + ListView.separated( + itemCount: chatList.length, + padding: const EdgeInsets.all(16), + separatorBuilder: (cxt, index) => 12.height, + reverse: true, + itemBuilder: (context, itemIndex) { + final model = chatList[itemIndex]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + model.createdBy!.userName!.heading6(context), + (model.comment ?? "").bodyText(context), + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Text(DateTime.tryParse(model.createdOn!)!.toIso8601String().toServiceRequestDetailsFormatWithSS, + style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50)), + ), + ], + ).toShadowContainer(context, + paddingObject: const EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8), + borderRadius: 20, + showShadow: false, + backgroundColor: model.createdBy!.userId == "0" ? null : AppColor.neutral120.withOpacity(.25), + margin: EdgeInsets.only(left: model.createdBy!.userId == "0" ? 50 : 0, right: model.createdBy!.userId == "0" ? 0 : 50)); + }, + ).expanded, + FooterActionButton.footerContainer( + context: context, + child: Row( + children: [ + AppTextFormField( + labelText: "Type any comment", + backgroundColor: AppColor.neutral30, + // alignLabelWithHint: true, + showShadow: false, + controller: textEditingController, + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + hintStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff3B3D4A)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: context.isDark ? Colors.white : const Color(0xff767676)), + makeMultiLinesNull: true, + ).expanded, + 12.width, + Container( + height: 50, + width: 50, + alignment: Alignment.center, + decoration: const BoxDecoration(shape: BoxShape.circle, color: AppColor.neutral30), + child: const Icon(Icons.send_rounded).onPress(() { + if (textEditingController.text.isNotEmpty) { + final comment = GasRefillComment( + id: 0, + gasRefillId: 0, + comment: textEditingController.text, + createdOn: DateTime.now().toIso8601String(), + createdBy: CreatedBy(userId: isSender ? "0" : "1", userName: isSender ? "Me" : "User"), + ); + isSender = !isSender; + chatList.add(comment); + textEditingController.clear(); + + chatList.sort((a, b) => DateTime.parse(b.createdOn!).compareTo(DateTime.parse(a.createdOn!))); + setState(() {}); + } + })), + ], + ), + ), + ], + ), + ); + } +}