glglove vor 1 Monat
Ursprung
Commit
792a16c7e2

+ 200 - 0
packages/cpt_services/lib/components/repair_status_card_item.dart

@@ -0,0 +1,200 @@
+import 'package:cpt_services/components/status_card_item_vm.dart';
+import 'package:cpt_services/modules/services/homeService/home_service_page.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/ext_dart.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_button.dart';
+import 'package:widgets/my_text_view.dart';
+
+import '../constants_services.dart';
+
+class RepairStausCardItem extends HookConsumerWidget {
+  int serviceId;
+  int serviceTypeCode;
+  int serviceStatusCode;
+  Map<String, dynamic> itemObj;
+  double? cardHeight ;
+  final Function(dynamic)? onClickCard;
+
+  RepairStausCardItem({
+    Key? key,
+    required this.serviceId,
+    required this.serviceTypeCode,
+    required this.serviceStatusCode,
+    required this.itemObj,
+    this.onClickCard,
+    cardHeight,
+  }): super(key: key) {
+    this.cardHeight = cardHeight ?? 180.0;
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(statusCardItemVmProvider.notifier);
+
+    final title = itemObj.getValue("title", "Repair air Conditioner");
+    final companyName = itemObj.getValue("company_name", "HONG YE GROUP PTE LTD");
+
+    Log.d("serviceStatusCode $serviceStatusCode");
+
+    bool isCompletedStatus = servicesConstants.servicesStatus['$serviceStatusCode']['code'] == 2? true:false;
+    String status_text = servicesConstants.servicesStatus['$serviceStatusCode']['text'];
+
+    // final status_text = itemObj.getValue("status_text", "");
+
+    // List<Map<String, dynamic>>? actionBtnList = servicesConstants.servicesStatusActionBtnList[serviceStatusCode];
+    // Log.d("actionBtnList   $actionBtnList");
+
+    useEffect((){
+      vm.setInitData(context, serviceId, serviceTypeCode, serviceStatusCode);
+      return () {
+      };
+    },[]);
+    return Container(
+      width: double.infinity,
+      height: cardHeight!,
+      child: Padding(
+        padding: const EdgeInsets.only(left: 18.0, right: 18.0, top: 22.0, bottom: 22.0),
+        child: Column(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: [
+            Expanded(
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    // 标题 和状态
+                    Row(
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                      children: [
+                        // 标题
+                        Expanded(
+                          child: MyTextView(
+                            title,
+                            fontSize: 16,
+                            maxLines: 1,
+                            isFontMedium: true,
+                            textAlign: TextAlign.left,
+                          ),
+                        ),
+                        // 状态
+                        MyTextView(
+                          status_text,
+                          fontSize: 14,
+                          maxLines: 1,
+                          isFontRegular: true,
+                          textAlign: TextAlign.left,
+                          textColor: context.appColors.textPrimary,
+                        ),
+                      ],
+                    ),
+                    // 公司名称
+                    MyTextView(
+                      companyName,
+                      fontSize: 14,
+                      maxLines: 1,
+                      isFontRegular: true,
+                      textAlign: TextAlign.left,
+                      marginTop: 6,
+                    ),
+                    MyTextView(
+                      'The staff will contact you soon',
+                      fontSize: 14,
+                      maxLines: 1,
+                      isFontRegular: true,
+                      textAlign: TextAlign.left,
+                      textColor: context.appColors.textDarkGray999,
+                      marginTop: 5,
+                    ),
+                    isCompletedStatus? Row(
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                      children: [
+                        Expanded(
+                          child: MyTextView(
+                            'Processing Time',
+                            fontSize: 14,
+                            maxLines: 1,
+                            isFontRegular: true,
+                            textAlign: TextAlign.left,
+                            textColor: context.appColors.textBlack,
+                            marginTop: 5,
+                          ),
+                        ),
+                        Expanded(
+                          child: MyTextView(
+                            '13 0ct 2024 12:00',
+                            fontSize: 14,
+                            maxLines: 1,
+                            isFontRegular: true,
+                            textAlign: TextAlign.end,
+                            textColor: context.appColors.textBlack,
+                            marginTop: 5,
+                          ),
+                        )
+                      ],
+                    ): SizedBox.shrink(),
+                  ],
+                )
+            ),
+            // Container(
+            // margin: EdgeInsets.only(top: 15),
+            // child: _buildActionSection(context,actionBtnList!, vm, ref),
+            // ),
+          ],
+        ),
+      ),
+    );
+  }
+
+  Widget _buildActionSection(BuildContext context,List<Map<String, dynamic>> actionBtnList, StatusCardItemVm vm, WidgetRef ref ) {
+    return LayoutBuilder(
+        builder: (BuildContext context, BoxConstraints constraints) {
+          final maxHeight = constraints.maxHeight;
+          final minHeight = constraints.minHeight;
+          final maxWidth = constraints.maxWidth;
+          // Log.d("---maxHeight-----$maxHeight-- $minHeight  $maxWidth--");
+          return Container(
+            height: 50,
+            // color: Colors.red,
+            width: maxWidth,
+            child: Row(
+                mainAxisAlignment: MainAxisAlignment.end,
+                mainAxisSize: MainAxisSize.max,
+                children: List.generate(actionBtnList.length, (index){
+                  var item = actionBtnList[index];
+                  // return Expanded(
+                  //   child: _buildBtn(context, item),
+                  // );
+                  return _buildBtn(context, item, vm, ref);
+                })
+            ),
+          ).scrollable(
+            scrollDirection: Axis.horizontal,
+            physics: BouncingScrollPhysics(),
+          );
+        }
+    );
+  }
+
+  Widget _buildBtn(BuildContext context, Map<String, dynamic> btnItem, StatusCardItemVm vm, WidgetRef ref) {
+    // final btnCode = btnItem['code'];
+    return MyButton(
+      onPressed: (){
+        vm.handlerClickActionBtn(context, btnItem);
+      },
+      text: btnItem['text'],
+      radius: 10.0,
+      textColor: context.appColors.textWhite,
+      backgroundColor: ColorUtils.string2Color(btnItem['btnColor']),
+      fontSize: 12,
+      padding: EdgeInsets.symmetric(horizontal: 5),
+      minWidth: btnItem['btnWidth']?.toDouble(),
+      minHeight: btnItem['btnHeight']?.toDouble() + 5,
+    ).marginOnly(left: 5);
+  }
+}

+ 0 - 1
packages/cpt_services/lib/modules/services/homeService/home_service_page.dart

@@ -139,7 +139,6 @@ class HomeServicePage extends HookConsumerWidget {
             crossAxisAlignment: CrossAxisAlignment.start,
             mainAxisSize: MainAxisSize.max,
             children: [
-              // 卡片头部(头像 标题 时间)
               Expanded(
                 child: HomeServiceCard(
                     key: UniqueKey(),

+ 2 - 2
packages/cpt_services/lib/modules/services/homeService/home_service_vm.dart

@@ -155,10 +155,10 @@ class HomeServiceVm extends _$HomeServiceVm {
       },
       {
         'id':3,
-        'service_type': 2,  // 0 房屋保洁 1 空调保洁  2 维修
+        'service_type': 1,  // 0 房屋保洁 1 空调保洁  2 维修
         'cover_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
         'resources': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
-        'title': 'Repair air Conditioner Services',
+        'title': 'Cleaning Services',
         'price': 200,
         'unit': '/hr',
         'liked': true,

+ 9 - 8
packages/cpt_services/lib/modules/services/repair_history/history_page.dart

@@ -20,6 +20,7 @@ import 'package:widgets/my_appbar.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:widgets/widget_export.dart';
 
+import '../../../components/repair_status_card_item.dart';
 import '../../../constants_services.dart';
 import '../../../router/page/services_page_router.dart';
 import 'history_vm.dart';
@@ -99,12 +100,12 @@ class RepairHistoryPage extends HookConsumerWidget {
                           serviceTypeCode,
                           serviceStatusCode,
                       ).onTap((){
-                        vm.gotoCleanOrderDetailPage(
-                          context,
-                          state.list?[index]['id'],
-                          serviceTypeCode,
-                          serviceStatusCode,
-                        );
+                        // vm.gotoCleanOrderDetailPage(
+                        //   context,
+                        //   state.list?[index]['id'],
+                        //   serviceTypeCode,
+                        //   serviceStatusCode,
+                        // );
                       });
                     },
                     childCount: state.list.length,
@@ -132,9 +133,9 @@ class RepairHistoryPage extends HookConsumerWidget {
           ),
         ],
       ),
-      child: StausCardItem(
+      child: RepairStausCardItem(
         key: UniqueKey(),
-        cardHeight: 175.0,
+        cardHeight: 150.0,
         serviceId: item['id'],
         serviceTypeCode: serviceTypeCode,
         serviceStatusCode: serviceStatusCode,

+ 5 - 9
packages/cpt_services/lib/modules/services/repair_homeService/home_service_vm.dart

@@ -131,10 +131,10 @@ class RepairHomeServiceVm extends _$RepairHomeServiceVm {
     List<Map<String, dynamic>> list = [
       {
         'id':1,
-        'service_type': 0,  // 0 房屋保洁 1 空调保洁  2 维修
+        'service_type': 2,  // 0 房屋保洁 1 空调保洁  2 维修
         'cover_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
         'resources': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
-        'title': 'House Cleaning Services',
+        'title': 'Repair Services',
         'price': 30,
         'unit': '/hr',
         'liked': true,
@@ -143,10 +143,10 @@ class RepairHomeServiceVm extends _$RepairHomeServiceVm {
       },
       {
         'id':2,
-        'service_type': 1,  // 0 房屋保洁 1 空调保洁  2 维修
+        'service_type': 2,  // 0 房屋保洁 1 空调保洁  2 维修
         'cover_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
         'resources': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
-        'title': 'Air Conditioning Cleaning',
+        'title': 'Repair Air Conditioning',
         'price': 10,
         'unit': '/unit',
         'liked': false,
@@ -296,11 +296,7 @@ class RepairHomeServiceVm extends _$RepairHomeServiceVm {
     List<Map<String, dynamic>> serviceCategoryList = [
       {
         'id': 1,
-        'name': 'House Cleaning Serivces',
-      },
-      {
-        'id': 2,
-        'name': 'Household Appliance Cleaning',
+        'name': 'Appliance Repair',
       },
     ];
 

+ 9 - 8
packages/cpt_services/lib/modules/services/repair_inProgress/in_progress_page.dart

@@ -20,6 +20,7 @@ import 'package:widgets/my_appbar.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:widgets/widget_export.dart';
 
+import '../../../components/repair_status_card_item.dart';
 import '../../../constants_services.dart';
 import '../../../router/page/services_page_router.dart';
 import 'in_progress_vm.dart';
@@ -98,12 +99,12 @@ class RepairInProgressPage extends HookConsumerWidget {
                           serviceTypeCode,
                           serviceStatusCode
                       ).onTap((){
-                        vm.gotoCleanOrderDetailPage(
-                            context,
-                            state.list?[index]['id'],
-                            serviceTypeCode,
-                            serviceStatusCode
-                        );
+                        // vm.gotoCleanOrderDetailPage(
+                        //     context,
+                        //     state.list?[index]['id'],
+                        //     serviceTypeCode,
+                        //     serviceStatusCode
+                        // );
                       });
                     },
                     childCount: state.list.length,
@@ -131,9 +132,9 @@ class RepairInProgressPage extends HookConsumerWidget {
           ),
         ],
       ),
-      child: StausCardItem(
+      child: RepairStausCardItem(
           key: UniqueKey(),
-          cardHeight: 175.0,
+          cardHeight: 120.0,
           serviceId: item['id'],
           serviceTypeCode: serviceTypeCode,
           serviceStatusCode: serviceStatusCode,