Index: lib/widget/mp_scaffold.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>import 'package:flutter/foundation.dart';\nimport 'package:flutter_smart_dialog/flutter_smart_dialog.dart';\nimport 'package:smps_flutter_pda/page/login/login_page.dart';\nimport 'package:smps_flutter_pda/res/strings.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter_screenutil/flutter_screenutil.dart';\nimport 'package:get/get.dart';\nimport 'package:smps_flutter_pda/common/extension/double_ext.dart';\nimport 'package:smps_flutter_pda/common/extension/string_parser_extension.dart';\nimport 'package:smps_flutter_pda/common/smps_core_config.dart';\nimport 'package:smps_flutter_pda/common/spms_application.dart';\nimport 'package:smps_flutter_pda/utils/smart_manager.dart';\nimport 'package:sp_util/sp_util.dart';\n\nclass MpScaffold extends StatefulWidget {\n  final bool? isWhite;\n  final String? title;\n  final TextStyle? titleStyle;\n  final Widget child;\n  final RxString? rxTitle;\n  final bool? leading;\n  final bool? noAppBar;\n  final bool? resizeToAvoidBottomInset;\n  final bool? showWhs;\n  final ValueChanged<String>? actionCallback;\n  final String? whsCode;\n\n  const MpScaffold(\n      {Key? key,\n      this.isWhite = false,\n      this.title,\n      this.titleStyle,\n      required this.child,\n      this.rxTitle,\n      this.leading = true,\n      this.noAppBar = false,\n      this.resizeToAvoidBottomInset,\n      this.showWhs = false,\n      this.actionCallback,\n      this.whsCode})\n      : super(key: key);\n\n  @override\n  State<MpScaffold> createState() => _MpScaffoldState();\n}\n\nclass _MpScaffoldState extends State<MpScaffold> {\n  ///右上方文案内容\n  RxString actionStr = Ids.allWarehouses.tr.obs;\n\n  ///仓库列表\n  List<String> whsCodeList = [\n    Ids.allWarehouses.tr,\n    ...SPMSApplication()\n            .userInfo\n            ?.userWhs\n            ?.where((element) =>\n                element.werks == SpUtil.getString(SPMSCoreConfig.WARE_HOUSE))\n            .toList()\n            .map((e) => '${e.whsLocationCode}_${e.whsLocationDesc}')\n            .toList() ??\n        []\n  ];\n\n  @override\n  void initState() {\n    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {\n      if (widget.whsCode != null) {\n        actionStr.value = widget.whsCode!;\n      }\n    });\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset ?? false,\n      appBar: widget.noAppBar!\n          ? null\n          : AppBar(\n              iconTheme: widget.isWhite!\n                  ? const IconThemeData(\n                      color: Colors.black,\n                    )\n                  : const IconThemeData(\n                      color: Colors.white,\n                    ),\n              title: widget.rxTitle == null\n                  ? Text(\n                      widget.title ?? '',\n                      style: widget.titleStyle ??\n                          TextStyle(\n                              fontSize: 20.sp,\n                              color: '#333333'.getColor(),\n                              fontWeight: FontWeight.bold),\n                    )\n                  : Obx(() => Text(\n                        widget.rxTitle?.value ?? '',\n                        style: widget.titleStyle ??\n                            TextStyle(\n                                fontSize: 20.sp,\n                                color: '#333333'.getColor(),\n                                fontWeight: FontWeight.bold),\n                      )),\n              centerTitle: true,\n              elevation: 0,\n              leading: widget.leading! ? null : Container(),\n              backgroundColor:\n                  widget.isWhite! ? Colors.white : '#165DFF'.getColor(),\n              actions: widget.showWhs!\n                  ? [\n                      UnconstrainedBox(\n                        child: GestureDetector(\n                          behavior: HitTestBehavior.opaque,\n                          onTap: () {\n                            SmartManager().showSelectItem(\n                                Ids.pleaseSelectAWarehouse.tr, whsCodeList,\n                                (value) {\n                              actionStr.value = whsCodeList[value].split('_').first;\n                              widget.actionCallback?.call(\n                                  actionStr.value == Ids.allWarehouses.tr\n                                      ? ''\n                                      : actionStr.value);\n                            });\n                          },\n                          child: Container(\n                            width: 100.w,\n                            height: 30.h,\n                            decoration: BoxDecoration(\n                                borderRadius: BorderRadius.circular(10.w),\n                                border: Border.all(\n                                    color: Colors.black, width: 1.w)),\n                            alignment: Alignment.centerRight,\n                            child: Row(\n                              mainAxisSize: MainAxisSize.max,\n                              mainAxisAlignment: MainAxisAlignment.end,\n                              crossAxisAlignment: CrossAxisAlignment.center,\n                              children: [\n                                Obx(() => Text(\n                                      actionStr.value,\n                                      style: TextStyle(\n                                          fontSize: SPMSCoreConfig.baseTextSize,\n                                          color: Colors.black),\n                                    )),\n                                5.widthSizedBox,\n                                Icon(\n                                  Icons.keyboard_arrow_down,\n                                  color: Colors.black,\n                                  size: 20.w,\n                                )\n                              ],\n                            ),\n                          ),\n                        ),\n                      )\n                    ]\n                  : null),\n      body: WillPopScope(\n          child: widget.child,\n          onWillPop: () async {\n            if(kDebugMode){//开发模式下不要拦截了，非常烦人\n              return true;\n            }\n            SmartManager().showDoubleDialog(\n                Ids.areYouSureToExitTheCurrentPage.tr, (value) {\n              Get.back();\n              SmartDialog.dismiss();\n            });\n            return false;\n          }),\n    );\n  }\n}\n
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/widget/mp_scaffold.dart b/lib/widget/mp_scaffold.dart
--- a/lib/widget/mp_scaffold.dart	(revision a46304025c2c3d8ed9df5792df8c7f48037f7d06)
+++ b/lib/widget/mp_scaffold.dart	(date 1712626820845)
@@ -62,100 +62,105 @@
         []
   ];
 
+  AppBar? _appBar;
+
   @override
   void initState() {
+    super.initState();
     WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
       if (widget.whsCode != null) {
         actionStr.value = widget.whsCode!;
       }
     });
-    super.initState();
-  }
-
-  @override
-  Widget build(BuildContext context) {
-    return Scaffold(
-      resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset ?? false,
-      appBar: widget.noAppBar!
-          ? null
-          : AppBar(
-              iconTheme: widget.isWhite!
-                  ? const IconThemeData(
-                      color: Colors.black,
-                    )
-                  : const IconThemeData(
-                      color: Colors.white,
-                    ),
-              title: widget.rxTitle == null
-                  ? Text(
-                      widget.title ?? '',
-                      style: widget.titleStyle ??
-                          TextStyle(
-                              fontSize: 20.sp,
-                              color: '#333333'.getColor(),
-                              fontWeight: FontWeight.bold),
-                    )
-                  : Obx(() => Text(
-                        widget.rxTitle?.value ?? '',
-                        style: widget.titleStyle ??
-                            TextStyle(
-                                fontSize: 20.sp,
-                                color: '#333333'.getColor(),
-                                fontWeight: FontWeight.bold),
-                      )),
-              centerTitle: true,
-              elevation: 0,
-              leading: widget.leading! ? null : Container(),
-              backgroundColor:
-                  widget.isWhite! ? Colors.white : '#165DFF'.getColor(),
-              actions: widget.showWhs!
-                  ? [
-                      UnconstrainedBox(
-                        child: GestureDetector(
-                          behavior: HitTestBehavior.opaque,
-                          onTap: () {
-                            SmartManager().showSelectItem(
-                                Ids.pleaseSelectAWarehouse.tr, whsCodeList,
-                                (value) {
-                              actionStr.value = whsCodeList[value].split('_').first;
-                              widget.actionCallback?.call(
-                                  actionStr.value == Ids.allWarehouses.tr
-                                      ? ''
-                                      : actionStr.value);
-                            });
-                          },
-                          child: Container(
-                            width: 100.w,
-                            height: 30.h,
-                            decoration: BoxDecoration(
-                                borderRadius: BorderRadius.circular(10.w),
-                                border: Border.all(
-                                    color: Colors.black, width: 1.w)),
-                            alignment: Alignment.centerRight,
-                            child: Row(
-                              mainAxisSize: MainAxisSize.max,
-                              mainAxisAlignment: MainAxisAlignment.end,
-                              crossAxisAlignment: CrossAxisAlignment.center,
-                              children: [
-                                Obx(() => Text(
-                                      actionStr.value,
-                                      style: TextStyle(
-                                          fontSize: SPMSCoreConfig.baseTextSize,
-                                          color: Colors.black),
-                                    )),
-                                5.widthSizedBox,
-                                Icon(
-                                  Icons.keyboard_arrow_down,
-                                  color: Colors.black,
-                                  size: 20.w,
-                                )
-                              ],
-                            ),
-                          ),
-                        ),
-                      )
-                    ]
-                  : null),
+    _appBar=widget.noAppBar!
+        ? null
+        : AppBar(
+        iconTheme: widget.isWhite!
+            ? const IconThemeData(
+          color: Colors.black,
+        )
+            : const IconThemeData(
+          color: Colors.white,
+        ),
+        title: widget.rxTitle == null
+            ? Text(
+          widget.title ?? '',
+          style: widget.titleStyle ??
+              TextStyle(
+                  fontSize: 20.sp,
+                  color: '#333333'.getColor(),
+                  fontWeight: FontWeight.bold),
+        )
+            : Obx(() => Text(
+          widget.rxTitle?.value ?? '',
+          style: widget.titleStyle ??
+              TextStyle(
+                  fontSize: 20.sp,
+                  color: '#333333'.getColor(),
+                  fontWeight: FontWeight.bold),
+        )),
+        centerTitle: true,
+        elevation: 0,
+        leading: widget.leading! ? null : Container(),
+        backgroundColor:
+        widget.isWhite! ? Colors.white : '#165DFF'.getColor(),
+        actions: widget.showWhs!
+            ? [
+          UnconstrainedBox(
+            child: GestureDetector(
+              behavior: HitTestBehavior.opaque,
+              onTap: () {
+                SmartManager().showSelectItem(
+                    Ids.pleaseSelectAWarehouse.tr, whsCodeList,
+                        (value) {
+                      actionStr.value = whsCodeList[value].split('_').first;
+                      widget.actionCallback?.call(
+                          actionStr.value == Ids.allWarehouses.tr
+                              ? ''
+                              : actionStr.value);
+                    });
+              },
+              child: Container(
+                width: 100.w,
+                height: 30.h,
+                decoration: BoxDecoration(
+                    borderRadius: BorderRadius.circular(10.w),
+                    border: Border.all(
+                        color: Colors.black, width: 1.w)),
+                alignment: Alignment.centerRight,
+                child: Row(
+                  mainAxisSize: MainAxisSize.max,
+                  mainAxisAlignment: MainAxisAlignment.end,
+                  crossAxisAlignment: CrossAxisAlignment.center,
+                  children: [
+                    Obx(() => Text(
+                      actionStr.value,
+                      style: TextStyle(
+                          fontSize: SPMSCoreConfig.baseTextSize,
+                          color: Colors.black),
+                    )),
+                    5.widthSizedBox,
+                    Icon(
+                      Icons.keyboard_arrow_down,
+                      color: Colors.black,
+                      size: 20.w,
+                    )
+                  ],
+                ),
+              ),
+            ),
+          )
+        ]
+            : null);
+
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    debugPrint("MpScaffold-build");
+    return Scaffold(
+      resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset ?? false,
+      appBar: _appBar,
       body: WillPopScope(
           child: widget.child,
           onWillPop: () async {
