Procházet zdrojové kódy

我的房产的删除弹窗与页面完善

liukai před 1 týdnem
rodič
revize
a7eb00e316

+ 5 - 0
packages/cpt_auth/lib/router/component/auth_component_service.dart

@@ -25,4 +25,9 @@ class AuthComponentService extends AuthService {
   void startResetPasswordPage() {
     SelectEstatePage.startInstance();
   }
+
+  @override
+  void startSelectEstatePage() {
+    SelectEstatePage.startInstance();
+  }
 }

+ 133 - 0
packages/cpt_profile/lib/modules/my_estate/dialog/remove_account_dialog.dart

@@ -0,0 +1,133 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/generated/l10n.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/widget_export.dart';
+
+class RemoveAccountDialog extends StatelessWidget {
+  VoidCallback confirmAction;
+
+  RemoveAccountDialog({
+    required this.confirmAction,
+  });
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.center,
+      mainAxisAlignment: MainAxisAlignment.center,
+      children: [
+        Container(
+          width: double.infinity,
+          height: 55,
+          decoration: BoxDecoration(
+            color: context.appColors.btnBgDefault,
+            borderRadius: const BorderRadius.only(
+              topRight: Radius.circular(15),
+              topLeft: Radius.circular(15),
+            ),
+          ),
+          child: Row(
+            children: [
+              const SizedBox(width: 45),
+              MyTextView(
+                S.current.remove_account,
+                fontSize: 18,
+                textAlign: TextAlign.center,
+                isFontMedium: true,
+                textColor: Colors.white,
+              ).expanded(),
+              const MyAssetImage(
+                Assets.baseServiceDialogDeleteIcon,
+                width: 25,
+                height: 25.5,
+              ).onTap(() {
+                onCancel();
+              }, padding: 10)
+            ],
+          ),
+        ),
+        Container(
+          width: double.infinity,
+          padding: const EdgeInsets.only(top: 22),
+          decoration: BoxDecoration(
+            color: context.appColors.whiteSecondBG,
+            borderRadius: const BorderRadius.only(
+              bottomLeft: Radius.circular(15),
+              bottomRight: Radius.circular(15),
+            ),
+          ),
+          child: Column(
+            children: [
+              const MyAssetImage(Assets.profileRemoveAccountImg, width: 272, height: 180),
+
+              MyTextView(
+                S.current.remove_account_tips,
+                textAlign: TextAlign.center,
+                textColor: context.appColors.textBlack,
+                marginTop: 24,
+                paddingLeft: 30,
+                paddingRight: 30,
+                fontSize: 17,
+                isFontMedium: true,
+              ),
+
+              Row(
+                children: [
+                  const SizedBox(width: 18),
+                  Expanded(
+                      flex: 1,
+                      child: InkWell(
+                        onTap: () {
+                          onCancel();
+                        },
+                        child: MyTextView(
+                          S.current.no,
+                          fontSize: 16,
+                          isFontMedium: true,
+                          paddingTop: 13,
+                          marginRight: 15,
+                          paddingBottom: 13,
+                          textAlign: TextAlign.center,
+                          textColor: Colors.white,
+                          backgroundColor: context.appColors.orangeBG,
+                          cornerRadius: 7,
+                        ),
+                      )),
+                  Expanded(
+                      flex: 1,
+                      child: InkWell(
+                        onTap: () async {
+                          onCancel();
+                          confirmAction();
+                        },
+                        child: MyTextView(
+                          S.current.yes,
+                          fontSize: 16,
+                          paddingTop: 13,
+                          paddingBottom: 13,
+                          isFontMedium: true,
+                          textAlign: TextAlign.center,
+                          textColor: Colors.white,
+                          backgroundColor: context.appColors.btnBgDefault,
+                          cornerRadius: 7,
+                        ),
+                      )),
+                  const SizedBox(width: 18),
+                ],
+              ).marginOnly(bottom: 30, top: 28),
+            ],
+          ),
+        ),
+      ],
+    ).constrained(width: 340);
+  }
+
+//取消弹框
+  void onCancel() async {
+    SmartDialog.dismiss();
+  }
+}

+ 3 - 0
packages/cpt_profile/lib/modules/my_estate/item_estate.dart

@@ -8,10 +8,12 @@ import 'package:widgets/my_text_view.dart';
 class EstateItem extends StatelessWidget {
   final int childIndex;  //组内的索引
   final String item;
+  final VoidCallback deleteAction;
 
   const EstateItem({
     required this.childIndex,
     required this.item,
+    required this.deleteAction,
   });
 
   @override
@@ -53,6 +55,7 @@ class EstateItem extends StatelessWidget {
                         S.current.remove,
                         marginRight: 15,
                         fontSize: 16,
+                        onClick: deleteAction,
                         isFontMedium: true,
                         textColor: context.appColors.deleteRed,
                       ),

+ 56 - 30
packages/cpt_profile/lib/modules/my_estate/my_estate_page.dart

@@ -1,12 +1,16 @@
+import 'package:cpt_profile/modules/change_mobile/change_mobile_page.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/componentRouter/component_service_manager.dart';
 import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
+import 'package:widgets/my_button.dart';
 import 'package:widgets/widget_export.dart';
 import '../../router/page/profile_page_router.dart';
 import 'item_estate.dart';
@@ -46,45 +50,67 @@ class MyEstatePage extends HookConsumerWidget {
         backgroundColor: context.appColors.whiteBG,
       ),
       backgroundColor: context.appColors.backgroundDark,
-      body: SizedBox(
-        width: double.infinity,
-        height: double.infinity,
-        child: EasyRefresh(
-          controller: viewModel.refreshController,
-          onRefresh: viewModel.onRefresh,
-          onLoad: viewModel.loadMore,
-          child: LoadStateLayout(
-            state: state.loadingState,
-            errorMessage: state.errorMessage,
-            errorRetry: () {
-              viewModel.retryRequest();
+      body: Column(
+        mainAxisSize: MainAxisSize.max,
+        children: [
+          EasyRefresh(
+            controller: viewModel.refreshController,
+            onRefresh: viewModel.onRefresh,
+            onLoad: viewModel.loadMore,
+            child: LoadStateLayout(
+              state: state.loadingState,
+              errorMessage: state.errorMessage,
+              errorRetry: () {
+                viewModel.retryRequest();
+              },
+              successSliverWidget: [
+                SliverList(
+                    delegate: SliverChildBuilderDelegate(
+                  (context, index) {
+                    return StickyHeader(
+                      header: EstateItemHeader(state.datas[index].groupId),
+                      content: Column(
+                        children: _buildGroup(state.datas[index].groupDatas!, index,viewModel),
+                      ),
+                    );
+                  },
+                  childCount: state.datas.length,
+                ))
+              ],
+            ),
+          ).expanded(),
+          MyButton(
+            onPressed: () {
+              ComponentServiceManager().authService.startSelectEstatePage();
             },
-            successSliverWidget: [
-              SliverList(
-                  delegate: SliverChildBuilderDelegate(
-                (context, index) {
-                  return StickyHeader(
-                    header: EstateItemHeader(state.datas[index].groupId),
-                    content: Column(
-                      children: _buildGroup(state.datas[index].groupDatas!, index),
-                    ),
-                  );
-                },
-                childCount: state.datas.length,
-              ))
-            ],
-          ),
-        ),
+            text: S.current.add,
+            textColor: Colors.white,
+            backgroundColor: context.appColors.btnBgDefault,
+            fontWeight: FontWeight.w500,
+            type: ClickType.throttle,
+            fontSize: 16,
+            minHeight: 50,
+            radius: 0,
+          )
+        ],
       ),
     );
   }
 
   //当前组内的子数据
-  List<Widget> _buildGroup(List<String> list, int index) {
+  List<Widget> _buildGroup(List<String> list, int index, MyEstateViewModel viewModel) {
     return list
         .asMap()
         .map((childIndex, item) {
-          return MapEntry(childIndex, EstateItem(item: item, childIndex: childIndex));
+          return MapEntry(
+              childIndex,
+              EstateItem(
+                item: item,
+                childIndex: childIndex,
+                deleteAction: () {
+                  viewModel.showRemoveEstateDialog();
+                },
+              ));
         })
         .values
         .toList();

+ 11 - 0
packages/cpt_profile/lib/modules/my_estate/my_estate_view_model.dart

@@ -1,4 +1,7 @@
+import 'package:cpt_profile/modules/my_estate/dialog/remove_account_dialog.dart';
 import 'package:cpt_profile/modules/my_estate/estate_group_data.dart';
+import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/widget_export.dart';
@@ -147,5 +150,13 @@ class MyEstateViewModel extends _$MyEstateViewModel {
 //   }
 // }
 
+  /// 展示移除账号的提示弹窗
+  void showRemoveEstateDialog() {
+    DialogEngine.show(widget: RemoveAccountDialog(
+      confirmAction: () {
+        ToastEngine.show("确定去删除");
+      },
+    ));
+  }
 
 }

binární
packages/cs_resources/assets/profile/remove_account_img.webp


+ 1 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -108,6 +108,7 @@ class Assets {
   static const String profileEditProfileAvatarBottom = 'assets/profile/edit_profile_avatar_bottom.webp';
   static const String profileEditProfileAvatarDefault = 'assets/profile/edit_profile_avatar_default.webp';
   static const String profileEditXuLine = 'assets/profile/edit_xu_line.webp';
+  static const String profileRemoveAccountImg = 'assets/profile/remove_account_img.webp';
   static const String propertyAdvicePic = 'assets/property/advice_pic.webp';
   static const String propertyApproval = 'assets/property/approval.webp';
   static const String propertyCollection = 'assets/property/collection.webp';

+ 4 - 0
packages/cs_resources/lib/generated/intl/messages_en.dart

@@ -163,6 +163,10 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage("Published Successfully"),
         "rate_us": MessageLookupByLibrary.simpleMessage("Rate Us"),
         "remove": MessageLookupByLibrary.simpleMessage("Remove"),
+        "remove_account":
+            MessageLookupByLibrary.simpleMessage("Remove Account"),
+        "remove_account_tips": MessageLookupByLibrary.simpleMessage(
+            "Are you sure you want to remove your account?"),
         "resend_code": MessageLookupByLibrary.simpleMessage("Resend Code"),
         "reset_password":
             MessageLookupByLibrary.simpleMessage("Reset Password"),

+ 3 - 0
packages/cs_resources/lib/generated/intl/messages_zh_CN.dart

@@ -133,6 +133,9 @@ class MessageLookup extends MessageLookupByLibrary {
         "published_successfully": MessageLookupByLibrary.simpleMessage("发布成功"),
         "rate_us": MessageLookupByLibrary.simpleMessage("评价我们"),
         "remove": MessageLookupByLibrary.simpleMessage("移除"),
+        "remove_account": MessageLookupByLibrary.simpleMessage("移除账号"),
+        "remove_account_tips":
+            MessageLookupByLibrary.simpleMessage("你确定要移除你的账号吗?"),
         "resend_code": MessageLookupByLibrary.simpleMessage("重新发送"),
         "reset_password": MessageLookupByLibrary.simpleMessage("重置密码"),
         "rewards": MessageLookupByLibrary.simpleMessage("奖励"),

+ 3 - 0
packages/cs_resources/lib/generated/intl/messages_zh_HK.dart

@@ -125,6 +125,9 @@ class MessageLookup extends MessageLookupByLibrary {
         "published_successfully": MessageLookupByLibrary.simpleMessage("发布成功"),
         "rate_us": MessageLookupByLibrary.simpleMessage("评价我们"),
         "remove": MessageLookupByLibrary.simpleMessage("移除"),
+        "remove_account": MessageLookupByLibrary.simpleMessage("移除账号"),
+        "remove_account_tips":
+            MessageLookupByLibrary.simpleMessage("你确定要移除你的账号吗?"),
         "resend_code": MessageLookupByLibrary.simpleMessage("重新发送"),
         "reset_password": MessageLookupByLibrary.simpleMessage("重置密码"),
         "rewards": MessageLookupByLibrary.simpleMessage("獎勵"),

+ 20 - 0
packages/cs_resources/lib/generated/l10n.dart

@@ -1470,6 +1470,26 @@ class S {
     );
   }
 
+  /// `Remove Account`
+  String get remove_account {
+    return Intl.message(
+      'Remove Account',
+      name: 'remove_account',
+      desc: '',
+      args: [],
+    );
+  }
+
+  /// `Are you sure you want to remove your account?`
+  String get remove_account_tips {
+    return Intl.message(
+      'Are you sure you want to remove your account?',
+      name: 'remove_account_tips',
+      desc: '',
+      args: [],
+    );
+  }
+
   /// `Other`
   String get other {
     return Intl.message(

+ 2 - 0
packages/cs_resources/lib/l10n/intl_en.arb

@@ -141,5 +141,7 @@
   "remove": "Remove",
   "add": "Add",
   "household_members": "Household Members",
+  "remove_account": "Remove Account",
+  "remove_account_tips": "Are you sure you want to remove your account?",
   "other": "Other"
 }

+ 2 - 0
packages/cs_resources/lib/l10n/intl_zh_CN.arb

@@ -141,5 +141,7 @@
   "remove": "移除",
   "add": "添加",
   "household_members": "家庭成员",
+  "remove_account": "移除账号",
+  "remove_account_tips": "你确定要移除你的账号吗?",
   "other": "其他"
 }

+ 2 - 0
packages/cs_resources/lib/l10n/intl_zh_HK.arb

@@ -127,5 +127,7 @@
   "remove": "移除",
   "add": "添加",
   "household_members": "家庭成员",
+  "remove_account": "移除账号",
+  "remove_account_tips": "你确定要移除你的账号吗?",
   "other": "其他"
 }

+ 1 - 0
packages/cs_router/lib/componentRouter/auth_service.dart

@@ -7,4 +7,5 @@ abstract class AuthService {
 
   void startResetPasswordPage();
 
+  void startSelectEstatePage();
 }