|
@@ -0,0 +1,912 @@
|
|
|
+import 'package:cs_resources/constants/color_constants.dart';
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:domain/entity/response/uk_labour_request_detail_entity.dart';
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter/services.dart';
|
|
|
+import 'package:plugin_basic/basic_export.dart';
|
|
|
+import 'package:shared/utils/date_time_utils.dart';
|
|
|
+import 'package:shared/utils/log_utils.dart';
|
|
|
+import 'package:shared/utils/util.dart';
|
|
|
+import 'package:widgets/ext/ex_widget.dart';
|
|
|
+import 'package:widgets/my_button.dart';
|
|
|
+import 'package:widgets/my_load_image.dart';
|
|
|
+import 'package:widgets/my_text_view.dart';
|
|
|
+import 'package:widgets/shatter/form_require_text.dart';
|
|
|
+import 'package:widgets/shatter/round_my_text_field.dart';
|
|
|
+import 'package:widgets/widget_export.dart';
|
|
|
+
|
|
|
+import 'labour_request_interface.dart';
|
|
|
+
|
|
|
+class CommonLabourRequestFormFields extends StatelessWidget {
|
|
|
+ final CommonLabourRequestController controller;
|
|
|
+
|
|
|
+ const CommonLabourRequestFormFields({Key? key, required this.controller}) : super(key: key);
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ final state = controller.commonState;
|
|
|
+ Log.d("--当前的useInSence--- ${state.useInSence}");
|
|
|
+ Log.d("--当前的pageType(0新增 1编辑 2详情)--- ${state.pageType}");
|
|
|
+
|
|
|
+ bool? isLabourRequestModule = state.useInSence == 'labour_request' ? true : false;
|
|
|
+ bool? isLabourRequestReviewModule = state.useInSence == 'labour_request_review' ? true : false;
|
|
|
+ bool? isAddAction = state.pageType == 0 ? true : false;
|
|
|
+ bool? isEditAction = state.pageType == 1 ? true : false;
|
|
|
+ bool? isDetailAction = state.pageType == 2 ? true : false;
|
|
|
+
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //工作标题,选择模板
|
|
|
+ FormRequireText(
|
|
|
+ text: "Job Title".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+
|
|
|
+ //工作标题
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedTemplateId == null || state.selectedTemplateId == "0"
|
|
|
+ ? ""
|
|
|
+ : state.templateList!
|
|
|
+ .firstWhere((element) => element.value.toString() == state.selectedTemplateId,
|
|
|
+ orElse: () => UkLabourRequestDetailTemplateList())
|
|
|
+ .txt ??
|
|
|
+ "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Job Title".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickJobTitle();
|
|
|
+ }),
|
|
|
+
|
|
|
+ if(isAddAction)
|
|
|
+ // 新增时 工作时间筛选
|
|
|
+ _getAddChooseDateAndTimeWidget(context, controller, true)
|
|
|
+ else
|
|
|
+ // 编辑 和 详情时 工作时间筛选
|
|
|
+ _getEditOrDetailDateAndTimeWidget(context, controller, isEditAction, isDetailAction),
|
|
|
+
|
|
|
+ //工作选择部门
|
|
|
+ FormRequireText(
|
|
|
+ text: "Outlet".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+
|
|
|
+ //选择部门
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedDepartmentId == null || state.selectedDepartmentId == "0"
|
|
|
+ ? ""
|
|
|
+ : state.departmentList!
|
|
|
+ .firstWhere((element) => element.value.toString() == state.selectedDepartmentId,
|
|
|
+ orElse: () => UkLabourRequestDetailDepartmentList())
|
|
|
+ .txt ??
|
|
|
+ "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Outlet".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickDepartment();
|
|
|
+ }),
|
|
|
+
|
|
|
+ //需要的人数
|
|
|
+ FormRequireText(
|
|
|
+ text: "No. of Staff".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+
|
|
|
+ //输入框(只允许输入数字)
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "no_of_staff",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ enabled: state.pageType != 2,
|
|
|
+ inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
|
|
|
+ textInputType: TextInputType.number,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.done,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ },
|
|
|
+ marginTop: 10,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //选择是否需要输入金额
|
|
|
+ Visibility(
|
|
|
+ visible: state.labReqOption?.serviceType == 1,
|
|
|
+ child: FormRequireText(
|
|
|
+ text: "Amount".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ ),
|
|
|
+
|
|
|
+ Visibility(
|
|
|
+ visible: state.labReqOption?.serviceType == 1,
|
|
|
+ child: CustomTextField(
|
|
|
+ formKey: "amount",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ enabled: state.pageType != 2,
|
|
|
+ textInputType: TextInputType.number,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.done,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ },
|
|
|
+ marginTop: 10,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+
|
|
|
+ // 选择预选人
|
|
|
+ Visibility(
|
|
|
+ visible: isAddAction,
|
|
|
+ child: FormRequireText(
|
|
|
+ text: "Pre Selectd".tr,
|
|
|
+ isRequired: false,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ ),
|
|
|
+
|
|
|
+ //重复的预选人
|
|
|
+ Visibility(
|
|
|
+ visible: isAddAction,
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10, top: 5, bottom: 5),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //横向的流式布局
|
|
|
+ Expanded(
|
|
|
+ child: Wrap(
|
|
|
+ spacing: 8.0, // 子组件之间的水平间距
|
|
|
+ runSpacing: 5.0, // 子组件之间的垂直间距
|
|
|
+ children: state.preSelectedNames == null
|
|
|
+ ? [
|
|
|
+ MyTextView(
|
|
|
+ "",
|
|
|
+ textColor: Colors.white,
|
|
|
+ isFontRegular: true,
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Pre Selected".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ paddingTop: 5,
|
|
|
+ paddingBottom: 5,
|
|
|
+ paddingLeft: 7.5,
|
|
|
+ paddingRight: 7.5,
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ : List.generate(state.preSelectedNames!.split(",").length, (index) {
|
|
|
+ return MyTextView(
|
|
|
+ state.preSelectedNames!.split(",")[index],
|
|
|
+ textColor: Colors.white,
|
|
|
+ isFontRegular: true,
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Pre Selected".tr,
|
|
|
+ backgroundColor: ColorConstants.string2Color('#0AC074'),
|
|
|
+ paddingTop: 5,
|
|
|
+ paddingBottom: 5,
|
|
|
+ paddingLeft: 7.5,
|
|
|
+ paddingRight: 7.5,
|
|
|
+ cornerRadius: 5.0,
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+ const SizedBox(width: 10),
|
|
|
+
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: !isDetailAction,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).constrained(minHeight: 60).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.handlerSelectPreSelect();
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+
|
|
|
+
|
|
|
+ // Type 选项 employment list
|
|
|
+ FormRequireText(
|
|
|
+ text: "Choose Type".tr,
|
|
|
+ isRequired: false,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(isDetailAction ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedTypeId == null || state.selectedTypeId == "0"
|
|
|
+ ? ""
|
|
|
+ : state.employmentList!
|
|
|
+ .firstWhere((element) => element.value.toString() == state.selectedTypeId,
|
|
|
+ orElse: () => UkLabourRequestDetailEmploymentList())
|
|
|
+ .txt ??
|
|
|
+ "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Type".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: !isDetailAction,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickEmploymentType();
|
|
|
+ }),
|
|
|
+
|
|
|
+ //Event
|
|
|
+ MyTextView(
|
|
|
+ "I.Event".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "event",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.text,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['event_type']!['focusNode']);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //Event Type
|
|
|
+ MyTextView(
|
|
|
+ "II.Event Type".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "event_type",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.text,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['event_pax']!['focusNode']);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //Event Pax
|
|
|
+ MyTextView(
|
|
|
+ "III.Event Pax".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "event_pax",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.number,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['revenue']!['focusNode']);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //Revenue
|
|
|
+ MyTextView(
|
|
|
+ "IV.Estimated Revenue".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "revenue",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction ? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.number,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['position']!['focusNode']);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //Position
|
|
|
+ MyTextView(
|
|
|
+ "V.Position".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "position",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction ? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.text,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['total_cost']!['focusNode']);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //total_cost
|
|
|
+ MyTextView(
|
|
|
+ "VI.Estimated Total Cost".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "total_cost",
|
|
|
+ marginLeft: 0,
|
|
|
+ marginRight: 0,
|
|
|
+ paddingTop: 0,
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginTop: 10,
|
|
|
+ height: 45,
|
|
|
+ fillBackgroundColor: const Color(0xFF4DCFF6).withOpacity(isDetailAction? 0.5 : 0.2),
|
|
|
+ enabled: !isDetailAction,
|
|
|
+ textInputType: TextInputType.number,
|
|
|
+ formData: state.formData,
|
|
|
+ textInputAction: TextInputAction.done,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+
|
|
|
+ //输入Remark
|
|
|
+ MyTextView(
|
|
|
+ "Remark".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ IgnoreKeyboardDismiss(
|
|
|
+ child: Container(
|
|
|
+ height: 160,
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(isDetailAction == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: TextField(
|
|
|
+ cursorColor: ColorConstants.white,
|
|
|
+ cursorWidth: 1.5,
|
|
|
+ autofocus: false,
|
|
|
+ enabled: isAddAction || isEditAction,
|
|
|
+ focusNode: state.formData["remark"]!['focusNode'],
|
|
|
+ controller: state.formData["remark"]!['controller'],
|
|
|
+ // 装饰
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ isCollapsed: true,
|
|
|
+ border: InputBorder.none,
|
|
|
+ hintText: state.formData["remark"]!['hintText'],
|
|
|
+ hintStyle: const TextStyle(
|
|
|
+ color: ColorConstants.textGrayAECAE5,
|
|
|
+ fontSize: 15.0,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ style: const TextStyle(
|
|
|
+ color: ColorConstants.white,
|
|
|
+ fontSize: 15.0,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ // 键盘动作右下角图标
|
|
|
+ textInputAction: TextInputAction.done,
|
|
|
+ onSubmitted: (value) {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+ // 附件
|
|
|
+ _buildAttachFileWidget(context, controller, isAddAction, isEditAction, isDetailAction),
|
|
|
+
|
|
|
+ const SizedBox(height: 30),
|
|
|
+
|
|
|
+ //提交按钮
|
|
|
+ Visibility(
|
|
|
+ visible: !isDetailAction,
|
|
|
+ child: MyButton(
|
|
|
+ type: ClickType.throttle,
|
|
|
+ milliseconds: 500,
|
|
|
+ onPressed: () {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.doSubmit();
|
|
|
+ },
|
|
|
+ text: "Submit".tr,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ fontSize: 16,
|
|
|
+ radius: 22.5,
|
|
|
+ backgroundColor: hexToColor("#FFBB1B"),
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ).marginSymmetric(horizontal: 0, vertical: 30),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增 时 的 选择日期 选择开始时间 选择结束时间
|
|
|
+ Widget _getAddChooseDateAndTimeWidget(BuildContext context, CommonLabourRequestController controller, bool isAdd){
|
|
|
+ final state = controller.commonState;
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //开始时间
|
|
|
+ FormRequireText(
|
|
|
+ text: "Job Date".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ //选择开始日期
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedDate == null ? "" : DateTimeUtils.formatDate(state.selectedDate, format: 'yyyy-MM-dd'),
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Job Date".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickJobDate();
|
|
|
+ }),
|
|
|
+ // 开始时间 - 结束时间
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedStartTime == null ? "" : DateTimeUtils.formatDate(state.selectedStartTime, format: 'HH:mm'),
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Job Start Time".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickStartTime();
|
|
|
+ }).expanded(),
|
|
|
+
|
|
|
+ //分割线
|
|
|
+ MyTextView(
|
|
|
+ "-",
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginLeft: 10,
|
|
|
+ marginRight: 10,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //结束时间
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.selectedEndTime == null ? "" : DateTimeUtils.formatDate(state.selectedEndTime, format: 'HH:mm'),
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Job End Time".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickEndTime();
|
|
|
+ }).expanded(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+
|
|
|
+
|
|
|
+ //重复的日期
|
|
|
+ MyTextView(
|
|
|
+ "Repeat Date".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ textColor: Colors.white,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ //重复的日期区间
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10, top: 5, bottom: 5),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(state.pageType == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //横向的流式布局
|
|
|
+ Expanded(
|
|
|
+ child: Wrap(
|
|
|
+ spacing: 8.0, // 子组件之间的水平间距
|
|
|
+ runSpacing: 5.0, // 子组件之间的垂直间距
|
|
|
+ children: state.repeatDateStr == null
|
|
|
+ ? [
|
|
|
+ MyTextView(
|
|
|
+ "",
|
|
|
+ textColor: Colors.white,
|
|
|
+ isFontRegular: true,
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Repeat Date".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ paddingTop: 5,
|
|
|
+ paddingBottom: 5,
|
|
|
+ paddingLeft: 7.5,
|
|
|
+ paddingRight: 7.5,
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ : List.generate(state.repeatDateStr!.split(",").length, (index) {
|
|
|
+ return MyTextView(
|
|
|
+ state.repeatDateStr!.split(",")[index],
|
|
|
+ textColor: Colors.white,
|
|
|
+ isFontRegular: true,
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Repeat Date".tr,
|
|
|
+ backgroundColor: ColorConstants.string2Color('#0AC074'),
|
|
|
+ paddingTop: 5,
|
|
|
+ paddingBottom: 5,
|
|
|
+ paddingLeft: 7.5,
|
|
|
+ paddingRight: 7.5,
|
|
|
+ cornerRadius: 5.0,
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+ const SizedBox(width: 10),
|
|
|
+
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).constrained(minHeight: 60).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickDateRange();
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 编辑/详情 的 时间区域
|
|
|
+ Widget _getEditOrDetailDateAndTimeWidget(BuildContext context, CommonLabourRequestController controller, bool isEdit, bool isDetail){
|
|
|
+ final state = controller.commonState;
|
|
|
+ // Log.d("-------${state.jobStart}---${state.jobEnd}");
|
|
|
+ // String jobSelectJobStart = state.jobStart !=null? DateTimeUtils.formatDate(state.jobStart!, format: 'yyyy-MM-dd HH:mm'):"";
|
|
|
+ // String jobSelectJobEnd = state.jobEnd !=null? DateTimeUtils.formatDate(state.jobEnd!, format: 'yyyy-MM-dd HH:mm'):"";
|
|
|
+
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ FormRequireText(
|
|
|
+ text: "Start Time".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ //开始时间
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(isDetail ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.jobSelectJobStart?? "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Start Time".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickJobStart();
|
|
|
+ }),
|
|
|
+
|
|
|
+
|
|
|
+ FormRequireText(
|
|
|
+ text: "End Time".tr,
|
|
|
+ ).marginOnly(top: 15),
|
|
|
+ //结束时间
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16, right: 10),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(isDetail ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ state.jobSelectJobEnd?? "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "End Time".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+ //下拉选图标
|
|
|
+ Visibility(
|
|
|
+ visible: state.pageType != 2,
|
|
|
+ child: const MyAssetImage(Assets.baseServiceTriangleDropDownIcon, width: 11.5, height: 6.28),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ).onTap(() {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.pickJobEnd();
|
|
|
+ }),
|
|
|
+ ]
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 附件
|
|
|
+ Widget _buildAttachFileWidget(BuildContext context, CommonLabourRequestController controller,bool isAdd, bool isEdit, bool isDetail){
|
|
|
+ final state = controller.commonState;
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //附件文件
|
|
|
+ MyTextView(
|
|
|
+ "Attachment".tr,
|
|
|
+ fontSize: 15,
|
|
|
+ isFontRegular: true,
|
|
|
+ textColor: Colors.white,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+
|
|
|
+ // 显示和选择附件
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.only(left: 16),
|
|
|
+ margin: const EdgeInsets.only(top: 10),
|
|
|
+ height: 45,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(isDetail == 2 ? 0.5 : 0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ Utils.isNotEmpty(state.attFilePath) ? Uri.parse(state.attFilePath!).pathSegments.last : "",
|
|
|
+ fontSize: 14,
|
|
|
+ hint: "Choose Attachment".tr,
|
|
|
+ textHintColor: ColorConstants.textGrayAECAE5,
|
|
|
+ isFontMedium: true,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ ).expanded(),
|
|
|
+
|
|
|
+ // 上传附件的图标
|
|
|
+ Visibility(
|
|
|
+ visible: !isDetail,
|
|
|
+ child: MyTextView(
|
|
|
+ 'Upload'.tr,
|
|
|
+ boxHeight: 45,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ boxWidth: 90,
|
|
|
+ cornerRadius: 5,
|
|
|
+ onClick: controller.pickAttFile,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 15,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ backgroundColor: ColorConstants.textGreen0AC074,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|