Browse Source

评价的状态控制

liukai 2 months ago
parent
commit
f366cc8b5a

+ 16 - 14
packages/cpt_job_sg/lib/modules/job_applied/applied_staff_reviews.dart

@@ -15,7 +15,7 @@ import 'package:widgets/my_text_view.dart';
 import 'package:widgets/shatter/rating_widget.dart';
 import 'package:widgets/widget_export.dart';
 
-/**
+/*
  * 员工的评价弹窗
  */
 class AppliedStaffReviews extends StatefulWidget {
@@ -61,9 +61,9 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
         //Title (如果使用 Container 为最外层容器则默认为 match_parent 的效果,除非我们限制宽度和最大高度最小高度)
         Container(
           width: double.infinity,
-          decoration: BoxDecoration(
+          decoration: const BoxDecoration(
             color: Colors.white,
-            borderRadius: const BorderRadius.all(Radius.circular(15)),
+            borderRadius: BorderRadius.all(Radius.circular(15)),
           ),
           child: Column(
             crossAxisAlignment: CrossAxisAlignment.start,
@@ -189,12 +189,12 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
               IgnoreKeyboardDismiss(
                 child: Container(
                   height: 130,
-                  margin: EdgeInsets.symmetric(vertical: 19, horizontal: 22),
-                  padding: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
+                  margin: const EdgeInsets.symmetric(vertical: 19, horizontal: 22),
+                  padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
                   decoration: BoxDecoration(
-                    color: Color(0xFFF0F0F0),
+                    color: const Color(0xFFF0F0F0),
                     border: Border.all(
-                      color: Color(0xFFD8D8D8),
+                      color: const Color(0xFFD8D8D8),
                       width: 0.5,
                     ),
                   ),
@@ -211,13 +211,13 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
                       isCollapsed: true,
                       border: InputBorder.none,
                       hintText: "Enter...".tr,
-                      hintStyle: TextStyle(
+                      hintStyle: const TextStyle(
                         color: ColorConstants.black66,
                         fontSize: 15.0,
                         fontWeight: FontWeight.w400,
                       ),
                     ),
-                    style: TextStyle(
+                    style: const TextStyle(
                       color: ColorConstants.black,
                       fontSize: 15.0,
                       fontWeight: FontWeight.w400,
@@ -233,7 +233,7 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
 
               // 分割线
               Container(
-                color: Color(0XFFCECECE),
+                color: const Color(0XFFCECECE),
                 height: 0.5,
               ),
 
@@ -251,20 +251,22 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
                           fontSize: 17.5,
                           isFontMedium: true,
                           textAlign: TextAlign.center,
-                          textColor: Color(0XFF0085C4),
+                          textColor: const Color(0XFF0085C4),
                           cornerRadius: 3,
                           borderWidth: 1,
                         ),
                       )),
                   Container(
-                    color: Color(0xff09141F).withOpacity(0.13),
+                    color: const Color(0xff09141F).withOpacity(0.13),
                     width: 0.5,
                   ),
                   Expanded(
                       flex: 1,
                       child: InkWell(
                         onTap: () {
-                          doCallbackAction();
+                          if (Utils.isEmpty(reviews.feedback)) {
+                            doCallbackAction();
+                          }
                         },
                         child: MyTextView(
                           "Submit".tr,
@@ -272,7 +274,7 @@ class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
                           fontSize: 17.5,
                           isFontMedium: true,
                           textAlign: TextAlign.center,
-                          textColor: Color(0XFF0085C4),
+                          textColor: Utils.isEmpty(reviews.feedback) ? const Color(0XFF0085C4) : ColorConstants.gray88,
                           cornerRadius: 3,
                         ),
                       )),

+ 14 - 4
packages/cpt_labour_sg/lib/modules/job_list_edit/job_list_edit_controller.dart

@@ -55,7 +55,6 @@ class JobListEditController extends GetxController with DioCancelableMixin {
 
 
       update();
-      update(["position"]);
     } else {
       ToastEngine.show(result.errorMsg ?? "Network Load Error".tr);
     }
@@ -144,14 +143,25 @@ class JobListEditController extends GetxController with DioCancelableMixin {
 
     if (selectedIndex < 0) {
       selectedIndex = 0;
+    } else {
+      selectedIndex++;
     }
 
+    List<String> list = ["Position"];
+    list.addAll(state.editEntity!.positionList.map((e) => e.txt!).toList(growable: false));
+
     OptionPickerUtil.showCupertinoOptionPicker(
-      items: state.editEntity!.positionList.map((e) => e.txt!).toList(growable: false),
+      items: list,
       initialSelectIndex: selectedIndex,
       onPickerChanged: (_, index) {
-        state.selectPositionId = state.editEntity!.positionList[index].value!.toString();
-        state.selectPositionName = state.editEntity!.positionList[index].txt!.toString();
+        if (index == 0) {
+          state.selectPositionId = null;
+          state.selectPositionName = null;
+        } else {
+          state.selectPositionId = state.editEntity!.positionList[index - 1].value!.toString();
+          state.selectPositionName = state.editEntity!.positionList[index - 1].txt!.toString();
+        }
+
         update();
       },
     );

+ 14 - 4
packages/cpt_labour_sg/lib/modules/labour_request_add/labour_request_add_controller.dart

@@ -246,17 +246,27 @@ class LabourRequestAddController extends GetxController with DioCancelableMixin
 
     if (selectedIndex < 0) {
       selectedIndex = 0;
+    } else {
+      selectedIndex++;
     }
 
+    List<String> list = ["Position"];
+    list.addAll(state.indexEntity!.positionList.map((e) => e.txt!).toList(growable: false));
+
     OptionPickerUtil.showCupertinoOptionPicker(
-      items: state.indexEntity!.positionList.map((e) => e.txt!).toList(growable: false),
+      items: list,
       initialSelectIndex: selectedIndex,
       onPickerChanged: (_, index) {
-        state.selectPositionId = state.indexEntity!.positionList[index].value!.toString();
-        state.selectPositionName = state.indexEntity!.positionList[index].txt!.toString();
+        if (index == 0) {
+          state.selectPositionId = null;
+          state.selectPositionName = null;
+        } else {
+          state.selectPositionId = state.indexEntity!.positionList[index - 1].value!.toString();
+          state.selectPositionName = state.indexEntity!.positionList[index - 1].txt!.toString();
+        }
+
         update();
       },
     );
   }
-
 }