diff --git a/lib/dashboard_latest/widgets/app_bar_widget.dart b/lib/dashboard_latest/widgets/app_bar_widget.dart index c2865647..d6ac1c50 100644 --- a/lib/dashboard_latest/widgets/app_bar_widget.dart +++ b/lib/dashboard_latest/widgets/app_bar_widget.dart @@ -211,7 +211,7 @@ class _AppBarWidgetState extends State with TickerProviderStateMix [], builder: (_, MenuController controller, Widget? child) { return Container( - padding: const EdgeInsets.all(10), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: AppColor.assetGroupBackground(context), @@ -222,10 +222,13 @@ class _AppBarWidgetState extends State with TickerProviderStateMix ), child: Row( mainAxisSize: MainAxisSize.min, - spacing: 16, + spacing: 8, children: [ - Text(settingProvider.assetGroup?.name ?? "", style: AppTextStyles.bodyText2.copyWith(color: AppColor.headingTextColor(context))), - Icon(Icons.keyboard_arrow_down, color: AppColor.headingTextColor(context)), + Text( + settingProvider.assetGroup?.name ?? "", + style: AppTextStyles.bodyText2.copyWith(color: AppColor.headingTextColor(context)), + ), + Icon(Icons.keyboard_arrow_down, color: AppColor.headingTextColor(context), size: 20), ], ), ).onPress(() { @@ -240,7 +243,7 @@ class _AppBarWidgetState extends State with TickerProviderStateMix }), ), ), - 16.width, + 8.width, SlideTransition( position: _rightSlideAnimation, child: FadeTransition( @@ -248,20 +251,31 @@ class _AppBarWidgetState extends State with TickerProviderStateMix child: Row( children: [ if (context.settingProvider.isUserFlowMedical) ...[ - ("dashboard/chat").toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)).paddingOnly(top: 0, end: 0).onPress(() { - Navigator.of(context).push(CupertinoPageRoute(builder: (_) => UnReadChatList())); - }), - 16.width, + IconButton( + icon: ("dashboard/chat").toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)), + padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, + tooltip: "Notifications", + onPressed: () { + Navigator.of(context).push(CupertinoPageRoute(builder: (_) => UnReadChatList())); + }, + ), ], - ("dashboard/notification").toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)).paddingOnly(top: 0, end: 0).onPress(() { - Navigator.of(context).pushNamed(NotificationsPage.id); - }), + IconButton( + icon: ("dashboard/notification").toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)), + padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, + tooltip: "Notifications", + onPressed: () { + Navigator.of(context).pushNamed(NotificationsPage.id); + }, + ), ], ), ), ), ], - ).paddingOnly(start: 16, end: 16); + ).paddingOnly(start: 16, end: 08); }), ); } diff --git a/lib/dashboard_latest/widgets/request_category_fragment.dart b/lib/dashboard_latest/widgets/request_category_fragment.dart index 24598a4b..c6f80cad 100644 --- a/lib/dashboard_latest/widgets/request_category_fragment.dart +++ b/lib/dashboard_latest/widgets/request_category_fragment.dart @@ -117,8 +117,6 @@ class _RequestCategoryFragmentState extends State with final bool isHouseKeeper = user?.type == UsersTypes.houseKeeper; return Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - - // !isNurse && dashboardProvider.tabs.isNotEmpty && dashboardProvider.tabs[dashboardProvider.currentListIndex].tag == 0 // ? Column( // crossAxisAlignment: CrossAxisAlignment.start, @@ -193,46 +191,50 @@ class _RequestCategoryFragmentState extends State with // ).paddingOnly(start: 14, end: 12) // : - - isHouseKeeper - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - 'All Tasks'.addTranslation.heading4(context), - 'add_icon'.toSvgAsset(width: 24, height: 24,).onPress(() { - Navigator.of(context).pushNamed('/cleaner_search'); - }), - ], - ).paddingOnly(start: 16, end: 16) : - Row( - spacing: 16, - children: [ - Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, - // todo commenting this code, for FM - // if (!isFMSEngineer) - // 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { - // Navigator.of(context).pushNamed('/cleaner_search'); - // }), - - if (dashboardProvider.listIndex.isNotEmpty) - Text( - 'Clear Filters', - style: AppTextStyles.bodyText2.copyWith(color: AppColor.red30), - ).onPress(() { - dashboardProvider.resetRequestDataList(); - dashboardProvider.currentListIndex = null; - Provider.of(context, listen: false) - ..reset() - ..getAllRequests(context); - }), - Transform.flip( - flipY: isAscending, - child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { - _toggleSort(dashboardProvider, user?.type); - }), - ) - ], - ).paddingOnly(start: 16, end: 16), + isHouseKeeper + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + 'All Tasks'.addTranslation.heading4(context), + 'add_icon' + .toSvgAsset( + width: 24, + height: 24, + ) + .onPress(() { + Navigator.of(context).pushNamed('/cleaner_search'); + }), + ], + ).paddingOnly(start: 16, end: 16) + : Row( + spacing: 16, + children: [ + Text(context.translation.allWorkOrder, style: AppTextStyles.heading4.copyWith(color: AppColor.headingTextColor(context))).expanded, + // todo commenting this code, for FM + // if (!isFMSEngineer) + // 'search'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { + // Navigator.of(context).pushNamed('/cleaner_search'); + // }), + + if (dashboardProvider.listIndex.isNotEmpty) + Text( + 'Clear Filters', + style: AppTextStyles.bodyText2.copyWith(color: AppColor.red30), + ).onPress(() { + dashboardProvider.resetRequestDataList(); + dashboardProvider.currentListIndex = null; + Provider.of(context, listen: false) + ..reset() + ..getAllRequests(context); + }), + Transform.flip( + flipY: isAscending, + child: 'dashboard/sort_descending'.toSvgAsset(width: 24, height: 24, color: AppColor.headingTextColor(context)).onPress(() { + _toggleSort(dashboardProvider, user?.type); + }), + ) + ], + ).paddingOnly(start: 16, end: 16), ), ), diff --git a/lib/modules/asset_inventory_module/pages/asset_inventory_detail_view.dart b/lib/modules/asset_inventory_module/pages/asset_inventory_detail_view.dart index 1f0b0481..48688b2f 100644 --- a/lib/modules/asset_inventory_module/pages/asset_inventory_detail_view.dart +++ b/lib/modules/asset_inventory_module/pages/asset_inventory_detail_view.dart @@ -69,7 +69,7 @@ class _AssetInventoryDetailViewState extends State { InfoTextWidget(label: 'Start Date'.addTranslation, value: sessionModel.startDate?.toServiceRequestDetailsFormat ?? '-'), InfoTextWidget(label: 'End Date'.addTranslation, value: sessionModel.endDate?.toServiceRequestDetailsFormat ?? '-'), ], - ).toShadowContainer(context, padding: 16, borderRadius: 20); + ).toShadowContainer(context, borderRadius: 20); } Widget siteListCard(BuildContext context, SessionModel sessionModel) { @@ -84,7 +84,7 @@ class _AssetInventoryDetailViewState extends State { sites: sites, ), ], - ).toShadowContainer(context, padding: 16, borderRadius: 20); + ).toShadowContainer(context, borderRadius: 20); } } diff --git a/lib/modules/cleaner_module/pages/one_time_task_preview_screen.dart b/lib/modules/cleaner_module/pages/one_time_task_preview_screen.dart index 6448aeeb..19ef67fb 100644 --- a/lib/modules/cleaner_module/pages/one_time_task_preview_screen.dart +++ b/lib/modules/cleaner_module/pages/one_time_task_preview_screen.dart @@ -262,10 +262,8 @@ class OneTimeTaskPreviewScreen extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InfoHeader16Widget( - 'Captured Images', - ), - 16.height, + InfoHeader16Widget('Captured Images'), + 12.height, Wrap( spacing: 8, runSpacing: 8, diff --git a/lib/modules/cleaner_module/pages/one_time_task_view.dart b/lib/modules/cleaner_module/pages/one_time_task_view.dart index 5a94f7e6..25ac466d 100644 --- a/lib/modules/cleaner_module/pages/one_time_task_view.dart +++ b/lib/modules/cleaner_module/pages/one_time_task_view.dart @@ -159,7 +159,7 @@ class _OneTimeTaskViewState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ _buildTaskInfoCard(context), - 16.height, + 12.height, CleanerChecklistWidget( isClosed: isClosed, checklistItems: _convertInstructionsToChecklist(), @@ -276,9 +276,9 @@ class _OneTimeTaskViewState extends State { ), ], ], - ).paddingOnly(start: 16, end: 16, top: 16, bottom: 16), + ), ], - ).toShadowContainer(context, padding: 0); + ).toShadowContainer(context); } List _convertInstructionsToChecklist() { diff --git a/lib/modules/cleaner_module/widgets/cleaner_checklist_widget.dart b/lib/modules/cleaner_module/widgets/cleaner_checklist_widget.dart index 1525ad64..f6b0a1a0 100644 --- a/lib/modules/cleaner_module/widgets/cleaner_checklist_widget.dart +++ b/lib/modules/cleaner_module/widgets/cleaner_checklist_widget.dart @@ -37,18 +37,17 @@ class _CleanerChecklistWidgetState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, + spacing: 12, children: [ InfoHeader16Widget('Checklist'), - 16.height, ListView.separated( shrinkWrap: true, padding: EdgeInsets.zero, physics: const NeverScrollableScrollPhysics(), itemBuilder: (cxt, index) => _buildChecklistItem(context, widget.checklistItems[index]), - separatorBuilder: (cxt, index) => const Divider(height: 1, color: AppColor.neutral30, thickness: 1).paddingOnly(top: 16, bottom: 16), + separatorBuilder: (cxt, index) => const Divider().defaultStyle(context), itemCount: widget.checklistItems.length) - .toShadowContainer(context, padding: 16), - 16.height, + .toShadowContainer(context), _buildImageCaptureWidget(context), ], ); @@ -70,7 +69,7 @@ class _CleanerChecklistWidgetState extends State { child: Checkbox( value: item.isChecked, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - side: BorderSide(color: Colors.black.withValues(alpha: .05)), + side: BorderSide(color: AppColor.loadingColor(context), width: 1.0), visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), activeColor: AppColor.primary10, onChanged: (bool? value) {}, @@ -181,12 +180,7 @@ class _CleanerChecklistWidgetState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InfoHeader16Widget('Captured Image'), - ], - ), + InfoHeader16Widget('Captured Image'), 8.height, _buildImageWidget(context), ], diff --git a/lib/modules/cm_module/views/components/activities_list_view.dart b/lib/modules/cm_module/views/components/activities_list_view.dart index d3880a44..a543651f 100644 --- a/lib/modules/cm_module/views/components/activities_list_view.dart +++ b/lib/modules/cm_module/views/components/activities_list_view.dart @@ -175,7 +175,7 @@ class _ActivitiesListViewState extends State { FilesList(images: activity.activitySparePart!.acitiySparePartAttachments!.map((toElement) => URLs.getFileUrl(toElement.name!)!).toList()), ], ], - ).toShadowContainer(context, padding: 12, showShadow: false).onPress(() { + ).toShadowContainer(context, showShadow: false).onPress(() { if (showActionButtons) return; if (requestDetailProvider.isReadOnlyRequest) { editSparePartRequest(context: context, requestDetailProvider: requestDetailProvider, activity: activity); @@ -272,7 +272,7 @@ class _ActivitiesListViewState extends State { // // ), // ] ], - ).toShadowContainer(context, padding: 12, showShadow: false).onPress(() { + ).toShadowContainer(context, showShadow: false).onPress(() { if (showActionButtons) return; if (requestDetailProvider.isReadOnlyRequest) { editMaintenanceRequest(context: context, requestDetailProvider: requestDetailProvider, activity: activity); diff --git a/lib/modules/cm_module/views/components/history_log_view.dart b/lib/modules/cm_module/views/components/history_log_view.dart index 7b7b1b5f..b3fef162 100644 --- a/lib/modules/cm_module/views/components/history_log_view.dart +++ b/lib/modules/cm_module/views/components/history_log_view.dart @@ -129,7 +129,7 @@ class HistoryLogView extends StatelessWidget { ), ), ], - ).toShadowContainer(context, padding: 16).paddingOnly(bottom: 16); + ).toShadowContainer(context).paddingOnly(bottom: 16); } Widget statusCard(BuildContext context, String status) { diff --git a/lib/modules/cm_module/views/components/initial_visit_card.dart b/lib/modules/cm_module/views/components/initial_visit_card.dart index 424351a5..ecd93663 100644 --- a/lib/modules/cm_module/views/components/initial_visit_card.dart +++ b/lib/modules/cm_module/views/components/initial_visit_card.dart @@ -55,7 +55,7 @@ class _InitialVisitCardState extends State { requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120), ] ], - ).toShadowContainer(context, padding: 16); + ).toShadowContainer(context); }); } } diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 4d8cc3d0..73a7f9ea 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -205,11 +205,11 @@ class _ServiceRequestDetailViewState extends State { ], ), if (context.userProvider.isEngineer && !(workOrder.asset!.hasTrainingImageData ?? true)) ...[ - InfoTextLabelWidget(label: '*Images are required for the asset', color: AppColor.red30), + InfoTextLabelWidget(label: '*Images are required for the asset', color: AppColor.red30, textStyle: AppTextStyles.tinyFont2), 4.height, ], InfoTextWidget(label: context.translation.assetName, value: workOrder.assetNdModel!.name?.cleanupWhitespace.capitalizeFirstOfEach), - InfoTextWidget(label: context.translation.assetNumber, value: workOrder.asset!.assetNumber), + InfoTextWidget(label: context.translation.assetNumber, value: workOrder.asset!.assetNumber, copyValue: true), InfoTextWidget(label: context.translation.serialNo, value: workOrder.asset!.assetSerialNo), InfoTextWidget(label: context.translation.manufacture, value: workOrder.manufacturer?.name?.cleanupWhitespace.capitalizeFirstOfEach), InfoTextWidget(label: context.translation.model, value: workOrder.model?.name!.cleanupWhitespace.capitalizeFirstOfEach), @@ -227,7 +227,7 @@ class _ServiceRequestDetailViewState extends State { //... request details starts here.... InfoHeader16Widget(context.translation.callDetails), - InfoTextWidget(label: context.translation.cmNumber, value: workOrder.workOrderNo), + InfoTextWidget(label: context.translation.cmNumber, value: workOrder.workOrderNo, copyValue: true), InfoTextWidget(label: context.translation.createdBy, value: workOrder.workOrderCreatedBy?.userName ?? "-"), InfoTextWidget(label: context.translation.arrivedDate, value: workOrder.iHaveArrivedDate != null ? workOrder.iHaveArrivedDate.toString().toServiceRequestDetailsFormat : '-'), InfoTextWidget(label: context.translation.closedDate, value: workOrder.closedDate != null ? workOrder.closedDate!.toString().toServiceRequestDetailsFormat : '-'), @@ -297,9 +297,7 @@ class _ServiceRequestDetailViewState extends State { assetRetiredButton(context: context), ] ], - ).toShadowContainer( - context, - ); + ).toShadowContainer(context); } Widget contactInfoCard(BuildContext context, WorkOrderData workOrder) { @@ -355,7 +353,7 @@ class _ServiceRequestDetailViewState extends State { InfoTextWidget(label: 'MR No'.addTranslation, value: provider.currentWorkOrder?.data?.mrNo?.toString() ?? '-'), InfoTextWidget(label: 'Exchange Cost'.addTranslation, value: provider.currentWorkOrder?.data?.exchangeCost?.toString() ?? '-'), ], - ).toShadowContainer(context, padding: 16); + ).toShadowContainer(context); } Widget assetRetiredButton({required BuildContext context}) { diff --git a/lib/modules/incident_module/create_incident_request_page.dart b/lib/modules/incident_module/create_incident_request_page.dart index 3e8e0aad..d1535400 100644 --- a/lib/modules/incident_module/create_incident_request_page.dart +++ b/lib/modules/incident_module/create_incident_request_page.dart @@ -133,7 +133,7 @@ class _CreateIncidentRequestPageState extends State { onPick: (asset) async { device = asset; payload["assetId"] = asset?.id; - payload["oracleCode"] = asset.modelDefinition?.oracleCodes?.first.codeValue; + payload["oracleCode"] = (asset.modelDefinition?.oracleCodes?.isNotEmpty ?? false) ? asset.modelDefinition?.oracleCodes?.first.codeValue : null; payload["model"] = asset.modelDefinition?.modelName; payload["manufacturer"] = asset.modelDefinition?.manufacturerName; payload["assetOrigin"] = asset.modelDefinition?.assetName; diff --git a/lib/modules/incident_module/incident_detail_page.dart b/lib/modules/incident_module/incident_detail_page.dart index 854c098f..bba8588a 100644 --- a/lib/modules/incident_module/incident_detail_page.dart +++ b/lib/modules/incident_module/incident_detail_page.dart @@ -41,41 +41,39 @@ class IncidentDetailPage extends StatelessWidget { List allAttachments = snapshot.data!.incidentAttachments!; - return ListView( + return SingleChildScrollView( padding: const EdgeInsets.all(16), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - StatusLabel( - label: snapshot.data!.incidentStatusName!, - textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.incidentStatusName!), - backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.incidentStatusName!), - ), - 1.width.expanded, - InfoDateWidget(snapshot.data!.createdDate?.toString() ?? ""), - ], - ), - // 12.height, - ...requesterDetails(context, snapshot.data!), - const Divider().defaultStyle(context), - ...requestDetails(context, snapshot.data!), - if (snapshot.data!.ovrTicketNumber?.isNotEmpty ?? false) ovrInformation(context, snapshot.data!.ovrTicketNumber!), - const Divider().defaultStyle(context), - ...assetDetails(context, snapshot.data!), - const Divider().defaultStyle(context), - ...personInvolvedDetails(context, snapshot.data!), - if (allAttachments.isNotEmpty) ...[ - const Divider().defaultStyle(context), - InfoHeader16Widget("Attachments".addTranslation), - FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + StatusLabel( + label: snapshot.data!.incidentStatusName!, + textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.incidentStatusName!), + backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.incidentStatusName!), + ), + 1.width.expanded, + InfoDateWidget(snapshot.data!.createdDate?.toString() ?? ""), ], + ), + // 12.height, + ...requesterDetails(context, snapshot.data!), + const Divider().defaultStyle(context), + ...requestDetails(context, snapshot.data!), + if (snapshot.data!.ovrTicketNumber?.isNotEmpty ?? false) ovrInformation(context, snapshot.data!.ovrTicketNumber!), + const Divider().defaultStyle(context), + ...assetDetails(context, snapshot.data!), + const Divider().defaultStyle(context), + ...personInvolvedDetails(context, snapshot.data!), + if (allAttachments.isNotEmpty) ...[ + const Divider().defaultStyle(context), + InfoHeader16Widget("Attachments".addTranslation), + FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), ], - ).toShadowContainer(context, padding: 16), - ], + ], + ).toShadowContainer(context), ); })); } @@ -98,7 +96,7 @@ class IncidentDetailPage extends StatelessWidget { text: TextSpan(text: "Work Order: ", style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)), children: [ TextSpan( text: "${incidentData.workOrderNo}", - style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context), decoration: TextDecoration.underline), + style: AppTextStyles.bodyText.copyWith(color: AppColor.primary10, decoration: TextDecoration.underline), recognizer: TapGestureRecognizer() ..onTap = () async { await Navigator.of(context).push(MaterialPageRoute(builder: (_) => CMDetailPage(requestId: incidentData.workOrderId!, moduleId: 3))); diff --git a/lib/modules/loan_module/pages/loan_equipment_detail_page.dart b/lib/modules/loan_module/pages/loan_equipment_detail_page.dart index 6bc36ca2..0c5a54e1 100644 --- a/lib/modules/loan_module/pages/loan_equipment_detail_page.dart +++ b/lib/modules/loan_module/pages/loan_equipment_detail_page.dart @@ -98,7 +98,7 @@ class _LoanEquipmentDetailPageState extends State { FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), ], ], - ).toShadowContainer(context, padding: 12) + ).toShadowContainer(context) ], ).expanded, // @todo ask backend to add loanTypeValue, so we can show or hide the buttons diff --git a/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart b/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart index 61b4e037..7e076c8f 100644 --- a/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart +++ b/lib/modules/medical_gas_inspection/medical_gas_inspection_detail_page.dart @@ -106,7 +106,7 @@ class _MedicalGasInspectionDetailPageState extends State URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []), ], ], - ).toShadowContainer(context, padding: 16), + ).toShadowContainer(context,), ], ).expanded, if (model?.requestStatus?.value != null && model!.requestStatus!.value! < 3) diff --git a/lib/new_views/pages/land_page/mark_attendance_widget.dart b/lib/new_views/pages/land_page/mark_attendance_widget.dart deleted file mode 100644 index 1ab12c67..00000000 --- a/lib/new_views/pages/land_page/mark_attendance_widget.dart +++ /dev/null @@ -1,866 +0,0 @@ -// import 'dart:async'; -// import 'dart:developer'; -// import 'dart:io'; -// -// import 'package:flutter/material.dart'; -// import 'package:flutter_svg/flutter_svg.dart'; -// import 'package:geolocator/geolocator.dart'; -// import 'package:huawei_location/huawei_location.dart'; -// import 'package:nfc_manager/nfc_manager.dart'; -// import 'package:permission_handler/permission_handler.dart'; -// import 'package:provider/provider.dart'; -// import 'package:test_sa/dashboard_latest/dashboard_provider.dart'; -// // import 'package:platform_device_id/platform_device_id.dart'; -// import 'package:test_sa/dashboard_latest/widgets/app_bar_widget.dart'; -// import 'package:test_sa/extensions/enum_extensions.dart'; -// import 'package:test_sa/extensions/text_extensions.dart'; -// import 'package:test_sa/extensions/widget_extensions.dart'; -// import 'package:test_sa/helper/utils.dart'; -// import 'package:test_sa/models/enums/swipe_type.dart'; -// import 'package:test_sa/models/lookup.dart'; -// import 'package:test_sa/models/new_models/swipe_model.dart'; -// import 'package:test_sa/nfc/nfc_reader_sheet.dart'; -// import 'package:test_sa/utilities/Location.dart' as location; -// import 'package:test_sa/views/widgets/dialogs/confirm_dialog.dart'; -// import 'package:test_sa/views/widgets/dialogs/success_dialog.dart'; -// import 'package:test_sa/views/widgets/qr_scanner_dialog.dart'; -// import 'package:wifi_iot/wifi_iot.dart'; -// -// import '../../app_style/app_color.dart'; -// -// class MarkAttendanceWidget extends StatefulWidget { -// // DashboardProviderModel model; -// double topPadding; -// bool isFromDashboard; -// -// MarkAttendanceWidget( {Key? key, this.topPadding = 0, this.isFromDashboard = false}) : super(key: key); -// // todo MarkAttendanceWidget(this.model, {Key? key, this.topPadding = 0, this.isFromDashboard = false}) : super(key: key); -// -// @override -// _MarkAttendanceWidgetState createState() { -// return _MarkAttendanceWidgetState(); -// } -// } -// -// class _MarkAttendanceWidgetState extends State { -// bool isNfcEnabled = false, isNfcLocationEnabled = false, isQrEnabled = false, isQrLocationEnabled = false, isWifiEnabled = false, isWifiLocationEnabled = false; -// -// int _locationUpdateCbId = 0; -// -// @override -// void initState() { -// super.initState(); -// checkAttendanceAvailability(); -// } -// -// void checkAttendanceAvailability() async { -// bool isAvailable = await NfcManager.instance.isAvailable(); -// // setState(() { -// // AppState().privilegeListModel!.forEach((PrivilegeListModel element) { -// // if (element.serviceName == "enableNFC") { -// // if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true; -// // } else if (element.serviceName == "enableQR") { -// // if (element.previlege ?? false) isQrEnabled = true; -// // } else if (element.serviceName == "enableWIFI") { -// // if (element.previlege ?? false) isWifiEnabled = true; -// // } else if (element.serviceName!.trim() == "enableLocationNFC") { -// // if (element.previlege ?? false) isNfcLocationEnabled = true; -// // } else if (element.serviceName == "enableLocationQR") { -// // if (element.previlege ?? false) isQrLocationEnabled = true; -// // } else if (element.serviceName == "enableLocationWIFI") { -// // if (element.previlege ?? false) isWifiLocationEnabled = true; -// // } -// // }); -// // }); -// } -// -// void checkHuaweiLocationPermission(String attendanceType) async { -// // Permission_Handler permissionHandler = PermissionHandler(); -// location.Location.isEnabled((bool isEnabled) async { -// if (isEnabled) { -// location.Location.havePermission((bool permission) async { -// if (permission) { -// getHuaweiCurrentLocation(attendanceType); -// } else { -// bool has = await requestPermissions(); -// if (has) { -// getHuaweiCurrentLocation(attendanceType); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () { -// Navigator.pop(context); -// }, -// ), -// ); -// } -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// -// // if (await permissionHandler.hasLocationPermission()) { -// // getHuaweiCurrentLocation(attendanceType); -// // } else { -// // bool has = await requestPermissions(); -// // if (has) { -// // getHuaweiCurrentLocation(attendanceType); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to give location permission to mark attendance", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } -// // } -// } -// -// Future requestPermissions() async { -// var result = await [ -// Permission.location, -// ].request(); -// return (result[Permission.location] == PermissionStatus.granted || result[Permission.locationAlways] == PermissionStatus.granted); -// } -// -// @override -// void dispose() { -// super.dispose(); -// // Stop Session -// NfcManager.instance.stopSession(); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), -// decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), -// width: double.infinity, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, -// children: [ -// // LocaleKeys.markAttendance.tr().toSectionHeading(), -// // LocaleKeys.selectMethodOfAttendance.tr().toText11(color: const Color(0xff535353)), -// GridView( -// physics: const NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// padding: const EdgeInsets.only(bottom: 0, top: 21), -// gridDelegate: -// SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 550) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), -// children: [ -// attendanceMethod(SwipeTypeEnum.NFC.name, Icons.nfc, true, () { -// log('i am here...nfc'); -// handleSwipe(swipeType: SwipeTypeEnum.NFC, isEnable: true); -// return; -// // if (AppState().getIsHuawei) { -// if (false) { -// checkHuaweiLocationPermission("NFC"); -// } else { -// location.Location.isEnabled((bool isEnabled) { -// if (isEnabled) { -// location.Location.havePermission((bool permission) { -// if (permission) { -// Utils.showLoading(context); -// location.Location.getCurrentLocation( -// (Position position, bool isMocked) { -// if (isMocked) { -// Utils.hideLoading(context); -// markFakeAttendance("NFC", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); -// } else { -// Utils.hideLoading(context); -// //todo performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// } -// }, -// () { -// Utils.hideLoading(context); -// Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// }, -// context, -// ); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openAppSettings(); -// }, -// ), -// ); -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// } -// }), -// //if (isWifiEnabled) //todo -// attendanceMethod("Wifi", Icons.wifi, isWifiEnabled, () { -// // if (AppState().getIsHuawei) { -// if (false) { -// checkHuaweiLocationPermission("WIFI"); -// } else { -// location.Location.isEnabled((bool isEnabled) { -// if (isEnabled) { -// location.Location.havePermission((bool permission) { -// if (permission) { -// Utils.showLoading(context); -// location.Location.getCurrentLocation( -// (Position position, bool isMocked) { -// if (isMocked) { -// Utils.hideLoading(context); -// markFakeAttendance("WIFI", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); -// } else { -// Utils.hideLoading(context); -// //todo performWifiAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// } -// }, -// () { -// Utils.hideLoading(context); -// Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// }, -// context, -// ); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openAppSettings(); -// }, -// ), -// ); -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// } -// }), -// // if (isQrEnabled) //todo -// attendanceMethod(SwipeTypeEnum.QR.name, Icons.qr_code_2, true, () async { -// handleSwipe(swipeType: SwipeTypeEnum.QR, isEnable: true); -// return; -// // if (AppState().getIsHuawei) { -// if (false) { -// checkHuaweiLocationPermission("QR"); -// } else { -// location.Location.isEnabled((bool isEnabled) { -// if (isEnabled) { -// location.Location.havePermission((bool permission) { -// if (permission) { -// Utils.showLoading(context); -// location.Location.getCurrentLocation( -// (Position position, bool isMocked) { -// if (isMocked) { -// Utils.hideLoading(context); -// markFakeAttendance("QR", position.latitude.toString() ?? "", position.longitude.toString() ?? ""); -// } else { -// Utils.hideLoading(context); -// //todo performQrCodeAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// } -// }, -// () { -// Utils.hideLoading(context); -// Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// }, -// context, -// ); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openAppSettings(); -// }, -// ), -// ); -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// } -// }), -// ], -// ) -// ], -// ), -// ); -// } -// -// void handleSwipe({required SwipeTypeEnum swipeType,required bool isEnable,}){ -// log('handle swipe value is ${swipeType.name}'); -// // if (AppState().getIsHuawei) { -// if (false) { -// checkHuaweiLocationPermission("NFC"); -// } else { -// location.Location.isEnabled((bool isEnabled) { -// if (isEnabled) { -// location.Location.havePermission((bool permission) { -// if (permission) { -// Utils.showLoading(context); -// location.Location.getCurrentLocation( -// (Position position, bool isMocked) { -// if (isMocked) { -// Utils.hideLoading(context); -// markFakeAttendance(swipeType.name, position.latitude.toString() ?? "", position.longitude.toString() ?? ""); -// } else { -// Utils.hideLoading(context); -// //todo performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// handleSwipeOperation(swipeType: swipeType,lat: position.latitude,lang: position.longitude); -// } -// }, -// () { -// Utils.hideLoading(context); -// Utils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// }, -// context, -// ); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openAppSettings(); -// }, -// ), -// ); -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// } -// } -// -// void handleSwipeOperation({required SwipeTypeEnum swipeType,double ?lat, double ?lang}){ -// switch(swipeType){ -// case SwipeTypeEnum.NFC: -// handleNfcAttendance(latitude: lat,longitude: lang); -// return; -// case SwipeTypeEnum.QR: -// performQrCodeAttendance(latitude: lat,longitude: lang); -// return; -// case SwipeTypeEnum.Wifi: -// return; -// -// } -// } -// -// void getHuaweiCurrentLocation(String attendanceType) async { -// try { -// Utils.showLoading(context); -// FusedLocationProviderClient locationService = FusedLocationProviderClient()..initFusedLocationService(); -// LocationRequest locationRequest = LocationRequest(); -// locationRequest.priority = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY; -// locationRequest.interval = 500; -// List locationRequestList = [locationRequest]; -// LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList); -// -// late StreamSubscription _streamSubscription; -// int requestCode = (await (locationService.requestLocationUpdates(locationRequest)))!; -// -// _streamSubscription = locationService.onLocationData!.listen( -// (Location location) async { -// Utils.hideLoading(context); -// await locationService.removeLocationUpdates(requestCode); -// if (attendanceType == "QR") { -// // todo performQrCodeAttendance(widget.model, lat: location.latitude.toString() ?? "", lng: location.longitude.toString() ?? ""); -// } -// if (attendanceType == "WIFI") { -// // todo performWifiAttendance(widget.model, lat: location.latitude.toString() ?? "", lng: location.longitude.toString() ?? ""); -// } -// if (attendanceType == "NFC") { -// //todo performNfcAttendance(widget.model, lat: location.latitude.toString() ?? "", lng: location.longitude.toString() ?? ""); -// } -// requestCode = 0; -// }, -// ); -// -// // locationService.checkLocationSettings(locationSettingsRequest).then((settings) async { -// // await locationService.getLastLocation().then((value) { -// // if (value.latitude == null || value.longitude == null) { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "Unable to get your location, Please check your location settings & try again.", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } else { -// // if (attendanceType == "QR") { -// // performQrCodeAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // if (attendanceType == "WIFI") { -// // performWifiAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // if (attendanceType == "NFC") { -// // performNfcAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // } -// // }).catchError((error) { -// // log("HUAWEI LOCATION getLastLocation ERROR!!!!!"); -// // log(error); -// // }); -// // }).catchError((error) { -// // log("HUAWEI LOCATION checkLocationSettings ERROR!!!!!"); -// // log(error); -// // if (error.code == "LOCATION_SETTINGS_NOT_AVAILABLE") { -// // // Location service not enabled. -// // } -// // }); -// } catch (error) { -// log("HUAWEI LOCATION ERROR!!!!!"); -// log('$error'); -// Utils.hideLoading(context); -// // Utils.handleException(error, context, null); -// } -// } -// -// Future handleNfcAttendance({double? latitude = 0, double? longitude = 0}) async { -// final dashBoardProvider = Provider.of(context, listen: false); -// -// if (Platform.isIOS) { -// Utils.readNFc(onRead: (String nfcId) async { -// await _processNfcAttendance(dashBoardProvider, nfcId, latitude, longitude); -// }); -// } else { -// showNfcReader(context, onNcfScan: (String? nfcId) async { -// await _processNfcAttendance(dashBoardProvider, nfcId ?? '', latitude, longitude); -// }); -// } -// } -// -// -// Future _processNfcAttendance( -// DashBoardProvider dashBoardProvider, -// String nfcId, -// double? latitude, -// double? longitude, -// ) async { -// Utils.showLoading(context); -// try { -// final swipeModel = Swipe( -// swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), -// value: nfcId, -// latitude: latitude, -// longitude: longitude, -// ); -// -// final swipeResponse = await dashBoardProvider.makeSwipe(model: swipeModel); -// log('swipe response i got is ${swipeResponse.toJson()}'); -// -// if (swipeResponse.responseCode != 1) { -// Utils.hideLoading(context); -// _showErrorDialog(swipeResponse.message ?? "Unexpected error occurred"); -// } else { -// final isSuccess = swipeResponse.data; -// log('nfc swipe response is ${isSuccess}'); -// if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// Utils.hideLoading(context); -// _showSuccessDialog(); -// } -// } catch (error) { -// Utils.hideLoading(context); -// // Uncomment below line for error handling if needed -// // Utils.handleException(error, context, null); -// } -// } -// -// -// void _showErrorDialog(String message) { -// showDialog( -// context: context, -// builder: (context) => ConfirmDialog( -// message: message, -// onTap: () => Navigator.pop(context), -// ), -// ); -// } -// -// void _showSuccessDialog() { -// showMDialog( -// context, -// backgroundColor: Colors.transparent, -// isDismissable: true, -// child: SuccessDialog(widget.isFromDashboard), -// ); -// } -// -// -// //older code.... -// Future performNfcAttendance({double? lat = 0, double ?lng = 0}) async { -// DashBoardProvider dashBoardProvider = Provider.of(context,listen:false); -// if (Platform.isIOS) { -// Utils.readNFc(onRead: (String nfcId) async { -// Utils.showLoading(context); -// try { -// SwipeModel? swipeResponse = await dashBoardProvider.makeSwipe(model: Swipe(swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), value: '', latitude: lat, longitude: lng)); -// if (swipeResponse.responseCode != 1) { -// Utils.hideLoading(context); -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: swipeResponse.message ?? "Unexpected error occurred", -// onTap: () { -// Navigator.pop(context); -// }, -// ), -// ); -// } else { -// bool status = swipeResponse.data; -// if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// Utils.hideLoading(context); -// showMDialog( -// context, -// backgroundColor: Colors.transparent, -// isDismissable: true, -// child: SuccessDialog(widget.isFromDashboard), -// ); -// } -// } catch (ex) { -// Utils.hideLoading(context); -// // Utils.handleException(ex, context, null); -// } -// }); -// } else { -// showNfcReader(context, onNcfScan: (String? nfcId) async { -// Utils.showLoading(context); -// try { -// SwipeModel? swipeResponse = await dashBoardProvider.makeSwipe(model: Swipe(swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), value: nfcId??'', latitude: lat, longitude: lng)); -// log('api response i got is ${swipeResponse.toJson()}'); -// if (swipeResponse.responseCode != 1) { -// Utils.hideLoading(context); -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: swipeResponse.message ?? "Unexpected error occurred", -// onTap: () { -// Navigator.pop(context); -// }, -// ), -// ); -// } else { -// bool status = swipeResponse.data; //use this status to get transactions. -// if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// Utils.hideLoading(context); -// showMDialog( -// context, -// backgroundColor: Colors.transparent, -// isDismissable: true, -// child: SuccessDialog(widget.isFromDashboard), -// ); -// } -// } catch (ex) { -// Utils.hideLoading(context); -// // Utils.handleException(ex, context, null); -// } -// // Utils.showLoading(context); -// // try { -// // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); -// // if (g?.messageStatus != 1) { -// // Utils.hideLoading(context); -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: g?.errorEndUserMessage ?? "Unexpected error occurred", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } else { -// // bool status = await model.fetchAttendanceTracking(context); -// // Utils.hideLoading(context); -// // showMDialog( -// // context, -// // backgroundColor: Colors.transparent, -// // isDismissable: false, -// // child: SuccessDialog(widget.isFromDashboard), -// // ); -// // } -// // } catch (ex) { -// // log(ex); -// // Utils.hideLoading(context); -// // // Utils.handleException(ex, context, (String msg) { -// // // Utils.confirmDialog(context, msg); -// // // }); -// // } -// }); -// } -// } -// -// -// -// void showMDialog(context, {Widget? child, Color? backgroundColor, bool isDismissable = true, bool isBusniessCard = false}) async { -// return showDialog( -// context: context, -// barrierDismissible: isDismissable, -// builder: (context) { -// return Dialog( -// shape: isBusniessCard -// ? const RoundedRectangleBorder( -// borderRadius: BorderRadius.all( -// Radius.circular(15.0), -// ), -// ) -// : null, -// backgroundColor: backgroundColor, -// child: child, -// ); -// }, -// ); -// } -// // -// // Future checkSession() async { -// // try { -// // Utils.showLoading(context); -// // await DashboardApiClient().getOpenMissingSwipes(); -// // Utils.hideLoading(context); -// // return true; -// // } catch (ex) { -// // Utils.hideLoading(context); -// // Utils.handleException(ex, context, null); -// // return false; -// // } -// // } -// -// -// //TODO need to confirm .... -// // Future performWifiAttendance({double? latitude, double? lng}) async { -// // // if (Platform.isAndroid) { -// // // if (!(await checkSession())) { -// // // return; -// // // } -// // // } -// // Utils.showLoading(context); -// // bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", -// // password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); -// // -// // if (Platform.isIOS) { -// // if (await WiFiForIoTPlugin.getSSID() == AppState().getMohemmWifiSSID) { -// // isConnected = true; -// // } else { -// // isConnected = false; -// // } -// // } -// // -// // if (isConnected && AppState().isAuthenticated) { -// // await WiFiForIoTPlugin.forceWifiUsage(true); -// // await Future.delayed(const Duration(seconds: 6)); -// // try { -// // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); -// // bool status = await model.fetchAttendanceTracking(context); -// // Utils.hideLoading(context); -// // await closeWifiRequest(); -// // if (g?.messageStatus == 2) { -// // showDialog( -// // barrierDismissible: true, -// // context: context, -// // builder: (cxt) => ConfirmDialog( -// // message: g?.errorEndUserMessage ?? "", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // onCloseTap: () {}, -// // ), -// // ); -// // } else { -// // showMDialog( -// // context, -// // backgroundColor: Colors.transparent, -// // isDismissable: false, -// // child: SuccessDialog(widget.isFromDashboard), -// // ); -// // } -// // } catch (ex) { -// // await closeWifiRequest(); -// // Utils.hideLoading(context); -// // Utils.handleException(ex, context, null); -// // } -// // } else { -// // if (AppState().isAuthenticated) { -// // Utils.hideLoading(context); -// // Utils.confirmDialog(context, "LocaleKeys.comeNearHMGWifi.tr()"); -// // } else { -// // await closeWifiRequest(); -// // } -// // } -// // } -// -// Future closeWifiRequest() async { -// if (Platform.isAndroid) { -// await WiFiForIoTPlugin.forceWifiUsage(false); -// } -// return await WiFiForIoTPlugin.disconnect(); -// } -// -// Future performQrCodeAttendance( {double ? latitude , double ?longitude}) async { -// DashBoardProvider dashBoardProvider = Provider.of(context,listen: false); -// var qrCodeValue = await Navigator.of(context).push( -// MaterialPageRoute( -// builder: (BuildContext context) => QrScannerDialog(), -// ), -// ); -// if (qrCodeValue != null) { -// Utils.showLoading(context); -// try { -// final swipeModel = Swipe( -// swipeTypeValue: SwipeTypeEnum.QR.getIntFromSwipeTypeEnum(), -// value: qrCodeValue, -// latitude: latitude, -// longitude: longitude, -// ); -// log('model i got to scan qr is ${swipeModel.toJson()}'); -// final swipeResponse = await dashBoardProvider.makeSwipe(model: swipeModel); -// log('response of swipe is ${swipeResponse.toJson()}'); -// -// bool status = await swipeResponse.data; -// Utils.hideLoading(context); -// if (swipeResponse.responseCode == 2) { -// showDialog( -// barrierDismissible: true, -// context: context, -// builder: (cxt) => ConfirmDialog( -// message: swipeResponse.message ?? "", -// onTap: () { -// Navigator.pop(context); -// }, -// onCloseTap: () {}, -// ), -// ); -// } else { -// showMDialog( -// context, -// backgroundColor: Colors.transparent, -// isDismissable: true, -// child: SuccessDialog(widget.isFromDashboard), -// ); -// } -// } catch (ex) { -// log('$ex'); -// Utils.hideLoading(context); -// //this need to confirm where it comes.. -// // Utils.handleException(ex, context, null); -// } -// } -// } -// -// void markFakeAttendance(dynamic sourceName, String lat, String long) async { -// Utils.showLoading(context); -// try { -// // await DashboardApiClient().markFakeLocation(sourceName: sourceName, lat: lat, long: long); -// Utils.hideLoading(context); -// Utils.confirmDialog(context, "LocaleKeys.fakeLocation.tr()"); -// } catch (ex) { -// log('$ex'); -// Utils.hideLoading(context); -// //Utils.handleException(ex, context, null); -// } -// } -// -// Widget attendanceMethod(String title, IconData iconData, bool isEnabled, VoidCallback onPress) => Container( -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(15), -// color: isEnabled ? null : Colors.grey.withOpacity(.5), -// gradient: isEnabled -// ? const LinearGradient( -// transform: GradientRotation(.64), -// begin: Alignment.topRight, -// end: Alignment.bottomLeft, -// colors: [ -// //ToDo set Colors according to design provided by designer... -// Colors.blue, -// Colors.green, -// // AppColor.gradiantEndColor, -// // MyColors.gradiantStartColor, -// ], -// ) -// : null, -// ), -// clipBehavior: Clip.antiAlias, -// padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// // SvgPicture.asset(image, color: Colors.white, alignment: Alignment.topLeft).expanded, -// Icon(iconData, color: isEnabled ? AppColor.black35 : Colors.grey), -// title.heading6(context), -// // title.toText17(isBold: true, color: Colors.white), -// ], -// ), -// ).onPress( -// () { -// log('isEnabled is ${!isEnabled}'); -// if (!isEnabled) return; -// onPress(); -// }, -// ); -// } diff --git a/lib/new_views/pages/land_page/my_request/my_requests_page.dart b/lib/new_views/pages/land_page/my_request/my_requests_page.dart index d1540eba..ee227136 100644 --- a/lib/new_views/pages/land_page/my_request/my_requests_page.dart +++ b/lib/new_views/pages/land_page/my_request/my_requests_page.dart @@ -200,10 +200,11 @@ class _MyRequestsPageState extends State with SingleTickerProvid setState(() {}); } }).expanded, - 16.width, + 12.width, IconButton( icon: "download".toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)), padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, tooltip: "Export", onPressed: () async { final provider = Provider.of(context, listen: false); @@ -223,6 +224,7 @@ class _MyRequestsPageState extends State with SingleTickerProvid IconButton( icon: "filter".toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)), padding: EdgeInsets.zero, + visualDensity: VisualDensity.compact, tooltip: "Filter", onPressed: () async { final result = await Navigator.push(context, CupertinoPageRoute(builder: (context) => AllRequestsFilterPage(data: _search))); @@ -233,7 +235,7 @@ class _MyRequestsPageState extends State with SingleTickerProvid }, ), ], - ).paddingOnly(start: 16, end: 16), + ).paddingOnly(start: 16, end: 8), ), body: Consumer(builder: (context, snapshot, _) { return Column( diff --git a/lib/new_views/pages/land_page/non_hmg_employee_swipe_view.dart b/lib/new_views/pages/land_page/non_hmg_employee_swipe_view.dart index a26c7965..1e0cc7f0 100644 --- a/lib/new_views/pages/land_page/non_hmg_employee_swipe_view.dart +++ b/lib/new_views/pages/land_page/non_hmg_employee_swipe_view.dart @@ -4,6 +4,7 @@ import 'package:test_sa/extensions/context_extension.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; +import 'package:test_sa/views/widgets/item_views/info_header_widget.dart'; class NonHmgEmployeeSwipeView extends StatefulWidget { NonHmgEmployeeSwipeView({Key? key}) : super(key: key); @@ -47,6 +48,7 @@ class _NonHmgEmployeeSwipeViewState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + InfoHeader16Widget( "Mark Attendance"), Text( "Mark Attendance", style: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), diff --git a/lib/new_views/pages/login_page.dart b/lib/new_views/pages/login_page.dart index 1c6a83bd..4f8f7d7b 100644 --- a/lib/new_views/pages/login_page.dart +++ b/lib/new_views/pages/login_page.dart @@ -180,7 +180,7 @@ class _LoginPageState extends State { children: [ Checkbox( value: rememberMe, - activeColor: AppColor.blueStatus(context), + activeColor: AppColor.primary10, side: BorderSide(color: AppColor.loadingColor(context), width: 1.0), visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, @@ -190,7 +190,7 @@ class _LoginPageState extends State { }); }), 8.width, - "Remember Me".bodyText(context).custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral50).expanded, + "Remember Me".bodyText(context).custom(color: AppColor.textStyleColor(context)).expanded, ], ), 8.height, @@ -200,7 +200,7 @@ class _LoginPageState extends State { Checkbox( value: privacyPolicyChecked, side: BorderSide(color: AppColor.loadingColor(context), width: 1.0), - activeColor: AppColor.blueStatus(context), + activeColor: AppColor.primary10, visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onChanged: (value) { @@ -210,10 +210,10 @@ class _LoginPageState extends State { }), 8.width, RichText( - text: TextSpan(text: "I have read and agree to ", style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.primary50 : AppColor.neutral50), children: [ + text: TextSpan(text: "I have read and agree to ", style: AppTextStyles.bodyText.copyWith(color: AppColor.textStyleColor(context)), children: [ TextSpan( text: "Privacy Policy", - style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context), decoration: TextDecoration.underline), + style: AppTextStyles.bodyText.copyWith(color: AppColor.primary10, decoration: TextDecoration.underline), recognizer: TapGestureRecognizer() ..onTap = () async { Uri uri = Uri.parse("https://cloudsolutions.com.sa/en/privacy-policy"); diff --git a/lib/new_views/swipe_module/mark_attendance_widget.dart b/lib/new_views/swipe_module/mark_attendance_widget.dart deleted file mode 100644 index 7ebe6b6a..00000000 --- a/lib/new_views/swipe_module/mark_attendance_widget.dart +++ /dev/null @@ -1,821 +0,0 @@ -// import 'dart:async'; -// import 'dart:developer'; -// import 'dart:io'; -// -// import 'package:flutter/material.dart'; -// import 'package:geolocator/geolocator.dart'; -// import 'package:huawei_location/huawei_location.dart'; -// import 'package:nfc_manager/nfc_manager.dart'; -// import 'package:permission_handler/permission_handler.dart'; -// import 'package:provider/provider.dart'; -// import 'package:test_sa/controllers/providers/api/user_provider.dart'; -// import 'package:test_sa/extensions/int_extensions.dart'; -// import 'package:test_sa/extensions/text_extensions.dart'; -// import 'package:test_sa/extensions/widget_extensions.dart'; -// import 'package:test_sa/new_views/app_style/app_color.dart'; -// import 'package:test_sa/new_views/pages/land_page/nfc/nfc_reader_sheet.dart'; -// import 'package:test_sa/new_views/swipe_module/dialoge/confirm_dialog.dart'; -// import 'package:test_sa/new_views/swipe_module/dialoge/qr_scanner_dialog.dart'; -// import 'package:test_sa/new_views/swipe_module/dialoge/success_dialog.dart'; -// import 'package:test_sa/new_views/swipe_module/enums/swipe_type.dart'; -// import 'package:test_sa/new_views/swipe_module/models/swipe_model.dart'; -// import 'package:test_sa/new_views/swipe_module/swipe_success_view.dart'; -// import 'package:test_sa/new_views/swipe_module/utils/location_utils.dart'; -// import 'package:test_sa/new_views/swipe_module/utils/swipe_general_utils.dart'; -// import 'package:wifi_iot/wifi_iot.dart'; -// todo @sikander delete this file after compelte -// class MarkAttendanceWidget extends StatefulWidget { -// double topPadding; -// bool isFromDashboard; -// -// MarkAttendanceWidget({Key key, this.topPadding = 0, this.isFromDashboard = false}) : super(key: key); -// -// // todo MarkAttendanceWidget(this.model, {Key? key, this.topPadding = 0, this.isFromDashboard = false}) : super(key: key); -// -// @override -// _MarkAttendanceWidgetState createState() { -// return _MarkAttendanceWidgetState(); -// } -// } -// -// class _MarkAttendanceWidgetState extends State { -// bool isNfcEnabled = false, isQrEnabled = false, isWifiEnabled = false; -// UserProvider _userProvider; -// -// int _locationUpdateCbId = 0; -// -// @override -// void initState() { -// super.initState(); -// checkAttendanceAvailability(); -// } -// -// void checkAttendanceAvailability() async { -// _userProvider = Provider.of(context, listen: false); -// bool isAvailable = await NfcManager.instance.isAvailable(); -// log('backend enabled values are nfc ${_userProvider.user.enableNFC} qr ${_userProvider.user.enableQR} wifi ${_userProvider.user.enableWifi}'); -// setState(() { -// if (isAvailable && _userProvider.user.enableNFC) isNfcEnabled = true; -// if (_userProvider.user.enableQR) isQrEnabled = true; -// if (_userProvider.user.enableWifi) isWifiEnabled = true; -// }); -// } -// -// void checkHuaweiLocationPermission(SwipeTypeEnum attendanceType, BuildContext context) async { -// // Permission_Handler permissionHandler = PermissionHandler(); -// LocationUtilities.isEnabled((bool isEnabled) async { -// if (isEnabled) { -// LocationUtilities.havePermission((bool permission) async { -// if (permission) { -// getHuaweiCurrentLocation(attendanceType, context); -// } else { -// bool has = await requestPermissions(); -// if (has) { -// getHuaweiCurrentLocation(attendanceType, context); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () { -// Navigator.pop(context); -// }, -// ), -// ); -// } -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// -// // if (await permissionHandler.hasLocationPermission()) { -// // getHuaweiCurrentLocation(attendanceType); -// // } else { -// // bool has = await requestPermissions(); -// // if (has) { -// // getHuaweiCurrentLocation(attendanceType); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to give location permission to mark attendance", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } -// // } -// } -// -// Future requestPermissions() async { -// var result = await [ -// Permission.location, -// ].request(); -// return (result[Permission.location] == PermissionStatus.granted || result[Permission.locationAlways] == PermissionStatus.granted); -// } -// -// @override -// void dispose() { -// super.dispose(); -// // Stop Session -// NfcManager.instance.stopSession(); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), -// decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), -// width: double.infinity, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, -// children: [ -// 20.height, -// 'click me '.heading5(context).custom(color: AppColor.textStyleColor(context)), -// // LocaleKeys.markAttendance.tr().toSectionHeading(), -// // LocaleKeys.selectMethodOfAttendance.tr().toText11(color: const Color(0xff535353)), -// GridView( -// physics: const NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// padding: const EdgeInsets.only(bottom: 0, top: 21), -// gridDelegate: -// SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: (MediaQuery.of(context).size.width < 550) ? 3 : 5, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), -// children: availableAttendanceMethodList(context: context), -// ) -// ], -// ), -// ); -// } -// -// void handleSwipe({ -// SwipeTypeEnum swipeType, -// @required bool isEnable, -// @required BuildContext context, -// }) { -// // if (AppState().getIsHuawei) { -// if (false) { -// checkHuaweiLocationPermission(swipeType, context); -// } else { -// LocationUtilities.isEnabled((bool isEnabled) { -// if (isEnabled) { -// LocationUtilities.havePermission((bool permission) { -// if (permission) { -// SwipeGeneralUtils.showLoading(context); -// LocationUtilities.getCurrentLocation( -// (Position position, bool isMocked) { -// if (isMocked) { -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.markFakeAttendance(swipeType.name, position.latitude.toString() ?? "", position.longitude.toString() ?? "", context); -// } else { -// SwipeGeneralUtils.hideLoading(context); -// //todo performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// handleSwipeOperation(swipeType: swipeType, lat: position.latitude, lang: position.longitude); -// } -// }, -// () { -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// }, -// context, -// ); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to give location permission to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openAppSettings(); -// }, -// ), -// ); -// } -// }); -// } else { -// showDialog( -// context: context, -// builder: (BuildContext cxt) => ConfirmDialog( -// message: "You need to enable location services to mark attendance", -// onTap: () async { -// Navigator.pop(context); -// await Geolocator.openLocationSettings(); -// }, -// ), -// ); -// } -// }); -// } -// } -// -// void handleSwipeOperation({@required SwipeTypeEnum swipeType, double lat, double lang, BuildContext context}) { -// switch (swipeType) { -// case SwipeTypeEnum.NFC: -// handleNfcAttendance(latitude: lat, longitude: lang, context: context); -// return; -// case SwipeTypeEnum.QR: -// performQrCodeAttendance(latitude: lat, longitude: lang, context: context); -// return; -// case SwipeTypeEnum.Wifi: -// //TODO need to implement. -// return; -// } -// } -// -// void getHuaweiCurrentLocation(SwipeTypeEnum attendanceType, BuildContext context) async { -// try { -// SwipeGeneralUtils.showLoading(context); -// FusedLocationProviderClient locationService = FusedLocationProviderClient()..initFusedLocationService(); -// LocationRequest locationRequest = LocationRequest(); -// locationRequest.priority = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY; -// locationRequest.interval = 500; -// List locationRequestList = [locationRequest]; -// LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList); -// -// StreamSubscription _streamSubscription; -// int requestCode = (await (locationService.requestLocationUpdates(locationRequest))); -// -// _streamSubscription = locationService.onLocationData.listen( -// (Location location) async { -// SwipeGeneralUtils.hideLoading(context); -// await locationService.removeLocationUpdates(requestCode); -// handleSwipeOperation(swipeType: attendanceType); -// requestCode = 0; -// }, -// ); -// -// // locationService.checkLocationSettings(locationSettingsRequest).then((settings) async { -// // await locationService.getLastLocation().then((value) { -// // if (value.latitude == null || value.longitude == null) { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "Unable to get your location, Please check your location settings & try again.", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } else { -// // if (attendanceType == "QR") { -// // performQrCodeAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // if (attendanceType == "WIFI") { -// // performWifiAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // if (attendanceType == "NFC") { -// // performNfcAttendance(widget.model, lat: value.latitude.toString() ?? "", lng: value.longitude.toString() ?? ""); -// // } -// // } -// // }).catchError((error) { -// // log("HUAWEI LOCATION getLastLocation ERROR!!!!!"); -// // log(error); -// // }); -// // }).catchError((error) { -// // log("HUAWEI LOCATION checkLocationSettings ERROR!!!!!"); -// // log(error); -// // if (error.code == "LOCATION_SETTINGS_NOT_AVAILABLE") { -// // // Location service not enabled. -// // } -// // }); -// } catch (error) { -// log("HUAWEI LOCATION ERROR!!!!!"); -// log('$error'); -// SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.handleException(error, context, null); -// } -// } -// -// Future handleNfcAttendance({double latitude = 0, double longitude = 0, BuildContext context}) async { -// final userProvider = Provider.of(context, listen: false); -// -// if (Platform.isIOS) { -// SwipeGeneralUtils.readNFc(onRead: (String nfcId) async { -// await _processNfcAttendance(userProvider, nfcId, latitude, longitude, context); -// }); -// } else { -// showNfcReader(context, onNcfScan: (String nfcId) async { -// await _processNfcAttendance(userProvider, nfcId ?? '', latitude, longitude, context); -// }); -// } -// } -// -// Future _processNfcAttendance( -// UserProvider userProvider, -// String nfcId, -// double latitude, -// double longitude, -// BuildContext context, -// ) async { -// SwipeGeneralUtils.showLoading(context); -// try { -// // final swipeModel = Swipe( -// // swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), -// // value: nfcId, -// // latitude: latitude, -// // longitude: longitude, -// // ); -// //Test model... -// final swipeModel = Swipe(swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), value: '123', latitude: 24.70865415364271, longitude: 46.66600861881879); -// final swipeResponse = await userProvider.makeSwipe(model: swipeModel); -// if (swipeResponse.isSuccess) { -// if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// SwipeGeneralUtils.hideLoading(context); -// Navigator.pushNamed(context, SwipeSuccessView.routeName); -// } else { -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.showErrorDialog(message: swipeResponse.message ?? "Unexpected error occurred", context: context); -// } -// } catch (errSwipeGeneralUtilsor) { -// SwipeGeneralUtils.hideLoading(context); -// // Uncomment below line for error handling if needed -// // SwipeGeneralUtils.handleException(error, context, null); -// } -// } -// -// Future closeWifiRequest() async { -// if (Platform.isAndroid) { -// await WiFiForIoTPlugin.forceWifiUsage(false); -// } -// return await WiFiForIoTPlugin.disconnect(); -// } -// -// Future performQrCodeAttendance({double latitude, double longitude, BuildContext context}) async { -// UserProvider userProvider = Provider.of(context, listen: false); -// var qrCodeValue = await Navigator.of(context).push( -// MaterialPageRoute( -// builder: (BuildContext context) => QrScannerDialog(), -// ), -// ); -// if (qrCodeValue != null) { -// SwipeGeneralUtils.showLoading(context); -// try { -// //test model.. -// final swipeModel = Swipe( -// swipeTypeValue: SwipeTypeEnum.QR.getIntFromSwipeTypeEnum(), -// value: '2323', -// latitude: 24.70865415364271, -// longitude: 46.66600861881879, -// ); -// final swipeResponse = await userProvider.makeSwipe(model: swipeModel); -// if (swipeResponse.isSuccess) { -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.showMDialog(context, backgroundColor: Colors.transparent, isDismissable: true, child: SuccessDialog(widget.isFromDashboard)); -// } else { -// SwipeGeneralUtils.hideLoading(context); -// showDialog( -// barrierDismissible: true, -// context: context, -// builder: (cxt) => ConfirmDialog( -// message: swipeResponse.message ?? "", -// onTap: () { -// Navigator.pop(context); -// }, -// onCloseTap: () {} -// ), -// ); -// } -// } catch (ex) { -// SwipeGeneralUtils.hideLoading(context); -// } -// } -// } -// -// List availableAttendanceMethodList({@required BuildContext context}) { -// List availableMethods = []; -// if (isNfcEnabled) { -// availableMethods.add(attendanceMethod(SwipeTypeEnum.NFC.name, 'nfc_icon', isNfcEnabled, () { -// handleSwipe(swipeType: SwipeTypeEnum.NFC, isEnable: isNfcEnabled, context: context); -// })); -// } -// if (isQrEnabled) { -// availableMethods.add(attendanceMethod(SwipeTypeEnum.QR.name, 'wifi_icon', isQrEnabled, () { -// handleSwipe(swipeType: SwipeTypeEnum.QR, isEnable: isQrEnabled, context: context); -// })); -// } -// if (isWifiEnabled) { -// availableMethods.add(attendanceMethod(SwipeTypeEnum.Wifi.name, 'wifi_icon', isWifiEnabled, () { -// handleSwipe(swipeType: SwipeTypeEnum.Wifi, isEnable: isWifiEnabled, context: context); -// })); -// } -// return availableMethods; -// } -// -// Widget attendanceMethod(String title, String icon, bool isEnabled, VoidCallback onPress) { -// return Container( -// padding: EdgeInsets.all(12), -// decoration: BoxDecoration( -// color: Colors.white, -// borderRadius: BorderRadius.circular(18), -// border: Border.all(color: AppColor.white40, width: 2), -// ), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// icon.toSvgAsset(), -// title.heading5(context).custom(color: AppColor.neutral50), -// // Text( -// // title, -// // style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500), -// // ), -// ], -// ), -// ).onPress( -// () { -// log('isEnabled is ${!isEnabled}'); -// if (!isEnabled) return; -// onPress(); -// }, -// ); -// // return Container( -// // decoration: BoxDecoration( -// // borderRadius: BorderRadius.circular(15), -// // color: isEnabled ? null : Colors.grey.withOpacity(.5), -// // gradient: isEnabled -// // ? const LinearGradient( -// // transform: GradientRotation(.64), -// // begin: Alignment.topRight, -// // end: Alignment.bottomLeft, -// // colors: [ -// // //ToDo set Colors according to design provided by designer... -// // Colors.blue, -// // Colors.green, -// // // AppColor.gradiantEndColor, -// // // MyColors.gradiantStartColor, -// // ], -// // ) -// // : null, -// // ), -// // clipBehavior: Clip.antiAlias, -// // padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), -// // child: Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // // SvgPicture.asset(image, color: Colors.white, alignment: Alignment.topLeft).expanded, -// // Icon(iconData, color: isEnabled ? AppColor.black35 : Colors.grey), -// // title.heading6(context), -// // // title.toText17(isBold: true, color: Colors.white), -// // ], -// // ), -// // ).onPress( -// // () { -// // log('isEnabled is ${!isEnabled}'); -// // if (!isEnabled) return; -// // onPress(); -// // }, -// // ); -// } -// } -// -// // Widget customListItem({required String icon, required String heading, required String subHeading, required VoidCallback onTap}) { -// // return GestureDetector( -// // onTap: onTap, // Handles the tap -// // child: Card( -// // shape: RoundedRectangleBorder( -// // borderRadius: BorderRadius.circular(14), // Circular border radius -// // ), -// // color: Colors.white, -// // child: Row( -// // crossAxisAlignment: CrossAxisAlignment.start, // Align items at the top -// // children: [ -// // // Icon Section -// // icon -// // .toSvgAsset( -// // width: 32, -// // color: AppColor.neutral120, -// // height: 29, -// // ) -// // .paddingOnly(top: 8), -// // 14.width, -// // Expanded( -// // child: Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // Text( -// // heading, -// // style: AppTextStyles.heading6.copyWith(color: AppColor.neutral50), -// // ), -// // 7.height, -// // Text( -// // subHeading, -// // style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral120), -// // ), -// // ], -// // ).paddingOnly(end: 50), -// // ), -// // ], -// // ).paddingAll(12), -// // ), -// // ); -// // } -// -// //qr older code... -// -// //nfc older code widget -// -// // // if (AppState().getIsHuawei) { -// // if (false) { -// // checkHuaweiLocationPermission(SwipeTypeEnum.NFC); -// // } else { -// // LocationUtilities.isEnabled((bool isEnabled) { -// // if (isEnabled) { -// // LocationUtilities.havePermission((bool permission) { -// // if (permission) { -// // SwipeGeneralUtils.showLoading(context); -// // LocationUtilities.getCurrentLocation( -// // (Position position, bool isMocked) { -// // if (isMocked) { -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.markFakeAttendance("NFC", position.latitude.toString() ?? "", position.longitude.toString() ?? "",context); -// // } else { -// // SwipeGeneralUtils.hideLoading(context); -// // //todo performNfcAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// // } -// // }, -// // () { -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// // }, -// // context, -// // ); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to give location permission to mark attendance", -// // onTap: () async { -// // Navigator.pop(context); -// // await Geolocator.openAppSettings(); -// // }, -// // ), -// // ); -// // } -// // }); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to enable location services to mark attendance", -// // onTap: () async { -// // Navigator.pop(context); -// // await Geolocator.openLocationSettings(); -// // }, -// // ), -// // ); -// // } -// // }); -// // } -// -// //older code.... -// // Future performNfcAttendance({double lat = 0, double lng = 0}) async { -// // UserProvider userProvider = Provider.of(context,listen:false); -// // if (Platform.isIOS) { -// // SwipeGeneralUtils.readNFc(onRead: (String nfcId) async { -// // SwipeGeneralUtils.showLoading(context); -// // try { -// // SwipeModel swipeResponse = await userProvider.makeSwipe(model: Swipe(swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), value: '', latitude: lat, longitude: lng)); -// // if (swipeResponse.responseCode != 1) { -// // SwipeGeneralUtils.hideLoading(context); -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: swipeResponse.message ?? "Unexpected error occurred", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } else { -// // bool status = swipeResponse.data; -// // if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.showMDialog( -// // context, -// // backgroundColor: Colors.transparent, -// // isDismissable: true, -// // child: SuccessDialog(widget.isFromDashboard), -// // ); -// // } -// // } catch (ex) { -// // SwipeGeneralUtils.hideLoading(context); -// // // SwipeGeneralUtils.handleException(ex, context, null); -// // } -// // }); -// // } else { -// // showNfcReader(context, onNcfScan: (String nfcId) async { -// // SwipeGeneralUtils.showLoading(context); -// // try { -// // SwipeModel swipeResponse = await userProvider.makeSwipe(model: Swipe(swipeTypeValue: SwipeTypeEnum.NFC.getIntFromSwipeTypeEnum(), value: nfcId??'', latitude: lat, longitude: lng)); -// // log('api response i got is ${swipeResponse.toJson()}'); -// // if (swipeResponse.responseCode != 1) { -// // SwipeGeneralUtils.hideLoading(context); -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: swipeResponse.message ?? "Unexpected error occurred", -// // onTap: () { -// // Navigator.pop(context); -// // }, -// // ), -// // ); -// // } else { -// // bool status = swipeResponse.data; //use this status to get transactions. -// // if (Platform.isIOS) await Future.delayed(const Duration(seconds: 3)); -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.showMDialog( -// // context, -// // backgroundColor: Colors.transparent, -// // isDismissable: true, -// // child: SuccessDialog(widget.isFromDashboard), -// // ); -// // } -// // } catch (ex) { -// // SwipeGeneralUtils.hideLoading(context); -// // // SwipeGeneralUtils.handleException(ex, context, null); -// // } -// // // SwipeGeneralUtils.showLoading(context); -// // // try { -// // // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); -// // // if (g?.messageStatus != 1) { -// // // SwipeGeneralUtils.hideLoading(context); -// // // showDialog( -// // // context: context, -// // // builder: (BuildContext cxt) => ConfirmDialog( -// // // message: g?.errorEndUserMessage ?? "Unexpected error occurred", -// // // onTap: () { -// // // Navigator.pop(context); -// // // }, -// // // ), -// // // ); -// // // } else { -// // // bool status = await model.fetchAttendanceTracking(context); -// // // SwipeGeneralUtils.hideLoading(context); -// // // showMDialog( -// // // context, -// // // backgroundColor: Colors.transparent, -// // // isDismissable: false, -// // // child: SuccessDialog(widget.isFromDashboard), -// // // ); -// // // } -// // // } catch (ex) { -// // // log(ex); -// // // SwipeGeneralUtils.hideLoading(context); -// // // // SwipeGeneralUtils.handleException(ex, context, (String msg) { -// // // // SwipeGeneralUtils.confirmDialog(context, msg); -// // // // }); -// // // } -// // }); -// // } -// // } -// -// // -// // Future checkSession() async { -// // try { -// // SwipeGeneralUtils.showLoading(context); -// // await DashboardApiClient().getOpenMissingSwipes(); -// // SwipeGeneralUtils.hideLoading(context); -// // return true; -// // } catch (ex) { -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.handleException(ex, context, null); -// // return false; -// // } -// // } -// -// //TODO need to confirm .... -// Future performWifiAttendance({double? latitude, double? lng}) async { -// // if (Platform.isAndroid) { -// // if (!(await checkSession())) { -// // return; -// // } -// // } -// SwipeGeneralUtils.showLoading(context); -// bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", -// password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); -// -// if (Platform.isIOS) { -// if (await WiFiForIoTPlugin.getSSID() == AppState().getMohemmWifiSSID) { -// isConnected = true; -// } else { -// isConnected = false; -// } -// } -// -// if (isConnected && AppState().isAuthenticated) { -// await WiFiForIoTPlugin.forceWifiUsage(true); -// await Future.delayed(const Duration(seconds: 6)); -// try { -// GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); -// bool status = await model.fetchAttendanceTracking(context); -// SwipeGeneralUtils.hideLoading(context); -// await closeWifiRequest(); -// if (g?.messageStatus == 2) { -// showDialog( -// barrierDismissible: true, -// context: context, -// builder: (cxt) => ConfirmDialog( -// message: g?.errorEndUserMessage ?? "", -// onTap: () { -// Navigator.pop(context); -// }, -// onCloseTap: () {}, -// ), -// ); -// } else { -// showMDialog( -// context, -// backgroundColor: Colors.transparent, -// isDismissable: false, -// child: SuccessDialog(widget.isFromDashboard), -// ); -// } -// } catch (ex) { -// await closeWifiRequest(); -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.handleException(ex, context, null); -// } -// } else { -// if (AppState().isAuthenticated) { -// SwipeGeneralUtils.hideLoading(context); -// SwipeGeneralUtils.confirmDialog(context, "LocaleKeys.comeNearHMGWifi.tr()"); -// } else { -// await closeWifiRequest(); -// } -// } -// } -// -// // older grid widget.. -// // attendanceMethod(SwipeTypeEnum.NFC.name, Icons.nfc, isNfcEnabled, () { -// // handleSwipe(swipeType: SwipeTypeEnum.NFC, isEnable: isNfcEnabled); -// // }), -// // attendanceMethod(SwipeTypeEnum.QR.name, Icons.qr_code_2, isQrEnabled, () async { -// // handleSwipe(swipeType: SwipeTypeEnum.QR, isEnable: true); -// // }), -// // //if (isWifiEnabled) //todo -// // attendanceMethod(SwipeTypeEnum.Wifi.name, Icons.wifi, isWifiEnabled, () { -// // // if (AppState().getIsHuawei) { -// // if (false) { -// // checkHuaweiLocationPermission(SwipeTypeEnum.Wifi); -// // } else { -// // LocationUtilities.isEnabled((bool isEnabled) { -// // if (isEnabled) { -// // LocationUtilities.havePermission((bool permission) { -// // if (permission) { -// // SwipeGeneralUtils.showLoading(context); -// // LocationUtilities.getCurrentLocation( -// // (Position position, bool isMocked) { -// // if (isMocked) { -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.markFakeAttendance("WIFI", position.latitude.toString() ?? "", position.longitude.toString() ?? "", context); -// // } else { -// // SwipeGeneralUtils.hideLoading(context); -// // //todo performWifiAttendance(widget.model, lat: position.latitude.toString() ?? "", lng: position.longitude.toString() ?? ""); -// // } -// // }, -// // () { -// // SwipeGeneralUtils.hideLoading(context); -// // SwipeGeneralUtils.confirmDialog(context, "Unable to determine your location, Please make sure that your location services are turned on & working."); -// // }, -// // context, -// // ); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to give location permission to mark attendance", -// // onTap: () async { -// // Navigator.pop(context); -// // await Geolocator.openAppSettings(); -// // }, -// // ), -// // ); -// // } -// // }); -// // } else { -// // showDialog( -// // context: context, -// // builder: (BuildContext cxt) => ConfirmDialog( -// // message: "You need to enable location services to mark attendance", -// // onTap: () async { -// // Navigator.pop(context); -// // await Geolocator.openLocationSettings(); -// // }, -// // ), -// // ); -// // } -// // }); -// // } -// // }), diff --git a/lib/new_views/swipe_module/swipe_history_view.dart b/lib/new_views/swipe_module/swipe_history_view.dart index c340f7bb..3a939898 100644 --- a/lib/new_views/swipe_module/swipe_history_view.dart +++ b/lib/new_views/swipe_module/swipe_history_view.dart @@ -47,87 +47,86 @@ class _SwipeHistoryViewState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const DefaultAppBar( - title: 'Swipe History', - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 8.height, - Row( - children: [ - ADatePicker( - label: context.translation.from, - date: dateFrom, - from: DateTime(DateTime.now().year - 5, DateTime.now().month, DateTime.now().day), - formatDateWithTime: true, - onDatePicker: (selectedDate) { - if (selectedDate != null) { - showThemedTimePicker( - context: context, - initialTime: TimeOfDay.now(), - ).then((selectedTime) { - // Handle the selected date and time here. - if (selectedTime != null) { - DateTime selectedDateTime = DateTime( - selectedDate.year, - selectedDate.month, - selectedDate.day, - selectedTime.hour, - selectedTime.minute, - ); - if (selectedDateTime != null) { - setState(() { - dateFrom = selectedDateTime; - }); + appBar: const DefaultAppBar(title: 'Swipe History'), + body: SafeArea( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + spacing: 8, + children: [ + ADatePicker( + label: context.translation.from, + date: dateFrom, + from: DateTime(DateTime.now().year - 5, DateTime.now().month, DateTime.now().day), + formatDateWithTime: true, + onDatePicker: (selectedDate) { + if (selectedDate != null) { + showThemedTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ).then((selectedTime) { + // Handle the selected date and time here. + if (selectedTime != null) { + DateTime selectedDateTime = DateTime( + selectedDate.year, + selectedDate.month, + selectedDate.day, + selectedTime.hour, + selectedTime.minute, + ); + if (selectedDateTime != null) { + setState(() { + dateFrom = selectedDateTime; + }); + } } - } - }); - } - }, - ).expanded, - 8.width, - ADatePicker( - label: context.translation.to, - date: dateTo, - from: DateTime(DateTime.now().year - 5, DateTime.now().month, DateTime.now().day), - formatDateWithTime: true, - onDatePicker: (selectedDate) { - if (selectedDate != null) { - showThemedTimePicker( - context: context, - initialTime: TimeOfDay.now(), - ).then((selectedTime) { - // Handle the selected date and time here. - if (selectedTime != null) { - DateTime selectedDateTime = DateTime( - selectedDate.year, - selectedDate.month, - selectedDate.day, - selectedTime.hour, - selectedTime.minute, - ); - if (selectedDateTime != null) { - setState(() { - dateTo = selectedDateTime; - }); + }); + } + }, + ).expanded, + ADatePicker( + label: context.translation.to, + date: dateTo, + from: DateTime(DateTime.now().year - 5, DateTime.now().month, DateTime.now().day), + formatDateWithTime: true, + onDatePicker: (selectedDate) { + if (selectedDate != null) { + showThemedTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ).then((selectedTime) { + // Handle the selected date and time here. + if (selectedTime != null) { + DateTime selectedDateTime = DateTime( + selectedDate.year, + selectedDate.month, + selectedDate.day, + selectedTime.hour, + selectedTime.minute, + ); + if (selectedDateTime != null) { + setState(() { + dateTo = selectedDateTime; + }); + } } - } - }); - } - }, - ).expanded, - ], - ), - 12.height, - AppFilledButton(label: context.translation.search, maxWidth: false, onPressed: getSwipeHistory), - 8.height, - const Divider().defaultStyle(context), - Consumer(builder: (context, snapshot, child) { - return SwipeHistoryList(snapshot.swipeHistory ?? [], snapshot.isLoading).expanded; - }), - ], - ).paddingAll(20), + }); + } + }, + ).expanded, + ], + ), + 12.height, + AppFilledButton(label: context.translation.search, maxWidth: false, onPressed: getSwipeHistory), + 8.height, + const Divider().defaultStyle(context), + Consumer(builder: (context, snapshot, child) { + return SwipeHistoryList(snapshot.swipeHistory ?? [], snapshot.isLoading).expanded; + }).expanded, + ], + ).paddingOnly(start: 16, end: 16, top: 16), + ), ); } } @@ -143,7 +142,7 @@ class SwipeHistoryList extends StatelessWidget { return (list.isEmpty && !isLoading) ? NoDataFound(message: context.translation.noDataFound).center : ListView.separated( - padding: EdgeInsets.only(top: 12.toScreenHeight), + padding: const EdgeInsets.only(bottom: 16, top: 16), itemBuilder: (cxt, index) { if (isLoading) return const SizedBox().toRequestShimmer(cxt, isLoading); return SwipeHistoryCard(list[index]); diff --git a/lib/new_views/swipe_module/utils/swipe_general_utils.dart b/lib/new_views/swipe_module/utils/swipe_general_utils.dart index a24834e0..ac6c7c0f 100644 --- a/lib/new_views/swipe_module/utils/swipe_general_utils.dart +++ b/lib/new_views/swipe_module/utils/swipe_general_utils.dart @@ -29,6 +29,8 @@ import 'package:test_sa/new_views/swipe_module/enums/swipe_type.dart'; import 'package:test_sa/new_views/swipe_module/models/swipe_model.dart'; import 'package:test_sa/new_views/swipe_module/swipe_success_view.dart'; import 'package:test_sa/new_views/swipe_module/utils/location_utils.dart'; +import 'package:test_sa/views/widgets/item_views/info_header_widget.dart'; +import 'package:test_sa/views/widgets/item_views/info_text_widget.dart'; import 'package:test_sa/views/widgets/qr/scan_qr.dart'; import 'package:wifi_iot/wifi_iot.dart'; @@ -125,18 +127,8 @@ class SwipeGeneralUtils { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - icon.toSvgAsset( - color: isEnabled - ? context.isDark - ? AppColor.neutral30 - : AppColor.neutral50 - : Colors.grey.withOpacity(0.5)), - title.heading5(context).custom( - color: isEnabled - ? context.isDark - ? AppColor.neutral30 - : AppColor.neutral50 - : Colors.grey.withOpacity(0.5)), + icon.toSvgAsset(width: 24, height: 24, color: AppColor.icon2Color(context)), + title.bodyText2(context).custom(color: AppColor.labelTextStyleColor(context), fontSize: context.isTablet() ? 10.toScreenWidth : null), ], ), ).onPress( @@ -826,9 +818,9 @@ class _SwipeTypeBottomSheetContentState extends State<_SwipeTypeBottomSheetConte mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - context.translation.markAttendance.heading5(context).custom(color: AppColor.headingTextColor(context)), + InfoHeader16Widget("Mark Attendance"), 8.height, - context.translation.selectMethodToMarkAttendance.bodyText2(context).custom(color: AppColor.lightTextColor(context)), + InfoTextLabelWidget(label: context.translation.selectMethodToMarkAttendance), 12.height, GridView.builder( padding: const EdgeInsets.all(0), @@ -910,4 +902,3 @@ class _SwipeTypeItem { required this.isEnabled, }); } - diff --git a/lib/views/full_screen_image_viewer.dart b/lib/views/full_screen_image_viewer.dart index 43aee198..9c463e06 100644 --- a/lib/views/full_screen_image_viewer.dart +++ b/lib/views/full_screen_image_viewer.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; +import '../new_views/app_style/app_color.dart'; + class FullScreenImageViewer extends StatelessWidget { final Widget child; @@ -12,7 +14,23 @@ class FullScreenImageViewer extends StatelessWidget { body: Stack( children: [ InteractiveViewer(clipBehavior: Clip.none, panEnabled: true, minScale: 0.5, maxScale: 4.0, child: child).center, - Positioned(top: MediaQuery.of(context).padding.top, left: 12.0, child: const Icon(Icons.clear).toShadowContainer(context, width: 40, padding: 8).onPress(() => Navigator.maybePop(context))), + SafeArea( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: FloatingActionButton( + heroTag: "full-screen-image-viewer", + backgroundColor: AppColor.background(context), + onPressed: () => Navigator.maybePop(context), + hoverColor: Colors.transparent, + splashColor: Colors.transparent, + shape: RoundedRectangleBorder( + side: BorderSide(color: AppColor.borderColor(context)), + borderRadius: BorderRadius.circular(14.0), + ), + child: Icon(Icons.clear, size: 24, color: AppColor.icon2Color(context)), + ), + ), + ), ], ), ); diff --git a/lib/views/widgets/auto_complete/wo_auto_complete_field.dart b/lib/views/widgets/auto_complete/wo_auto_complete_field.dart index b157df2e..5d01acce 100644 --- a/lib/views/widgets/auto_complete/wo_auto_complete_field.dart +++ b/lib/views/widgets/auto_complete/wo_auto_complete_field.dart @@ -59,11 +59,12 @@ class _WoAutoCompleteFieldState extends State { @override Widget build(BuildContext context) { - final border = UnderlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.circular(10)); + final border = UnderlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.circular(16)); return Container( decoration: BoxDecoration( color: AppColor.background(context), - borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)), + border: Border.all(color: AppColor.border2Color(context), width: 1), + borderRadius: BorderRadius.circular(16), // boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], ), child: Autocomplete( @@ -93,7 +94,7 @@ class _WoAutoCompleteFieldState extends State { return TextField( controller: _controller, focusNode: fieldFocusNode, - style: AppTextStyles.bodyText.copyWith(color: AppColor.black10), + style: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 14, color: AppColor.textStyleColor(context)), textAlign: TextAlign.start, decoration: InputDecoration( border: border, @@ -101,16 +102,16 @@ class _WoAutoCompleteFieldState extends State { focusedBorder: border, enabledBorder: border, errorBorder: border, - contentPadding: EdgeInsets.symmetric(vertical: 8.toScreenHeight, horizontal: 16.toScreenWidth), + contentPadding: EdgeInsets.symmetric(vertical: 12.toScreenHeight, horizontal: 16.toScreenWidth), constraints: const BoxConstraints(), suffixIconConstraints: const BoxConstraints(maxHeight: 24, maxWidth: 24 + 8), filled: true, enabled: widget.enabled, - fillColor: AppColor.fieldBgColor(context), + fillColor: AppColor.dropDownBackground(context), errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60), - floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? null : AppColor.neutral20), + floatingLabelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: AppColor.floatingTextStyleColor(context)), + labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: context.isTablet() ? 16 : 12, color: AppColor.labelTextStyleColor(context)), labelText: "CM Work Order Number", - labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.textColor(context)), suffixIcon: loading ? const CircularProgressIndicator(color: AppColor.primary10, strokeWidth: 3.0).paddingOnly(end: 8) : null, ), textInputAction: TextInputAction.search, diff --git a/lib/views/widgets/equipment/asset_detail_page.dart b/lib/views/widgets/equipment/asset_detail_page.dart index a876ffeb..6e2266ca 100644 --- a/lib/views/widgets/equipment/asset_detail_page.dart +++ b/lib/views/widgets/equipment/asset_detail_page.dart @@ -279,10 +279,7 @@ class _AssetDetailPageState extends State with SingleTickerProv children: [ InfoHeader16Widget(assetModel?.modelDefinition?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? "-"), if (context.userProvider.isEngineer && !(assetModel?.hasTrainingImageData ?? true)) - Text( - '*Upload Images for this asset', - style: AppTextStyles.bodyText2.copyWith(color: AppColor.red30), - ), + const InfoTextLabelWidget(label: '*Upload Images for this asset', color: AppColor.red30), ], ), ), diff --git a/lib/views/widgets/equipment/my_assets_page.dart b/lib/views/widgets/equipment/my_assets_page.dart index 43fbbd6d..b3c971e2 100644 --- a/lib/views/widgets/equipment/my_assets_page.dart +++ b/lib/views/widgets/equipment/my_assets_page.dart @@ -133,6 +133,7 @@ class _MyAssetsPageState extends State with SingleTickerProviderSt IconButton( icon: Icon(!showListView ? Icons.view_list_sharp : Icons.grid_view_outlined, color: AppColor.icon2Color(context)), padding: EdgeInsets.zero, + iconSize: 20, visualDensity: VisualDensity.compact, tooltip: !showListView ? "View as List" : "View as Grid", onPressed: () => setState(() { @@ -173,7 +174,7 @@ class _MyAssetsPageState extends State with SingleTickerProviderSt }, ), ], - ).paddingOnly(start: 16, end: 16), + ).paddingOnly(start: 16, end: 8), ), body: SafeArea( child: LoadingManager( @@ -313,7 +314,7 @@ class _MyAssetsPageState extends State with SingleTickerProviderSt floatingActionButton: FloatingActionButton( heroTag: "some tag 2", backgroundColor: AppColor.primary10, - child: "qr".toSvgAsset(height: 32, fit: BoxFit.fitHeight, color: AppColor.background(context)), + child: Icon(Icons.qr_code_2_rounded, size: 40, color: AppColor.addItemButtonColor(context)), onPressed: () async { String? result = await Navigator.of(context).push( MaterialPageRoute(builder: (_) => const ScanQr()), diff --git a/lib/views/widgets/item_views/info_text_widget.dart b/lib/views/widgets/item_views/info_text_widget.dart index b3a2b252..cc589cbf 100644 --- a/lib/views/widgets/item_views/info_text_widget.dart +++ b/lib/views/widgets/item_views/info_text_widget.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; @@ -34,16 +36,16 @@ class InfoTextWidget extends StatelessWidget { "arrow_right".toSvgAsset(width: 17, color: AppColor.primary10), ], ); - } else if (copyValue) { - // text = Row( - // mainAxisSize: MainAxisSize.min, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - // Flexible(child: text), - // const SizedBox(width: 4), - // Icon(Icons.copy_rounded, color: AppColor.loadingColor(context), size: 12), - // ], - // ); + } else if (copyValue && (value?.isNotEmpty ?? false)) { + text = Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Flexible(child: text), + 8.width, + const Icon(Icons.copy_rounded, color: AppColor.primary10, size: 14).onPress(() => Clipboard.setData(ClipboardData(text: value!))), + ], + ); } return text; } @@ -52,13 +54,14 @@ class InfoTextWidget extends StatelessWidget { class InfoTextLabelWidget extends StatelessWidget { final String label; final Color? color; + final TextStyle? textStyle; - InfoTextLabelWidget({required this.label, this.color, Key? key}) : super(key: key); + const InfoTextLabelWidget({required this.label, this.color, this.textStyle, Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget text; - text = Text(label, style: AppTextStyles.bodyText2.copyWith(color: color ?? AppColor.lightTextColor(context))); + text = Text(label, style: (textStyle ?? AppTextStyles.bodyText2).copyWith(color: color ?? AppColor.lightTextColor(context))); return text; } } diff --git a/lib/views/widgets/qr/scan_qr.dart b/lib/views/widgets/qr/scan_qr.dart index 78c22e46..bdf46b6e 100644 --- a/lib/views/widgets/qr/scan_qr.dart +++ b/lib/views/widgets/qr/scan_qr.dart @@ -155,10 +155,16 @@ class _ScannerOverlay extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(16.0), child: FloatingActionButton( - heroTag: "some tag 3", + heroTag: "qr-scan", backgroundColor: AppColor.background(context), onPressed: onBack, - child: Icon(Icons.arrow_back, size: 24.toScreenWidth, color: AppColor.icon2Color(context)), + hoverColor: Colors.transparent, + splashColor: Colors.transparent, + shape: RoundedRectangleBorder( + side: BorderSide(color: AppColor.borderColor(context)), + borderRadius: BorderRadius.circular(14.0), + ), + child: Icon(Icons.arrow_back, size: 24, color: AppColor.icon2Color(context)), ), ), ),