Browse Source

Merge remote-tracking branch 'origin/dev_services' into dev_services

liukai 2 weeks ago
parent
commit
313fc32d36

+ 22 - 5
packages/cpt_rewards/lib/modules/rewards/rewards_page.dart

@@ -7,9 +7,12 @@ import 'package:cpt_rewards/modules/rewards_home/rewards_home_page.dart';
 import 'package:cpt_rewards/modules/rewards_list/rewards_list_page.dart';
 import 'package:cpt_rewards/modules/rewards_my/rewards_my_page.dart';
 import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:cs_resources/theme/theme_config.dart';
 import 'package:domain/entity/rewards_index_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
+import 'package:flutter/services.dart';
 import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_basic/modules/global_web_page.dart';
@@ -774,7 +777,7 @@ class RewardsPage extends HookConsumerWidget {
   Widget _buildHistory(BuildContext context, WidgetRef ref, _vm, list) {
     List latest = list.latest;
     return Container(
-      decoration: BoxDecoration(
+      decoration: BoxDecoration( 
         color: Colors.white,
         borderRadius: BorderRadius.circular(10),
         boxShadow: const [
@@ -873,11 +876,24 @@ class RewardsPage extends HookConsumerWidget {
         Log.d("property_news_page 组件卸载时执行");
       };
     }, []);
-    return Scaffold(
+    // SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
+    //   statusBarColor: ColorUtils.string2Color('#4161D0'), // 设置状态栏颜色为蓝色
+    //   statusBarIconBrightness: Brightness.light, // 设置状态栏图标为亮色(例如白色)
+    //   statusBarBrightness: Brightness.dark, // 设置状态栏亮度为暗色(通常与状态栏颜色相反)
+    // ));
+    return MaterialApp(
+      home: Scaffold(
+        body: AnnotatedRegion<SystemUiOverlayStyle>(
+          value: SystemUiOverlayStyle(
+            statusBarColor: ColorUtils.string2Color('#4161D0'), // 绿色状态栏颜色
+            statusBarIconBrightness: Brightness.light, // 暗色图标(例如黑色)
+          ),
+          child:Scaffold(
       // appBar: MyAppBar.appBar(
       //   context,
-      //   "Daily Login",
-      //   backgroundColor: ColorUtils.string2Color('#4161D0'),
+      //   "",
+      //   showBackButton: false,
+      //   backgroundColor: context.appColors.btnBgDefault,
       // ),
       body: Column(children: [
         Expanded(
@@ -913,6 +929,7 @@ class RewardsPage extends HookConsumerWidget {
           ),
         ),
       ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
-    );
+    )
+        )));
   }
 }

+ 88 - 50
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_page.dart

@@ -9,6 +9,7 @@ import 'package:domain/entity/rewards_category_entity.dart';
 import 'package:domain/entity/rewards_home_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
+import 'package:flutter/services.dart';
 import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_platform/engine/image/image_nine_grid.dart';
@@ -78,7 +79,7 @@ class RewardsHomePage extends HookConsumerWidget {
                       fontSize: 18.0,
                       color: Colors.white,
                       fontWeight: FontWeight.w500), // 设置字体大小
-                ).paddingOnly(left: 10, top: 20, bottom: 18),
+                ).paddingOnly(left: 10, top: 20, bottom: 13),
               ],
             ),
             Row(
@@ -132,7 +133,7 @@ class RewardsHomePage extends HookConsumerWidget {
             ).paddingOnly(left: 10)
           ],
         )
-            .paddingOnly(top: 15, left: 5, right: 15, bottom: 0)
+            .paddingOnly(top: 15, left: 5, right: 15, bottom: 8)
             .border(bottom: 0, color: ColorUtils.string2Color('#4161D0'))
             .backgroundColor(ColorUtils.string2Color('#4161D0')));
   }
@@ -140,6 +141,7 @@ class RewardsHomePage extends HookConsumerWidget {
   Widget _buildSearch(BuildContext context, WidgetRef ref, _vm) {
     // List itemsList = _vm.state.list.toList();
     return Container(
+      width: MediaQuery.of(context).size.width-30,
       height: 50,
       decoration: BoxDecoration(
         color: Colors.white,
@@ -272,8 +274,8 @@ class RewardsHomePage extends HookConsumerWidget {
                           child: ClipRRect(
                               borderRadius:
                                   const BorderRadius.all(Radius.circular(6.0)),
-                              child: _buildItem(
-                              context, ref, _vm, hg, list['rewards'][index])));
+                              child: _buildItem(context, ref, _vm, hg,
+                                  list['rewards'][index])));
                     }))
               ],
             ),
@@ -348,7 +350,7 @@ class RewardsHomePage extends HookConsumerWidget {
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [
             Text(
-              maxLines: 2, // 设置最大行数为2
+              maxLines: 1, // 设置最大行数为2
               overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
               item?['name'] ?? '',
               style: const TextStyle(
@@ -437,11 +439,11 @@ class RewardsHomePage extends HookConsumerWidget {
                                   blurRadius: 6)
                             ],
                           ),
-                          child:ClipRRect(
+                          child: ClipRRect(
                               borderRadius:
                                   const BorderRadius.all(Radius.circular(6.0)),
-                              child: _buildItem(
-                              context, ref, _vm, hg, list['rewards'][index])));
+                              child: _buildItem(context, ref, _vm, hg,
+                                  list['rewards'][index])));
                     }))
               ],
             ),
@@ -492,11 +494,11 @@ class RewardsHomePage extends HookConsumerWidget {
                                       blurRadius: 6)
                                 ],
                               ),
-                              child:ClipRRect(
-                              borderRadius:
-                                  const BorderRadius.all(Radius.circular(6.0)),
-                              child: _buildItem(context, ref, _vm, hg,
-                                  list['rewards'][index])))
+                              child: ClipRRect(
+                                  borderRadius: const BorderRadius.all(
+                                      Radius.circular(6.0)),
+                                  child: _buildItem(context, ref, _vm, hg,
+                                      list['rewards'][index])))
                           .marginOnly(bottom: 13);
                     }))
               ],
@@ -517,42 +519,78 @@ class RewardsHomePage extends HookConsumerWidget {
         Log.d("property_news_page 组件卸载时执行");
       };
     }, []);
-    return Scaffold(
-      // appBar: AppBar(title: Text("奖励")),
-      body: Column(children: [
-        Expanded(
-            child: LoadStateLayout(
-          state: state.loadingState,
-          errorMessage: state.errorMessage,
-          errorRetry: () {
-            _vm.retryRequest();
-          },
-          successWidget: SingleChildScrollView(
-              scrollDirection: Axis.vertical,
-              physics: const BouncingScrollPhysics(),
-              clipBehavior: Clip.none,
-              child: state.list.length > 0
-                  ? Column(
-                      children: [
-                        _buildTop(context, ref, _vm).paddingOnly(
-                            top: MediaQuery.of(context).padding.top),
-                        Container(
-                          transform: Matrix4.translationValues(0.0, -25.0, 0.0),
-                          child: _buildSearch(context, ref, _vm), // 使用负数margin
-                        ).paddingOnly(left: 15, right: 15),
-                        _buildSwiper(context, ref, _vm),
-                        _buildRecommend(context, ref, _vm, state.list![0])
-                            .marginOnly(bottom: 15),
-                        // _buildHottest(context, ref, _vm).marginOnly(bottom: 15),
-                        _buildFood(context, ref, _vm, state.list![2])
-                            .marginOnly(bottom: 15),
-                        _buildBest(context, ref, _vm, state.list![1])
-                            .marginOnly(bottom: 15),
-                      ],
-                    )
-                  : const Column()),
-        )),
-      ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
-    );
+    return MaterialApp(
+        home: Scaffold(
+            body: AnnotatedRegion<SystemUiOverlayStyle>(
+                value: SystemUiOverlayStyle(
+                  statusBarColor: ColorUtils.string2Color('#4161D0'), // 绿色状态栏颜色
+                  statusBarIconBrightness: Brightness.light, // 暗色图标(例如黑色)
+                ),
+                child: Scaffold(
+                  // appBar: AppBar(title: Text("奖励")),
+                  body: Column(children: [
+                    Expanded(
+                        child: LoadStateLayout(
+                      state: state.loadingState,
+                      errorMessage: state.errorMessage,
+                      errorRetry: () {
+                        _vm.retryRequest();
+                      },
+                      successWidget: SingleChildScrollView(
+                          scrollDirection: Axis.vertical,
+                          physics: const BouncingScrollPhysics(),
+                          clipBehavior: Clip.none,
+                          child: state.list.length > 0
+                              ? Column(
+                                  children: [
+                                    Stack(
+                                      clipBehavior:Clip.none,
+                                      children: <Widget>[
+                                      _buildTop(context, ref, _vm).paddingOnly(
+                                          top: MediaQuery.of(context)
+                                              .padding
+                                              .top),
+//                                               GestureDetector(
+//                                                   onTap: () {
+//                                                     print('第二个元素被点击'); // 这个会被触发。
+//                                                   },
+//                                                   child:Container(
+// transform:Matrix4.translationValues(0.0,210.0,0.0),child: _buildSearch(context,ref,_vm)//使用负数
+// ).paddingOnly(left:15,right:15))
+                                      // Container(
+                                      //   // transform: Matrix4.translationValues(0.0, -25.0, 0.0),
+                                      //   child: _buildSearch(context, ref, _vm), // 使用负数margin
+                                      // ).paddingOnly(left: 15, right: 15),
+                                      Positioned(
+                                        // 通过 Positioned 来确保它在红色容器的上方。
+                                        left: 0, // 根据需要调整位置。
+                                        bottom: -12, // 根据需要调整位置。
+                                        child: GestureDetector(
+                                          onTap: () {
+                                            RewardsSearchPage
+                                                    .startInstance();
+                                          },
+                                          child:
+                                              _buildSearch(context, ref, _vm),
+                                        ).paddingOnly(left: 15, right: 15),
+                                      ),
+                                    ]).paddingOnly(bottom: 42),
+                                    _buildSwiper(context, ref, _vm),
+                                    _buildRecommend(
+                                            context, ref, _vm, state.list![0])
+                                        .marginOnly(bottom: 15),
+                                    // _buildHottest(context, ref, _vm).marginOnly(bottom: 15),
+                                    _buildFood(
+                                            context, ref, _vm, state.list![2])
+                                        .marginOnly(bottom: 15),
+                                    _buildBest(
+                                            context, ref, _vm, state.list![1])
+                                        .marginOnly(bottom: 15),
+                                  ],
+                                )
+                              : const Column()),
+                    )),
+                  ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
+                ))));
   }
 }