Commit 1406fcaeee1e80115bb98dd2220fc3185bcfc2a7

Authored by wdn127929
1 parent e207a205

消费金额

@@ -78,6 +78,7 @@ class NotebookDetail { @@ -78,6 +78,7 @@ class NotebookDetail {
78 String abolition; 78 String abolition;
79 String tableinfo; 79 String tableinfo;
80 String pnum; 80 String pnum;
  81 + String actual_pum;
81 String rname; 82 String rname;
82 String sex; 83 String sex;
83 String phone; 84 String phone;
@@ -97,6 +98,7 @@ class NotebookDetail { @@ -97,6 +98,7 @@ class NotebookDetail {
97 Cancel cancel; 98 Cancel cancel;
98 Order order; 99 Order order;
99 OrderInfo orderInfo; 100 OrderInfo orderInfo;
  101 + String con_amount;
100 102
101 String get statuImgAssets { 103 String get statuImgAssets {
102 switch (status) { 104 switch (status) {
@@ -214,7 +216,7 @@ class NotebookDetail { @@ -214,7 +216,7 @@ class NotebookDetail {
214 216
215 @override 217 @override
216 String toString() { 218 String toString() {
217 - return 'NotebookDetail{id: $id, abolition: $abolition, tableinfo: $tableinfo, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, cusman: $cusman, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, action: $action, type: $type, note_name: $note_name, channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel}'; 219 + return 'NotebookDetail{id: $id, con_amount:$con_amount,abolition: $abolition, tableinfo: $tableinfo,actual_pum:$actual_pum, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, cusman: $cusman, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, action: $action, type: $type, note_name: $note_name, channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel}';
218 } 220 }
219 } 221 }
220 222
@@ -13,6 +13,8 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { @@ -13,6 +13,8 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
13 ..tableinfo = json['tableinfo'] as String 13 ..tableinfo = json['tableinfo'] as String
14 ..abolition = json['abolition'] as String 14 ..abolition = json['abolition'] as String
15 ..pnum = json['pnum'] as String 15 ..pnum = json['pnum'] as String
  16 + ..actual_pum = json['actual_pum'] as String
  17 + ..con_amount = json['con_amount'] as String
16 ..rname = json['rname'] as String 18 ..rname = json['rname'] as String
17 ..sex = json['sex'] as String 19 ..sex = json['sex'] as String
18 ..phone = json['phone'] as String 20 ..phone = json['phone'] as String
@@ -52,6 +54,8 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => @@ -52,6 +54,8 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
52 'tableinfo': instance.tableinfo, 54 'tableinfo': instance.tableinfo,
53 'abolition': instance.abolition, 55 'abolition': instance.abolition,
54 'pnum': instance.pnum, 56 'pnum': instance.pnum,
  57 + 'con_amount':instance.con_amount,
  58 + 'actual_pum':instance.actual_pum,
55 'rname': instance.rname, 59 'rname': instance.rname,
56 'sex': instance.sex, 60 'sex': instance.sex,
57 'phone': instance.phone, 61 'phone': instance.phone,
@@ -108,5 +108,7 @@ class HttpUrl { @@ -108,5 +108,7 @@ class HttpUrl {
108 static const String add_table = "?service=App.Tables.AddTable"; // 添加商家桌位信息 108 static const String add_table = "?service=App.Tables.AddTable"; // 添加商家桌位信息
109 static const String add_forward = 109 static const String add_forward =
110 "?service=App.Activity.AddForward"; // 客户经理转发记录 110 "?service=App.Activity.AddForward"; // 客户经理转发记录
  111 + static const String up_reserve_info =
  112 + "?service=App.Reserve.UpReserveInfo"; // 编辑订单附加信息
111 113
112 } 114 }
@@ -13,6 +13,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; @@ -13,6 +13,7 @@ import 'package:one_key/provider/notebook_detail_model.dart';
13 import 'package:one_key/provider/online_check_edit_provider.dart'; 13 import 'package:one_key/provider/online_check_edit_provider.dart';
14 import 'package:one_key/provider/user_model.dart'; 14 import 'package:one_key/provider/user_model.dart';
15 import 'package:one_key/res/colors.dart'; 15 import 'package:one_key/res/colors.dart';
  16 +import 'package:one_key/utils/NumLengthInputFormatter.dart';
16 import 'package:one_key/utils/dialog_util.dart'; 17 import 'package:one_key/utils/dialog_util.dart';
17 import 'package:one_key/utils/event_bus.dart'; 18 import 'package:one_key/utils/event_bus.dart';
18 import 'package:one_key/route/navigator_util.dart'; 19 import 'package:one_key/route/navigator_util.dart';
@@ -77,6 +78,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -77,6 +78,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
77 void initState() { 78 void initState() {
78 // TODO: implement initState 79 // TODO: implement initState
79 super.initState(); 80 super.initState();
  81 +
80 WidgetsBinding.instance.addPostFrameCallback((_) async { 82 WidgetsBinding.instance.addPostFrameCallback((_) async {
81 _initCancel(); 83 _initCancel();
82 _getReserveDetail(); 84 _getReserveDetail();
@@ -145,6 +147,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -145,6 +147,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
145 "rid": widget.rid, 147 "rid": widget.rid,
146 }); 148 });
147 setState(() { 149 setState(() {
  150 + detailModel.selectNum = detailEntity.actual_pum;
  151 + detailModel.selectIndex = detailEntity.actual_pum != null
  152 + ? personNumList.indexOf(detailEntity.actual_pum)
  153 + : null;
  154 + if (detailEntity.con_amount != null) {
  155 + detailModel.prestrTF = detailEntity.con_amount;
  156 + detailModel.numController.text = detailEntity.con_amount;
  157 + }
  158 + if (detailEntity.con_amount != null) {
  159 + detailModel.prestrTF = detailEntity.con_amount;
  160 + detailModel.strTF = detailEntity.con_amount;
  161 + detailModel.numController.text = detailEntity.con_amount;
  162 + }
  163 +
148 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 164 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
149 formatPhone = detailEntity.phone; 165 formatPhone = detailEntity.phone;
150 if (App.sp.getString("is_call_tel") != null && 166 if (App.sp.getString("is_call_tel") != null &&
@@ -219,6 +235,23 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -219,6 +235,23 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
219 } 235 }
220 } 236 }
221 237
  238 + ///编辑订单附加信息
  239 + Future<bool> _upReserveInfo({String actualPum, String conAmount}) async {
  240 + Map<String, dynamic> params = {
  241 + "rid": widget.rid,
  242 + };
  243 + if (actualPum != null) {
  244 + params['actual_pum'] = actualPum;
  245 + }
  246 + if (conAmount != null) {
  247 + params['con_amount'] = conAmount;
  248 + }
  249 + bool sucess = await detailModel.upReserveInfo(context, params);
  250 + if (sucess) {
  251 + Utils.showToast("修改成功!");
  252 + }
  253 + }
  254 +
222 /// 取消预订, 变更预订按钮 255 /// 取消预订, 变更预订按钮
223 Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title, 256 Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
224 {Color bgColor = MyColours.color_ffffff, 257 {Color bgColor = MyColours.color_ffffff,
@@ -542,11 +575,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -542,11 +575,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
542 offstage: detailEntity.type == "0" 575 offstage: detailEntity.type == "0"
543 ? false 576 ? false
544 : true, 577 : true,
545 - child: TitleAndTextfield( 578 + child: TitleAndBtn(
546 title: "用餐人数", 579 title: "用餐人数",
547 bookNum: detailEntity.pnum, 580 bookNum: detailEntity.pnum,
548 pnumlist: personNumList, 581 pnumlist: personNumList,
549 detailModel: model, 582 detailModel: model,
  583 + callback: () {
  584 + _upReserveInfo(
  585 + actualPum:
  586 + detailModel.selectNum);
  587 + },
550 ), 588 ),
551 ), 589 ),
552 Offstage( 590 Offstage(
@@ -627,6 +665,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -627,6 +665,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
627 ), 665 ),
628 ), 666 ),
629 )), 667 )),
  668 + TitleAndTextfield(
  669 + title: "消费金额",
  670 + detailModel: detailModel,
  671 + callback: () {
  672 + _upReserveInfo(
  673 + conAmount:
  674 + detailModel.prestrTF);
  675 + },
  676 + ),
630 RowMultiText( 677 RowMultiText(
631 "客户姓名", detailEntity.rnameStr), 678 "客户姓名", detailEntity.rnameStr),
632 InkWell( 679 InkWell(
@@ -1192,13 +1239,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -1192,13 +1239,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
1192 } 1239 }
1193 } 1240 }
1194 1241
1195 -class TitleAndTextfield extends StatelessWidget { 1242 +class TitleAndBtn extends StatelessWidget {
1196 final String title; 1243 final String title;
1197 final String bookNum; 1244 final String bookNum;
1198 final List<String> pnumlist; 1245 final List<String> pnumlist;
1199 final NotebookDetailModel detailModel; 1246 final NotebookDetailModel detailModel;
1200 - const TitleAndTextfield(  
1201 - {Key key, this.title, this.bookNum, this.pnumlist, this.detailModel}) 1247 + final VoidCallback callback;
  1248 + const TitleAndBtn(
  1249 + {Key key,
  1250 + this.title,
  1251 + this.bookNum,
  1252 + this.pnumlist,
  1253 + this.detailModel,
  1254 + this.callback})
1202 : super(key: key); 1255 : super(key: key);
1203 1256
1204 @override 1257 @override
@@ -1234,18 +1287,19 @@ class TitleAndTextfield extends StatelessWidget { @@ -1234,18 +1287,19 @@ class TitleAndTextfield extends StatelessWidget {
1234 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 1287 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
1235 DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) { 1288 DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
1236 if (value != null) { 1289 if (value != null) {
1237 - detailModel.selectNum = value.first; 1290 + detailModel.selectIndex = value.first;
  1291 + detailModel.selectNum = pnumlist[value.first];
1238 detailModel.notifyListeners(); 1292 detailModel.notifyListeners();
1239 // setState(() { 1293 // setState(() {
1240 // selectPnum = value.first; 1294 // selectPnum = value.first;
1241 // pnum = pnumlist[value.first]; 1295 // pnum = pnumlist[value.first];
1242 // }); 1296 // });
1243 - 1297 + callback();
1244 } 1298 }
1245 }, 1299 },
1246 - selecteds: detailModel.selectNum == null 1300 + selecteds: detailModel.selectIndex == null
1247 ? [] 1301 ? []
1248 - : [detailModel.selectNum]) 1302 + : [detailModel.selectIndex])
1249 .then((value) {}); 1303 .then((value) {});
1250 }, 1304 },
1251 child: Container( 1305 child: Container(
@@ -1277,54 +1331,122 @@ class TitleAndTextfield extends StatelessWidget { @@ -1277,54 +1331,122 @@ class TitleAndTextfield extends StatelessWidget {
1277 ])); 1331 ]));
1278 } 1332 }
1279 } 1333 }
1280 -// Container(  
1281 -// alignment: Alignment.center,  
1282 -// // color: Colors.red,  
1283 -// width: ScreenUtil().setWidth(114),  
1284 -// height: ScreenUtil().setWidth(50),  
1285 -// // padding: EdgeInsets.zero,  
1286 -// child: TextField(  
1287 -// controller: widget.model.numController,  
1288 -// maxLines: 1,  
1289 1334
1290 -// inputFormatters: [  
1291 -// LengthLimitingTextInputFormatter(3),  
1292 -// WhitelistingTextInputFormatter.digitsOnly  
1293 -// ],  
1294 -// //光标颜色  
1295 -// cursorColor:  
1296 -// MyColours.color_199095,  
1297 -// //输入文本的样式  
1298 -// style: TextStyle(  
1299 -// fontSize: ScreenUtil().setSp(30),  
1300 -// color: widget.isSelect  
1301 -// ? Colors.white  
1302 -// : MyColours.color_199095),  
1303 -// // controller: _cancelController,  
1304 -// focusNode: _cancelNode,  
1305 -// textAlignVertical: TextAlignVertical.bottom,  
1306 -// decoration: InputDecoration(  
1307 -// // fillColor: Colors.lightGreenAccent,  
1308 -// // filled: true,  
1309 -// border: OutlineInputBorder(borderSide: BorderSide.none),  
1310 -// hintText: "更多",  
1311 -// hintStyle: TextStyle(  
1312 -// color: widget.isSelect  
1313 -// ? Colors.white  
1314 -// : MyColours.color_199095,  
1315 -// fontSize: ScreenUtil().setSp(30),  
1316 -// ),  
1317 -// // contentPadding: EdgeInsets.only(  
1318 -// // bottom: ScreenUtil().setWidth(30)), //ios 17  
1319 -// // border: InputBorder.none,  
1320 -// ),  
1321 -// onChanged: (value) { 1335 +class TitleAndTextfield extends StatelessWidget {
  1336 + final String title;
  1337 + final String bookNum;
  1338 + final List<String> pnumlist;
  1339 + final NotebookDetailModel detailModel;
  1340 + final VoidCallback callback;
  1341 +
  1342 + const TitleAndTextfield(
  1343 + {Key key,
  1344 + this.title,
  1345 + this.bookNum,
  1346 + this.pnumlist,
  1347 + this.detailModel,
  1348 + this.callback})
  1349 + : super(key: key);
  1350 +
  1351 + @override
  1352 + Widget build(BuildContext context) {
  1353 + return Container(
  1354 + color: MyColours.color_ffffff,
  1355 + width: double.infinity,
  1356 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(25)),
  1357 + alignment: Alignment.center,
  1358 + child: Row(
  1359 + crossAxisAlignment: CrossAxisAlignment.center,
  1360 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1361 + children: <Widget>[
  1362 + Align(
  1363 + alignment: Alignment.centerLeft,
  1364 + child: Text(
  1365 + title,
  1366 + style: TextStyle(
  1367 + color: MyColours.color_828282,
  1368 + fontSize: ScreenUtil().setSp(30)),
  1369 + ),
  1370 + ),
  1371 + Container(
  1372 + decoration: BoxDecoration(
  1373 + border: Border(
  1374 + bottom: BorderSide(
  1375 + width: ScreenUtil().setWidth(2),
  1376 + color: MyColours.color_199095))),
  1377 + child: IntrinsicWidth(
  1378 + child: TextField(
  1379 + controller: detailModel.numController,
  1380 + maxLines: 1,
  1381 + // inputFormatters: [
  1382 + // LengthLimitingTextInputFormatter(9),
  1383 + // WhitelistingTextInputFormatter.digitsOnly
  1384 + // ],
  1385 + inputFormatters: [
  1386 + NumLengthInputFormatter(
  1387 + decimalLength: 2, integerLength: 6),
  1388 + ],
  1389 + //光标颜色
  1390 + cursorColor: MyColours.color_199095,
  1391 + //输入文本的样式
  1392 + style: TextStyle(
  1393 + fontSize: ScreenUtil().setSp(30),
  1394 + color: MyColours.color_199095),
  1395 + textAlign: TextAlign.right,
  1396 + decoration: InputDecoration(
  1397 + hintText: "修改",
  1398 + hintStyle: TextStyle(
  1399 + color: MyColours.color_199095,
  1400 + fontSize: ScreenUtil().setSp(30),
  1401 + ),
  1402 + prefixIcon: detailModel.strTF != null &&
  1403 + detailModel.strTF.trim().length > 0
  1404 + ? Text("¥",
  1405 + style: TextStyle(color: MyColours.color_199095))
  1406 + : SizedBox(), //添加内部左边图标
  1407 + prefixIconConstraints: BoxConstraints(
  1408 + //添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
  1409 + ),
1322 1410
1323 -// },  
1324 -// onEditingComplete: () {  
1325 -// // _cancelNode.unfocus(); 1411 + // contentPadding: EdgeInsets.only(
  1412 + // bottom: ScreenUtil().setWidth(30)), //ios 17
  1413 + border: InputBorder.none,
  1414 + ),
  1415 + onChanged: (value) {
  1416 + detailModel.strTF = value;
1326 1417
1327 -// },  
1328 -// keyboardType: TextInputType.number,  
1329 -// ),  
1330 -// ) 1418 + print(detailModel.numController.text);
  1419 + detailModel.notifyListeners();
  1420 + },
  1421 + onEditingComplete: () {
  1422 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  1423 + if (detailModel.prestrTF == null ||
  1424 + detailModel.prestrTF == "") {
  1425 + //修改之前无内容,不弹框
  1426 + detailModel.prestrTF = detailModel.numController.text;
  1427 + callback();
  1428 + } else {
  1429 + //修改之前有内容,则弹框
  1430 + DialogUtil.cupertinoAlertDialog(context,
  1431 + title: "是否修改",
  1432 + content: "金额已修改,是否保存为新修改的金额",
  1433 + lTitle: "不保存",
  1434 + rTitle: "确认修改", lCallback: () {
  1435 + print("取消");
  1436 + detailModel.numController.text =
  1437 + detailModel.prestrTF == null
  1438 + ? ""
  1439 + : detailModel.prestrTF;
  1440 + detailModel.strTF = detailModel.numController.text;
  1441 + }, rCallback: () {
  1442 + print("确定");
  1443 + detailModel.prestrTF = detailModel.numController.text;
  1444 + callback();
  1445 + });
  1446 + }
  1447 + },
  1448 + keyboardType: TextInputType.number,
  1449 + )))
  1450 + ]));
  1451 + }
  1452 +}
@@ -114,6 +114,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver { @@ -114,6 +114,8 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
114 super.didChangeDependencies(); 114 super.didChangeDependencies();
115 } 115 }
116 116
  117 +
  118 +
117 //监听输入框,设置登录按钮状态 119 //监听输入框,设置登录按钮状态
118 setActivate() { 120 setActivate() {
119 if (_sellerCodeController.text.isNotEmpty && 121 if (_sellerCodeController.text.isNotEmpty &&
@@ -14,7 +14,11 @@ import 'package:provider/provider.dart'; @@ -14,7 +14,11 @@ import 'package:provider/provider.dart';
14 14
15 class NotebookDetailModel extends ChangeNotifier { 15 class NotebookDetailModel extends ChangeNotifier {
16 PageState pageState = PageState.Loading; 16 PageState pageState = PageState.Loading;
17 - int selectNum; 17 + String selectNum;
  18 + int selectIndex;
  19 + TextEditingController numController = TextEditingController();
  20 + String strTF;
  21 + String prestrTF;
18 22
19 ///获取已预订订单 23 ///获取已预订订单
20 Future<NotebookDetail> getReserveDetail( 24 Future<NotebookDetail> getReserveDetail(
@@ -134,4 +138,22 @@ class NotebookDetailModel extends ChangeNotifier { @@ -134,4 +138,22 @@ class NotebookDetailModel extends ChangeNotifier {
134 Utils.showToast(baseResp.msg); 138 Utils.showToast(baseResp.msg);
135 } 139 }
136 } 140 }
  141 +
  142 + // 编辑订单附加信息
  143 + Future<bool> upReserveInfo(BuildContext context, Map<String, dynamic> params,
  144 + {ifPush = true, showLoading = false}) async {
  145 + BaseResp<dynamic> baseResp = await DioUtil()
  146 + .request<dynamic>(context, Method.get, HttpUrl.up_reserve_info,
  147 + data: params, showLoading: showLoading)
  148 + .catchError((error) {
  149 + print(error.toString());
  150 + });
  151 + if (baseResp == null) return false;
  152 + if (baseResp.code == Constant.status_success && baseResp.data != null) {
  153 + return true;
  154 + } else {
  155 + Utils.showToast(baseResp.msg);
  156 + return false;
  157 + }
  158 + }
137 } 159 }
  1 +import 'package:flutter/services.dart';
  2 +
  3 +class NumLengthInputFormatter extends TextInputFormatter {
  4 + int decimalLength;
  5 + int integerLength;
  6 + bool allowInputDecimal;
  7 +
  8 + NumLengthInputFormatter({this.decimalLength = 2, this.integerLength = 8}) : super();
  9 +
  10 + @override
  11 + TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
  12 + String value = newValue.text;
  13 + int selectionIndex = newValue.selection.end;
  14 + if (newValue.text.contains('.')) {
  15 + int pointIndex = newValue.text.indexOf('.');
  16 + String beforePoint = newValue.text.substring(0, pointIndex);
  17 + print('$beforePoint');
  18 + //小数点前内容大于integerLength
  19 + if (beforePoint.length > integerLength) {
  20 + value = oldValue.text;
  21 + selectionIndex = oldValue.selection.end;
  22 + } else
  23 + //小数点前内容小于等于integerLength
  24 + {
  25 + String afterPoint = newValue.text.substring(pointIndex + 1, newValue.text.length);
  26 + if (afterPoint.length > decimalLength) {
  27 + value = oldValue.text;
  28 + selectionIndex = oldValue.selection.end;
  29 + }
  30 + }
  31 + } else {
  32 + if (newValue.text.length > integerLength) {
  33 + value = oldValue.text;
  34 + selectionIndex = oldValue.selection.end;
  35 + }
  36 + }
  37 + return new TextEditingValue(
  38 + text: value,
  39 + selection: new TextSelection.collapsed(offset: selectionIndex),
  40 + );
  41 + }
  42 +}
  43 +
@@ -2,6 +2,7 @@ import 'dart:convert'; @@ -2,6 +2,7 @@ import 'dart:convert';
2 import 'dart:ui'; 2 import 'dart:ui';
3 3
4 import 'package:common_utils/common_utils.dart'; 4 import 'package:common_utils/common_utils.dart';
  5 +import 'package:flutter/cupertino.dart';
5 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
6 import 'package:flutter_picker/flutter_picker.dart'; 7 import 'package:flutter_picker/flutter_picker.dart';
7 import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -1875,4 +1876,52 @@ class DialogUtil { @@ -1875,4 +1876,52 @@ class DialogUtil {
1875 // default: 1876 // default:
1876 } 1877 }
1877 } 1878 }
  1879 +
  1880 + static Future cupertinoAlertDialog(BuildContext context,
  1881 + {String title = "标题",
  1882 + String content = "内容",
  1883 + String lTitle = "取消",
  1884 + String rTitle = "确定",
  1885 + VoidCallback lCallback,
  1886 + VoidCallback rCallback}) {
  1887 + showCupertinoDialog(
  1888 + context: context,
  1889 + builder: (context) {
  1890 + return CupertinoAlertDialog(
  1891 + title: Text(title,
  1892 + style: TextStyle(
  1893 + fontWeight: FontWeight.bold,
  1894 + fontSize: ScreenUtil().setSp(30),
  1895 + color: MyColours.color_353535)),
  1896 + content: Text(content,
  1897 + style: TextStyle(
  1898 + fontSize: ScreenUtil().setSp(30),
  1899 + color: MyColours.color_353535)),
  1900 + actions: [
  1901 + CupertinoDialogAction(
  1902 + child: Text(lTitle,
  1903 + style: TextStyle(
  1904 + fontSize: ScreenUtil().setSp(34),
  1905 + color: MyColours.color_666666)),
  1906 + onPressed: () {
  1907 + Navigator.of(context).pop();
  1908 + lCallback();
  1909 + },
  1910 + ),
  1911 + CupertinoDialogAction(
  1912 + child: Text(rTitle,
  1913 + style: TextStyle(
  1914 + fontSize: ScreenUtil().setSp(34),
  1915 + color: MyColours.color_199095)),
  1916 + onPressed: () {
  1917 + Navigator.of(context).pop();
  1918 + rCallback();
  1919 + },
  1920 + ),
  1921 + ],
  1922 + insetAnimationDuration: Duration(seconds: 2),
  1923 + );
  1924 + },
  1925 + );
  1926 + }
1878 } 1927 }