diff --git a/lib/modules/pm_module/ppm_wo/ppm_details_page.dart b/lib/modules/pm_module/ppm_wo/ppm_details_page.dart index 50df7af0..0ac5b3ae 100644 --- a/lib/modules/pm_module/ppm_wo/ppm_details_page.dart +++ b/lib/modules/pm_module/ppm_wo/ppm_details_page.dart @@ -117,9 +117,11 @@ class _PpmDetailsPageState extends State { }, label: context.translation.updateWorkOrder, ), + context: context, ) ] else ...[ FooterActionButton.footerContainer( + context: context, child: AppFilledButton( onPressed: () async { await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdatePpm(ppm: null, planPreventiveVisit: planPreventiveVisit))); diff --git a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart index 6f5224a5..c4b3b0cc 100644 --- a/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart +++ b/lib/modules/pm_module/ppm_wo/update_ppm/update_ppm.dart @@ -48,9 +48,8 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); ppmProvider.planPreventiveVisit?.preventiveVisitAttachments = []; for (var item in ppmProvider.ppmPlanAttachments) { - String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; - ppmProvider.planPreventiveVisit?.preventiveVisitAttachments - ?.add(PreventiveVisitAttachments(id: item.id, attachmentName: fileName)); + String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? ''; + ppmProvider.planPreventiveVisit?.preventiveVisitAttachments?.add(PreventiveVisitAttachments(id: item.id, attachmentName: fileName)); } ppmProvider.planPreventiveVisit?.preventiveVisitTimers = ppmProvider.planPreventiveVisit?.preventiveVisitTimers ?? []; @@ -202,6 +201,7 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { ), ).expanded, FooterActionButton.footerContainer( + context: context, child: Row( children: [ if (tabIndex == 1) ...[ @@ -227,8 +227,8 @@ class _UpdatePpmState extends State with TickerProviderStateMixin { AppFilledButton( // buttonColor: AppColor.white60, // textColor: AppColor.neutral50, - buttonColor: context.isDark?AppColor.neutral50:AppColor.white60, - textColor: context.isDark ? Colors.white: AppColor.neutral150, + buttonColor: context.isDark ? AppColor.neutral50 : AppColor.white60, + textColor: context.isDark ? Colors.white : AppColor.neutral150, onPressed: () { _onSubmit(status: 0); }, diff --git a/lib/modules/tm_module/tasks_wo/task_request_detail_view.dart b/lib/modules/tm_module/tasks_wo/task_request_detail_view.dart index a23c866a..003f275f 100644 --- a/lib/modules/tm_module/tasks_wo/task_request_detail_view.dart +++ b/lib/modules/tm_module/tasks_wo/task_request_detail_view.dart @@ -146,6 +146,7 @@ class _TaskRequestDetailsViewState extends State { ).expanded, if (userProvider!.user!.type == UsersTypes.engineer && (taskModel?.taskJobStatus?.value != 4 && taskModel?.taskJobStatus?.value != 3)) FooterActionButton.footerContainer( + context: context, child: AppFilledButton( onPressed: () async { if (taskProvider.taskRequestModel?.taskType?.isInstallation == true) { diff --git a/lib/views/pages/user/gas_refill/gas_refill_details.dart b/lib/views/pages/user/gas_refill/gas_refill_details.dart index 727dcf69..e5964bc5 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_details.dart +++ b/lib/views/pages/user/gas_refill/gas_refill_details.dart @@ -75,6 +75,7 @@ class _GasRefillDetailsPageState extends State { ).expanded, if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2)) ...[ FooterActionButton.footerContainer( + context: context, child: AppFilledButton( onPressed: () async { await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model))); diff --git a/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart b/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart index dbfe8022..b4dc234e 100644 --- a/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart +++ b/lib/views/widgets/fullscreen_dialogs/selection_fullscreen_dialog.dart @@ -147,7 +147,7 @@ class _SelectionBottomSheetState extends State> Navigator.pop(context); widget.onSelect(_selectedValue); }, - ), + ), context: context, ), ], ), diff --git a/lib/views/widgets/images/multi_image_picker.dart b/lib/views/widgets/images/multi_image_picker.dart index 60035bd9..18dce2a5 100644 --- a/lib/views/widgets/images/multi_image_picker.dart +++ b/lib/views/widgets/images/multi_image_picker.dart @@ -339,7 +339,7 @@ class _AttachmentPickerState extends State { ); if (result != null) { for (var path in result.paths) { - widget.attachment.add(GenericAttachmentModel(id: 0,name: File(path!).path)); + widget.attachment.add(GenericAttachmentModel(id: 0, name: File(path!).path)); } if (widget.onChange != null) { widget.onChange!(widget.attachment); @@ -347,8 +347,12 @@ class _AttachmentPickerState extends State { setState(() {}); } } -} + void showFileSourceSheet() async { + if (widget.attachment.length >= 5) { + Fluttertoast.showToast(msg: context.translation.maxImagesNumberIs5); + return; + } ImageSource source = (await showModalBottomSheet( context: context, shape: const RoundedRectangleBorder( @@ -386,7 +390,7 @@ class _AttachmentPickerState extends State { if (pickedFile != null) { File fileImage = File(pickedFile.path); - widget.attachment.add(GenericAttachmentModel(id: 0,name: fileImage.path)); + widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path)); if (widget.onChange != null) { widget.onChange!(widget.attachment); } @@ -476,32 +480,7 @@ class _AttachmentPickerState extends State { ); }, ); - // ImageSource source = await showDialog( - // context: context, - // builder: (dialogContext) => CupertinoAlertDialog( - // actions: [ - // TextButton( - // child: Text(context.translation.pickFromCamera), - // onPressed: () { - // Navigator.of(dialogContext).pop(ImageSource.camera); - // }, - // ), - // TextButton( - // child: Text(context.translation.pickFromGallery), - // onPressed: () { - // Navigator.of(dialogContext).pop(ImageSource.gallery); - // }, - // ), - // TextButton( - // child: Text(context.translation.pickFromFiles), - // onPressed: () async { - // await fromFilePicker(); - // Navigator.pop(context); - // }, - // ), - // ], - // ), - // ); + if (source == null) return; final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);