From c4efbba6a866e7e9c3432d967a0cb77ccaf291d0 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 18 Aug 2025 16:37:08 +0300 Subject: [PATCH] ui fixes --- .../forms/asset_retired/asset_retired.dart | 152 +++++++++--------- .../asset_retired/verify_asset_detail.dart | 8 +- .../forms/cost/cost_detail_form_screen.dart | 6 +- .../tm_module/tasks_wo/create_task_view.dart | 140 ++++++++-------- 4 files changed, 151 insertions(+), 155 deletions(-) diff --git a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart index 9341f72f..d16cd01c 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/asset_retired.dart @@ -60,84 +60,82 @@ class _AssetRetiredState extends State with TickerProviderStateMix key: _scaffoldKey, appBar: DefaultAppBar(title: context.translation.assetToBeRetired), body: Consumer(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) { - return SafeArea( - child: LoadingManager( - isLoading: _isLoading, - isFailedLoading: false, - stateCode: 200, - onRefresh: () async {}, - child: Form( - key: _formKey, - child: Column( - children: [ - SingleChildScrollView( - child: Card( - child: Column( - children: [ - SingleItemDropDownMenu( - context: context, - title: context.translation.retirementType, - backgroundColor: AppColor.fieldBgColor(context), - showAsBottomSheet: true, - height: 56.toScreenHeight, - showShadow: false, - initialValue: requestDetailProvider.assetRetiredHelperModel?.retirmentReason, - onSelect: (value) { - if (value != null) { - requestDetailProvider.assetRetiredHelperModel?.retirmentReason = value; - setState(() {}); - } - }, - ), - 8.height, - AppTextFormField( - labelText: context.translation.comments, - textInputType: TextInputType.multiline, - showWithoutDecoration: true, - labelStyle: AppTextStyles.textFieldLabelStyle, - backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral100, - alignLabelWithHint: true, - onChange: (text) { - requestDetailProvider.assetRetiredHelperModel?.retirementComment = text; - }, - onSaved: (text) { - requestDetailProvider.assetRetiredHelperModel?.retirementComment = text; - }, - ), - 23.height, - AttachmentPicker( - label: context.translation.attachFiles, - attachment: attachments, - buttonIcon: 'image-plus'.toSvgAsset(), - ), - ], - ).paddingOnly(start: 13, end: 13, top: 14, bottom: 16), - ).paddingAll(16), - ).expanded, - FooterActionButton.footerContainer( - context: context, - child: AppFilledButton( - label: context.translation.submit, - buttonColor: AppColor.primary10, - loading: requestDetailProvider.isLoading, - onPressed: () async { - requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = []; - for (var attachment in attachments) { - String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??''; - requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments - ?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName)); - } - int status = await requestDetailProvider.createActivityAssetToBeRetired(); - if (status == 200) { - Navigator.pop(context); - requestDetailProvider.stopTimer(); - const SizedBox().flushBar(context: context, title: '', message: context.translation.assetRetirementRequestSubmittedSuccessfully); - } - }, - ), + return LoadingManager( + isLoading: _isLoading, + isFailedLoading: false, + stateCode: 200, + onRefresh: () async {}, + child: Form( + key: _formKey, + child: Column( + children: [ + SingleChildScrollView( + child: Card( + child: Column( + children: [ + SingleItemDropDownMenu( + context: context, + title: context.translation.retirementType, + backgroundColor: AppColor.fieldBgColor(context), + showAsBottomSheet: true, + height: 56.toScreenHeight, + showShadow: false, + initialValue: requestDetailProvider.assetRetiredHelperModel?.retirmentReason, + onSelect: (value) { + if (value != null) { + requestDetailProvider.assetRetiredHelperModel?.retirmentReason = value; + setState(() {}); + } + }, + ), + 8.height, + AppTextFormField( + labelText: context.translation.comments, + textInputType: TextInputType.multiline, + showWithoutDecoration: true, + labelStyle: AppTextStyles.textFieldLabelStyle, + backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral100, + alignLabelWithHint: true, + onChange: (text) { + requestDetailProvider.assetRetiredHelperModel?.retirementComment = text; + }, + onSaved: (text) { + requestDetailProvider.assetRetiredHelperModel?.retirementComment = text; + }, + ), + 23.height, + AttachmentPicker( + label: context.translation.attachFiles, + attachment: attachments, + buttonIcon: 'image-plus'.toSvgAsset(), + ), + ], + ).paddingOnly(start: 13, end: 13, top: 14, bottom: 16), + ).paddingAll(16), + ).expanded, + FooterActionButton.footerContainer( + context: context, + child: AppFilledButton( + label: context.translation.submit, + buttonColor: AppColor.primary10, + loading: requestDetailProvider.isLoading, + onPressed: () async { + requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = []; + for (var attachment in attachments) { + String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??''; + requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments + ?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName)); + } + int status = await requestDetailProvider.createActivityAssetToBeRetired(); + if (status == 200) { + Navigator.pop(context); + requestDetailProvider.stopTimer(); + const SizedBox().flushBar(context: context, title: '', message: context.translation.assetRetirementRequestSubmittedSuccessfully); + } + }, ), - ], - ), + ), + ], ), ), ); diff --git a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart index de5372cf..c16b1309 100644 --- a/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart +++ b/lib/modules/cm_module/views/forms/asset_retired/verify_asset_detail.dart @@ -13,6 +13,7 @@ import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_mo import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/work_order_detail_model.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; +import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart'; @@ -328,10 +329,9 @@ class _VerifyAssetDetailsState extends State with TickerProv ] else ...[ assetStatusWidget(context: context, workOrderData: updateAssetModel!).toShadowContainer(context).paddingAll(16), ], - Container( - padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), - color: AppColor.background(context), - child: AppFilledButton( + FooterActionButton.footerContainer( + context: context, + child:AppFilledButton( label: context.translation.updateAssetDetails, buttonColor: AppColor.primary10, onPressed: () async { diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index 50080d8d..1ba3f8dc 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -7,6 +7,7 @@ import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart'; import 'package:test_sa/models/new_models/work_order_detail_model.dart'; import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart'; +import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart'; @@ -185,9 +186,8 @@ class _CostDetailFormScreenState extends State with Ticker ], ).toShadowContainer(context).paddingAll(16), ).expanded, - Container( - padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight), - color: AppColor.background(context), + FooterActionButton.footerContainer( + context: context, child: AppFilledButton( label: "Update Cost Details", buttonColor: AppColor.primary10, diff --git a/lib/modules/tm_module/tasks_wo/create_task_view.dart b/lib/modules/tm_module/tasks_wo/create_task_view.dart index f042f489..906975c7 100644 --- a/lib/modules/tm_module/tasks_wo/create_task_view.dart +++ b/lib/modules/tm_module/tasks_wo/create_task_view.dart @@ -65,80 +65,78 @@ class _CreateTaskViewState extends State with TickerProviderStat return Scaffold( key: _scaffoldKey, appBar: DefaultAppBar(title: context.translation.createTaskRequest), - body: SafeArea( - child: Form( - key: _formKey, - child: Column( - children: [ - SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SingleItemDropDownMenu( - context: context, - height: 56.toScreenHeight, - title: context.translation.taskType, - showShadow: false, - backgroundColor: AppColor.neutral100, - showAsBottomSheet: true, - initialValue: selectedType, - onSelect: (type) { - if (type != null) { - selectedType = type; - _addTaskModel = AddTaskModel(id: 0); - commentController.clear(); - _addTaskModel?.taskTypeId = selectedType?.id; - setState(() {}); - } - }, - ), - 8.height, - taskTypeWidget(selectedType?.relatedTo?.value), - 8.height, - if (selectedType != null && selectedType!.isRecallAndAlert!) ...[ - recallAndAlert(), - ], - 8.height, - AppTextFormField( - initialValue: _addTaskModel?.callComment, - controller: commentController, - labelText: context.translation.callComments, - backgroundColor: AppColor.neutral100, - showShadow: false, - labelStyle: AppTextStyles.textFieldLabelStyle, - alignLabelWithHint: true, - textInputType: TextInputType.multiline, - onChange: (value) { - _addTaskModel?.callComment = value; - }, - ), - 23.height, - AttachmentPicker( - label: context.translation.attachImage, - attachment: attachments, - buttonColor: AppColor.black10, - onlyImages: false, - buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), - //verify this if not required delete this .. - onChange: (attachments) { - attachments = attachments; + body: Form( + key: _formKey, + child: Column( + children: [ + SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SingleItemDropDownMenu( + context: context, + height: 56.toScreenHeight, + title: context.translation.taskType, + showShadow: false, + backgroundColor: AppColor.neutral100, + showAsBottomSheet: true, + initialValue: selectedType, + onSelect: (type) { + if (type != null) { + selectedType = type; + _addTaskModel = AddTaskModel(id: 0); + commentController.clear(); + _addTaskModel?.taskTypeId = selectedType?.id; setState(() {}); - }, - ), + } + }, + ), + 8.height, + taskTypeWidget(selectedType?.relatedTo?.value), + 8.height, + if (selectedType != null && selectedType!.isRecallAndAlert!) ...[ + recallAndAlert(), ], - ).toShadowContainer(context).paddingAll(16), - ).expanded, - FooterActionButton.footerContainer( - context: context, - child: AppFilledButton( - buttonColor: AppColor.primary10, - label: context.translation.submitRequest, - onPressed: _submit, - // buttonColor: AppColor.primary10, - ), + 8.height, + AppTextFormField( + initialValue: _addTaskModel?.callComment, + controller: commentController, + labelText: context.translation.callComments, + backgroundColor: AppColor.neutral100, + showShadow: false, + labelStyle: AppTextStyles.textFieldLabelStyle, + alignLabelWithHint: true, + textInputType: TextInputType.multiline, + onChange: (value) { + _addTaskModel?.callComment = value; + }, + ), + 23.height, + AttachmentPicker( + label: context.translation.attachImage, + attachment: attachments, + buttonColor: AppColor.black10, + onlyImages: false, + buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120), + //verify this if not required delete this .. + onChange: (attachments) { + attachments = attachments; + setState(() {}); + }, + ), + ], + ).toShadowContainer(context).paddingAll(16), + ).expanded, + FooterActionButton.footerContainer( + context: context, + child: AppFilledButton( + buttonColor: AppColor.primary10, + label: context.translation.submitRequest, + onPressed: _submit, + // buttonColor: AppColor.primary10, ), - ], - ), + ), + ], ), ), );