Browse Source

带有Refresh的页面替换为自己的titlebar

liukai 4 months ago
parent
commit
d9d170e3a2

+ 40 - 38
packages/cpt_job/lib/modules/applied_staff_detail/applied_staff_detail_page.dart

@@ -49,16 +49,13 @@ class _AppliedStaffDetailState extends BaseState<AppliedStaffDetailPage, Applied
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appBar(context, "Staff Detail".tr),
-        body: SafeArea(
+      return SafeArea(
           bottom: true,
           top: false,
           child: Container(
             width: double.infinity,
             height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
+            padding: EdgeInsets.only(top:ScreenUtil.getStatusBarH(context)),
             decoration: const BoxDecoration(
               gradient: LinearGradient(
                 colors: [
@@ -70,43 +67,48 @@ class _AppliedStaffDetailState extends BaseState<AppliedStaffDetailPage, Applied
                 end: Alignment.bottomCenter,
               ),
             ),
-            child: EasyRefresh(
-              controller: controller.refreshController,
-              onRefresh: controller.onRefresh,
-              onLoad: controller.loadMore,
-              child: LoadStateLayout(
-                state: controller.loadingState,
-                errorMessage: controller.errorMessage,
-                errorRetry: () {
-                  controller.retryRequest();
-                },
-                successSliverWidget: [
-                  //顶部用户信息
-                  SliverToBoxAdapter(
-                    child: StaffDetailWidget(detail: state.detail,onRemarkAction: (){
-                      controller.gotoRemarkHistoryPage();
-                    }),
-                  ),
-
-                  //中间搜索布局
-                  SliverToBoxAdapter(
-                    child: _buildSearchWidget(),
-                  ),
+            child: Column(
+              children: [
+                MyAppBar.titleBar(context, "Staff Detail".tr),
 
-                  //底部工作历史列表
-                  SliverList(
-                      delegate: SliverChildBuilderDelegate(
-                    (context, index) {
-                      return StaffLabourHistoryItem(index: index, item: state.datas[index]);
+                EasyRefresh(
+                  controller: controller.refreshController,
+                  onRefresh: controller.onRefresh,
+                  onLoad: controller.loadMore,
+                  child: LoadStateLayout(
+                    state: controller.loadingState,
+                    errorMessage: controller.errorMessage,
+                    errorRetry: () {
+                      controller.retryRequest();
                     },
-                    childCount: state.datas.length,
-                  ))
-                ],
-              ),
+                    successSliverWidget: [
+                      //顶部用户信息
+                      SliverToBoxAdapter(
+                        child: StaffDetailWidget(detail: state.detail,onRemarkAction: (){
+                          controller.gotoRemarkHistoryPage();
+                        }),
+                      ),
+
+                      //中间搜索布局
+                      SliverToBoxAdapter(
+                        child: _buildSearchWidget(),
+                      ),
+
+                      //底部工作历史列表
+                      SliverList(
+                          delegate: SliverChildBuilderDelegate(
+                        (context, index) {
+                          return StaffLabourHistoryItem(index: index, item: state.datas[index]);
+                        },
+                        childCount: state.datas.length,
+                      ))
+                    ],
+                  ),
+                ).expanded(),
+              ],
             ),
           ),
-        ),
-      );
+        );
     });
   }
 

+ 50 - 52
packages/cpt_job/lib/modules/applied_staff_reviews/applied_staff_reviews_page.dart

@@ -56,55 +56,58 @@ class _AppliedStaffReviewsState extends BaseState<AppliedStaffReviewsPage, Appli
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appBar(context, "Staff Detail".tr),
-        body: SafeArea(
-          bottom: true,
-          top: false,
-          child: Container(
-            width: double.infinity,
-            height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
-            decoration: const BoxDecoration(
-              gradient: LinearGradient(
-                colors: [
-                  Color(0xFF091D44),
-                  Color(0xFF245A8A),
-                  Color(0xFF7F7CEC),
-                ],
-                begin: Alignment.topCenter,
-                end: Alignment.bottomCenter,
-              ),
-            ),
-            child: EasyRefresh(
-              controller: controller.refreshController,
-              onRefresh: controller.onRefresh,
-              onLoad: controller.loadMore,
-              child: LoadStateLayout(
-                state: controller.loadingState,
-                errorMessage: controller.errorMessage,
-                errorRetry: () {
-                  controller.retryRequest();
-                },
-                successSliverWidget: [
-                  //顶部用户信息
-                  SliverToBoxAdapter(
-                    child: _buildRemarkWidget(),
-                  ),
-
-                  //底部工作历史列表
-                  SliverList(
-                      delegate: SliverChildBuilderDelegate(
-                    (context, index) {
-                      return StaffReviewsItem(index: index, item: state.datas[index]);
-                    },
-                    childCount: state.datas.length,
-                  ))
-                ],
-              ),
+      return SafeArea(
+        bottom: true,
+        top: false,
+        child: Container(
+          width: double.infinity,
+          height: double.infinity,
+          padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
+          decoration: const BoxDecoration(
+            gradient: LinearGradient(
+              colors: [
+                Color(0xFF091D44),
+                Color(0xFF245A8A),
+                Color(0xFF7F7CEC),
+              ],
+              begin: Alignment.topCenter,
+              end: Alignment.bottomCenter,
             ),
           ),
+          child: Column(
+            crossAxisAlignment: CrossAxisAlignment.start,
+            mainAxisSize: MainAxisSize.max,
+            children: [
+              MyAppBar.titleBar(context, "Staff Detail".tr),
+              EasyRefresh(
+                controller: controller.refreshController,
+                onRefresh: controller.onRefresh,
+                onLoad: controller.loadMore,
+                child: LoadStateLayout(
+                  state: controller.loadingState,
+                  errorMessage: controller.errorMessage,
+                  errorRetry: () {
+                    controller.retryRequest();
+                  },
+                  successSliverWidget: [
+                    //顶部用户信息
+                    SliverToBoxAdapter(
+                      child: _buildRemarkWidget(),
+                    ),
+
+                    //底部工作历史列表
+                    SliverList(
+                        delegate: SliverChildBuilderDelegate(
+                      (context, index) {
+                        return StaffReviewsItem(index: index, item: state.datas[index]);
+                      },
+                      childCount: state.datas.length,
+                    ))
+                  ],
+                ),
+              ).expanded(),
+            ],
+          ),
         ),
       );
     });
@@ -128,7 +131,6 @@ class _AppliedStaffReviewsState extends BaseState<AppliedStaffReviewsPage, Appli
             isFontMedium: true,
             marginBottom: 8,
           ),
-
           Row(
             children: [
               RatingWidget(
@@ -141,19 +143,15 @@ class _AppliedStaffReviewsState extends BaseState<AppliedStaffReviewsPage, Appli
                 value: state.reviews ?? 0,
                 onRatingUpdate: (value) {},
               ),
-
               MyTextView(
                 "${state.reviews.toString()} (${state.reviewCount} Reviews)",
                 fontSize: 14,
                 marginLeft: 12,
                 textColor: ColorConstants.textYellowF8AE00,
                 isFontMedium: true,
-
               ).expanded(),
-
             ],
           ),
-
         ],
       ),
     );

+ 4 - 7
packages/cpt_job/lib/modules/applied_workflow/applied_workflow_page.dart

@@ -50,16 +50,13 @@ class _AppliedWorkflowState extends BaseState<AppliedWorkflowPage, AppliedWorkfl
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appBar(context, "Workflow".tr),
-        body: SafeArea(
+      return  SafeArea(
           bottom: true,
           top: false,
           child: Container(
             width: double.infinity,
             height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
+            padding: EdgeInsets.only(top:ScreenUtil.getStatusBarH(context)),
             decoration: const BoxDecoration(
               gradient: LinearGradient(
                 colors: [
@@ -73,6 +70,7 @@ class _AppliedWorkflowState extends BaseState<AppliedWorkflowPage, AppliedWorkfl
             ),
             child: Column(
               children: [
+                MyAppBar.titleBar(context, "Workflow".tr),
 
                 EasyRefresh(
                   controller: controller.refreshController,
@@ -96,8 +94,7 @@ class _AppliedWorkflowState extends BaseState<AppliedWorkflowPage, AppliedWorkfl
               ],
             ).marginOnly(top: 10),
           ),
-        ),
-      );
+        );
     });
   }
 }

+ 10 - 12
packages/cpt_job/lib/modules/job_applied/job_applied_page.dart

@@ -53,21 +53,13 @@ class _JobAppliedState extends BaseState<JobAppliedPage, JobAppliedController> {
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appBar(
-          context,
-          state.jobInfo?.jobTitle ?? "Title".tr,
-          subTitle: "(${state.jobInfo?.jobDate ?? "-"})",
-          subTitleColor: ColorConstants.textGrayAECAE5,
-        ),
-        body: SafeArea(
+      return  SafeArea(
           bottom: true,
           top: false,
           child: Container(
             width: double.infinity,
             height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
+            padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
             decoration: const BoxDecoration(
               gradient: LinearGradient(
                 colors: [
@@ -81,6 +73,13 @@ class _JobAppliedState extends BaseState<JobAppliedPage, JobAppliedController> {
             ),
             child: Column(
               children: [
+                MyAppBar.titleBar(
+                  context,
+                  state.jobInfo?.jobTitle ?? "Title".tr,
+                  subTitle: "(${state.jobInfo?.jobDate ?? "-"})",
+                  subTitleColor: ColorConstants.textGrayAECAE5,
+                ),
+
                 //搜索的条件
                 Row(
                   children: [
@@ -205,8 +204,7 @@ class _JobAppliedState extends BaseState<JobAppliedPage, JobAppliedController> {
               ],
             ),
           ),
-        ),
-      );
+        );
     });
   }
 }

+ 37 - 40
packages/cpt_job/lib/modules/job_list/job_list_page.dart

@@ -50,49 +50,13 @@ class _JobListState extends BaseState<JobListPage, JobListController> {
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appSearchBar(
-          context,
-          value: state.keyword,
-          hintText: 'Title'.tr,
-          controller: state.searchController,
-          onSearch: (keyword) {
-            controller.doSearch(keyword);
-          },
-          actions: [
-            //重置按钮
-            MyButton(
-              onPressed: () {
-                FocusScope.of(context).unfocus();
-                controller.resetFiltering();
-              },
-              text: "Reset".tr,
-              textColor: ColorConstants.white,
-              backgroundColor: hexToColor("#2BA9F9", opacity: 0.5),
-              radius: 17.25,
-              minWidth: 60,
-              minHeight: 35,
-            ).marginOnly(right: 15),
-
-            //筛选图标
-            MyAssetImage(
-              Assets.baseServiceTitleBarFilterIcon,
-              width: 24,
-              height: 16.5,
-            ).onTap(() {
-              FocusScope.of(context).unfocus();
-              controller.showFilterDialog();
-            }).marginOnly(right: 15),
-          ],
-        ),
-        body: SafeArea(
+      return SafeArea(
           bottom: true,
           top: false,
           child: Container(
             width: double.infinity,
             height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
+            padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
             decoration: const BoxDecoration(
               gradient: LinearGradient(
                 colors: [
@@ -106,6 +70,40 @@ class _JobListState extends BaseState<JobListPage, JobListController> {
             ),
             child: Column(
               children: [
+                MyAppBar.searchTitleBar(
+                  context,
+                  value: state.keyword,
+                  hintText: 'Title'.tr,
+                  controller: state.searchController,
+                  onSearch: (keyword) {
+                    controller.doSearch(keyword);
+                  },
+                  actions: [
+                    //重置按钮
+                    MyButton(
+                      onPressed: () {
+                        FocusScope.of(context).unfocus();
+                        controller.resetFiltering();
+                      },
+                      text: "Reset".tr,
+                      textColor: ColorConstants.white,
+                      backgroundColor: hexToColor("#2BA9F9", opacity: 0.5),
+                      radius: 17.25,
+                      minWidth: 60,
+                      minHeight: 35,
+                    ).marginOnly(right: 15),
+
+                    //筛选图标
+                    MyAssetImage(
+                      Assets.baseServiceTitleBarFilterIcon,
+                      width: 24,
+                      height: 16.5,
+                    ).onTap(() {
+                      FocusScope.of(context).unfocus();
+                      controller.showFilterDialog();
+                    }).marginOnly(right: 15),
+                  ],
+                ),
                 //底部的列表
                 EasyRefresh(
                   controller: controller.refreshController,
@@ -139,8 +137,7 @@ class _JobListState extends BaseState<JobListPage, JobListController> {
               ],
             ),
           ),
-        ),
-      );
+        );
     });
   }
 }

+ 103 - 107
packages/cpt_labour/lib/modules/labour_request_list/labour_request_list_page.dart

@@ -5,7 +5,6 @@ import 'package:get/get.dart';
 import 'package:plugin_basic/base/base_state.dart';
 import 'package:plugin_basic/base/base_stateful_page.dart';
 import 'package:plugin_basic/utils/ext_get_nav.dart';
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:router/path/router_path.dart';
 import 'package:shared/utils/screen_util.dart';
 import 'package:widgets/ext/ex_widget.dart';
@@ -51,117 +50,114 @@ class _LabourRequestListState extends BaseState<LabourRequestListPage, LabourReq
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appSearchBar(
-          context,
-          value: state.keyword,
-          hintText: 'Title'.tr,
-          controller: state.searchController,
-          onSearch: (keyword) {
-            controller.doSearch(keyword);
-          },
-          actions: [
-            //重置按钮
-            MyButton(
-              onPressed: () {
-                FocusScope.of(context).unfocus();
-                controller.resetFiltering();
-              },
-              text: "Reset".tr,
-              textColor: ColorConstants.white,
-              backgroundColor: hexToColor("#2BA9F9", opacity: 0.5),
-              radius: 17.25,
-              minWidth: 60,
-              minHeight: 35,
-            ).marginOnly(right: 15),
+      return SafeArea(
+        bottom: true,
+        top: false,
+        child: Container(
+          width: double.infinity,
+          height: double.infinity,
+          padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
+          decoration: const BoxDecoration(
+            gradient: LinearGradient(
+              colors: [
+                Color(0xFF091D44),
+                Color(0xFF245A8A),
+                Color(0xFF7F7CEC),
+              ],
+              begin: Alignment.topCenter,
+              end: Alignment.bottomCenter,
+            ),
+          ),
+          child: Column(
+            children: [
+              MyAppBar.searchTitleBar(
+                context,
+                value: state.keyword,
+                hintText: 'Title'.tr,
+                controller: state.searchController,
+                onSearch: (keyword) {
+                  controller.doSearch(keyword);
+                },
+                actions: [
+                  //重置按钮
+                  MyButton(
+                    onPressed: () {
+                      FocusScope.of(context).unfocus();
+                      controller.resetFiltering();
+                    },
+                    text: "Reset".tr,
+                    textColor: ColorConstants.white,
+                    backgroundColor: hexToColor("#2BA9F9", opacity: 0.5),
+                    radius: 17.25,
+                    minWidth: 60,
+                    minHeight: 35,
+                  ).marginOnly(right: 15),
 
-            //筛选图标
-            MyAssetImage(
-              Assets.baseServiceTitleBarFilterIcon,
-              width: 24,
-              height: 16.5,
-            ).onTap(() {
-              FocusScope.of(context).unfocus();
-              controller.showFilterDialog();
-            }).marginOnly(right: 15),
-          ],
-        ),
-        body: SafeArea(
-          bottom: true,
-          top: false,
-          child: Container(
-            width: double.infinity,
-            height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
-            decoration: const BoxDecoration(
-              gradient: LinearGradient(
-                colors: [
-                  Color(0xFF091D44),
-                  Color(0xFF245A8A),
-                  Color(0xFF7F7CEC),
+                  //筛选图标
+                  MyAssetImage(
+                    Assets.baseServiceTitleBarFilterIcon,
+                    width: 24,
+                    height: 16.5,
+                  ).onTap(() {
+                    FocusScope.of(context).unfocus();
+                    controller.showFilterDialog();
+                  }).marginOnly(right: 15),
                 ],
-                begin: Alignment.topCenter,
-                end: Alignment.bottomCenter,
               ),
-            ),
-            child: Column(
-              children: [
-                // 添加按钮
-                MyButton(
-                  type: ClickType.throttle,
-                  milliseconds: 500,
-                  onPressed: () {
-                    FocusScope.of(context).unfocus();
-                    controller.gotoAddLabourPage();
-                  },
-                  text: "Create New Job Request".tr,
-                  textColor: ColorConstants.white,
-                  fontSize: 16,
-                  radius: 20,
-                  backgroundColor: hexToColor("#FFBB1B"),
-                  fontWeight: FontWeight.w500,
-                ).marginSymmetric(horizontal: 15, vertical: 15),
+              // 添加按钮
+              MyButton(
+                type: ClickType.throttle,
+                milliseconds: 500,
+                onPressed: () {
+                  FocusScope.of(context).unfocus();
+                  controller.gotoAddLabourPage();
+                },
+                text: "Create New Job Request".tr,
+                textColor: ColorConstants.white,
+                fontSize: 16,
+                radius: 20,
+                backgroundColor: hexToColor("#FFBB1B"),
+                fontWeight: FontWeight.w500,
+              ).marginSymmetric(horizontal: 15, vertical: 15),
 
-                //底部的列表
-                EasyRefresh(
-                  controller: controller.refreshController,
-                  onRefresh: controller.onRefresh,
-                  onLoad: controller.loadMore,
-                  child: LoadStateLayout(
-                    state: controller.loadingState,
-                    errorMessage: controller.errorMessage,
-                    errorRetry: () {
-                      controller.retryRequest();
-                    },
-                    successSliverWidget: [
-                      SliverList(
-                          delegate: SliverChildBuilderDelegate(
-                        (context, index) {
-                          return LabourRequestItem(
-                            index: index,
-                            item: state.datas[index],
-                            onDetailAction: (){
+              //底部的列表
+              EasyRefresh(
+                controller: controller.refreshController,
+                onRefresh: controller.onRefresh,
+                onLoad: controller.loadMore,
+                child: LoadStateLayout(
+                  state: controller.loadingState,
+                  errorMessage: controller.errorMessage,
+                  errorRetry: () {
+                    controller.retryRequest();
+                  },
+                  successSliverWidget: [
+                    SliverList(
+                        delegate: SliverChildBuilderDelegate(
+                      (context, index) {
+                        return LabourRequestItem(
+                          index: index,
+                          item: state.datas[index],
+                          onDetailAction: () {
                             controller.gotoDetailPage(state.datas[index]);
-                            },
-                            onRecallAction: (){
-                              controller.doRecall(state.datas[index]);
-                            },
-                            onEditAction: (){
-                              controller.gotoEditPage(state.datas[index]);
-                            },
-                            onStatusAction: (){
-                              controller.gotoWorkflowPage(state.datas[index]);
-                            },
-                          );
-                        },
-                        childCount: state.datas.length,
-                      ))
-                    ],
-                  ),
-                ).expanded(),
-              ],
-            ),
+                          },
+                          onRecallAction: () {
+                            controller.doRecall(state.datas[index]);
+                          },
+                          onEditAction: () {
+                            controller.gotoEditPage(state.datas[index]);
+                          },
+                          onStatusAction: () {
+                            controller.gotoWorkflowPage(state.datas[index]);
+                          },
+                        );
+                      },
+                      childCount: state.datas.length,
+                    ))
+                  ],
+                ),
+              ).expanded(),
+            ],
           ),
         ),
       );

+ 4 - 7
packages/cpt_labour/lib/modules/labour_request_workflow/labour_request_workflow_page.dart

@@ -50,16 +50,13 @@ class _LabourRequestWorkflowState extends BaseState<LabourRequestWorkflowPage, L
   @override
   Widget build(BuildContext context) {
     return autoCtlGetBuilder(builder: (controller) {
-      return Scaffold(
-        extendBodyBehindAppBar: true,
-        appBar: MyAppBar.appBar(context, "Workflow".tr),
-        body: SafeArea(
+      return  SafeArea(
           bottom: true,
           top: false,
           child: Container(
             width: double.infinity,
             height: double.infinity,
-            padding: EdgeInsets.only(top: kToolbarHeight + ScreenUtil.getStatusBarH(context) + 1),
+            padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
             decoration: const BoxDecoration(
               gradient: LinearGradient(
                 colors: [
@@ -73,6 +70,7 @@ class _LabourRequestWorkflowState extends BaseState<LabourRequestWorkflowPage, L
             ),
             child: Column(
               children: [
+                MyAppBar.titleBar(context, "Workflow".tr),
 
                 EasyRefresh(
                   controller: controller.refreshController,
@@ -96,8 +94,7 @@ class _LabourRequestWorkflowState extends BaseState<LabourRequestWorkflowPage, L
               ],
             ).marginOnly(top: 10),
           ),
-        ),
-      );
+        );
     });
   }
 }

+ 183 - 1
packages/cs_widgets/lib/my_appbar.dart

@@ -1,11 +1,12 @@
+import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
+import 'package:flutter/widgets.dart';
 import 'package:get/get.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/constants/color_constants.dart';
 import 'my_load_image.dart';
 import 'search_app_bar.dart';
-import 'utils/dark_theme_util.dart';
 
 class MyAppBar {
   ///封装的默认的AppBar,Light默认模式下,黑色图标+黑色文本,Dark模式下,白色图标+白色文本
@@ -127,4 +128,185 @@ class MyAppBar {
           )),
     );
   }
+
+  /// 当前App中的自定义TitleBar用于沉浸式处理,不是用在 Scaffold 下面的,直接放在 Column 下面即可
+  static Widget titleBar(
+    BuildContext context,
+    String title, {
+    void Function()? backCallback,
+    String? backIconPath,
+    double? backIconWidth,
+    double? backIconHeight,
+    String? subTitle,
+    Color? subTitleColor,
+    bool needBottomDivider = true,
+    Color textColor = Colors.white,
+    Color backgroundColor = Colors.transparent,
+    List<Widget>? actions,
+  }) {
+    // 计算左侧和右侧固定容器的宽度
+    double sideWidth = 55;
+
+    return Column(
+      children: [
+        Container(
+          height: kToolbarHeight,
+          color: backgroundColor,
+          child: Stack(
+            children: [
+              // 返回图标在左侧
+              Positioned(
+                left: 0,
+                top: 0,
+                bottom: 0,
+                child: Container(
+                  width: sideWidth,
+                  alignment: Alignment.center,
+                  child: IconButton(
+                    icon: MyAssetImage(
+                      backIconPath ?? Assets.baseLibWhiteBack,
+                      width: backIconWidth ?? 11,
+                      height: backIconHeight ?? 18,
+                    ),
+                    onPressed: () {
+                      if (backCallback != null) {
+                        backCallback();
+                      } else {
+                        Get.back();
+                      }
+                    },
+                  ),
+                ),
+              ),
+              // 标题在中间
+              Positioned.fill(
+                child: Center(
+                  child: ConstrainedBox(
+                    constraints: BoxConstraints(
+                      maxWidth: MediaQuery.of(context).size.width - 2 * sideWidth,
+                    ),
+                    child: subTitle == null
+                        ? Text(
+                            title,
+                            style: TextStyle(color: textColor, fontSize: 18, fontWeight: FontWeight.w500),
+                            overflow: TextOverflow.ellipsis,
+                          )
+                        : Column(
+                            mainAxisSize: MainAxisSize.min,
+                            mainAxisAlignment: MainAxisAlignment.center,
+                            crossAxisAlignment: CrossAxisAlignment.center,
+                            children: [
+                              Text(
+                                title,
+                                style: TextStyle(color: textColor, fontSize: 18, fontWeight: FontWeight.w500),
+                                overflow: TextOverflow.ellipsis,
+                              ),
+                              Text(
+                                subTitle!,
+                                style: TextStyle(color: subTitleColor ?? textColor, fontSize: 15, fontWeight: FontWeight.w400),
+                              ),
+                            ],
+                          ),
+                  ),
+                ),
+              ),
+              // 右侧的操作按钮
+              Positioned(
+                right: 0,
+                top: 0,
+                bottom: 0,
+                child: Container(
+                  alignment: Alignment.centerRight,
+                  child: Row(
+                    mainAxisSize: MainAxisSize.min,
+                    children: actions ?? [SizedBox(width: sideWidth)],
+                  ),
+                ),
+              ),
+            ],
+          ),
+        ),
+        // 底部的分割线
+        if (needBottomDivider)
+          Divider(
+            height: 0.5,
+            color: ColorConstants.dividerBar,
+          ),
+      ],
+    );
+  }
+
+  /// 当前App中的自定义TitleBar用于沉浸式处理,不是用在 Scaffold 下面的,直接放在 Column 下面即可
+  static Widget searchTitleBar(BuildContext context, {
+    void Function()? backCallback,
+    String? value,
+    String? hintText,
+    Color textColor = Colors.white,
+    Color backgroundColor = Colors.transparent,
+    ValueChanged<String>? onSearch,
+    ValueChanged<String>? onChanged,
+    bool needBottomDivider = true,
+    TextEditingController? controller,
+    List<Widget>? actions,
+  }) {
+    return Column(
+      children: [
+        Container(
+          height: kToolbarHeight,
+          color: backgroundColor,
+          child: Row(
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              // 返回图标
+              Container(
+                width: 55,
+                alignment: Alignment.center,
+                child: IconButton(
+                  icon: MyAssetImage(
+                    Assets.baseLibWhiteBack,
+                    width: 11,
+                    height: 18,
+                  ),
+                  onPressed: () {
+                    if (backCallback != null) {
+                      backCallback();
+                    } else {
+                      Get.back();
+                    }
+                  },
+                ),
+              ),
+              // 搜索栏
+              Expanded(
+                child: SearchAppBar(
+                  onSearch: onSearch,
+                  onChanged: onChanged,
+                  value: value,
+                  hintText: hintText,
+                  controller: controller,
+                ),
+              ),
+              // 右侧操作按钮
+              Container(
+                alignment: Alignment.centerRight,
+                child: Row(
+                  mainAxisSize: MainAxisSize.min,
+                  children: actions ?? [],
+                ),
+              ),
+            ],
+          ),
+        ),
+        // 底部的分割线
+        if (needBottomDivider)
+          Divider(
+            height: 0.5,
+            indent: 0.0,
+            color: ColorConstants.dividerBar,
+          ),
+      ],
+    );
+  }
+
+
 }