From da7c03d30d0d144e7aed623235d0082eca502e23 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 22 Jan 2021 15:05:59 +0800 Subject: [PATCH 1/2] add delete dialog --- lib/pages/things_page/fixed_submit_page.dart | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index 36f40c92..35201bae 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -10,9 +10,11 @@ import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/horizontal_image_view.dart'; import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:akuCommunity/extensions/num_ext.dart'; @@ -143,6 +145,29 @@ class _FixedSubmitPageState extends State { )); } + Widget _showDeletDialog() { + return CupertinoAlertDialog( + title: '删除订单'.text.black.size(34.sp).make(), + content: '您确定要删除订单吗?'.text.black.size(28.sp).make(), + actions: [ + CupertinoDialogAction( + child: '先等等'.text.black.size(34.sp).make(), + onPressed: () { + Get.back(); + }, + ), + CupertinoDialogAction( + child: '删除订单'.text.color(Color(0xFFFF8200)).size(34.sp).bold.make(), + onPressed: () { + ManagerFunc.reportRepairDelete(_selected); + Get.back(); + _easyRefreshController.callRefresh(); + }, + ) + ], + ); + } + @override Widget build(BuildContext context) { UserProvider userProvider = Provider.of(context); @@ -188,8 +213,7 @@ class _FixedSubmitPageState extends State { MaterialButton( onPressed: _isEdit ? () { - ManagerFunc.reportRepairDelete(_selected); - _easyRefreshController.callRefresh(); + Get.dialog(_showDeletDialog()); } : () { userProvider.isLogin From ded21ef0b513c5b45569d0ac34898895ade10795 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 22 Jan 2021 15:25:38 +0800 Subject: [PATCH 2/2] update delete dialog --- lib/model/user/user_info_model.dart | 2 +- lib/pages/things_page/fixed_submit_page.dart | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/model/user/user_info_model.dart b/lib/model/user/user_info_model.dart index 869a9a5e..47a56716 100644 --- a/lib/model/user/user_info_model.dart +++ b/lib/model/user/user_info_model.dart @@ -37,7 +37,7 @@ class UserInfoModel { UserInfoModel.fromJson(Map json) { id = json['id']; - if (json['imgUrls'] != null) + if (json['imgUrls'] != null&&(json['imgUrls'] as List).length!=0) imgUrl = (json['imgUrls'] as List).first['url']; name = json['name']; nickName = json['nickName']; diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index 35201bae..60cb13be 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -147,17 +147,17 @@ class _FixedSubmitPageState extends State { Widget _showDeletDialog() { return CupertinoAlertDialog( - title: '删除订单'.text.black.size(34.sp).make(), - content: '您确定要删除订单吗?'.text.black.size(28.sp).make(), + title: '删除订单'.text.black.size(34.sp).isIntrinsic.make(), + content: '您确定要删除订单吗?'.text.black.size(28.sp).isIntrinsic.make(), actions: [ CupertinoDialogAction( - child: '先等等'.text.black.size(34.sp).make(), + child: '先等等'.text.black.size(34.sp).isIntrinsic.make(), onPressed: () { Get.back(); }, ), CupertinoDialogAction( - child: '删除订单'.text.color(Color(0xFFFF8200)).size(34.sp).bold.make(), + child: '删除订单'.text.color(Color(0xFFFF8200)).size(34.sp).bold.isIntrinsic.make(), onPressed: () { ManagerFunc.reportRepairDelete(_selected); Get.back();