From 2a177dba877e27fbb15e64806b1b3772d5905d29 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Thu, 14 Oct 2021 11:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/order_view/order_status.dart | 16 +++- lib/store/store_order.dart | 6 +- lib/store/store_view/settlement.dart | 45 +++++++-- lib/view_widget/rename_dialog.dart | 12 +++ lib/view_widget/rename_dialog_content.dart | 104 +++++++++++++++++++++ 5 files changed, 173 insertions(+), 10 deletions(-) create mode 100644 lib/view_widget/rename_dialog.dart create mode 100644 lib/view_widget/rename_dialog_content.dart diff --git a/lib/order/order_view/order_status.dart b/lib/order/order_view/order_status.dart index 5aad2bbc..ab3af21a 100644 --- a/lib/order/order_view/order_status.dart +++ b/lib/order/order_view/order_status.dart @@ -91,7 +91,7 @@ class _OrderStatus extends State { ), ), Image.asset( - "assets/image/order_ok.png", + statusPicture(widget.title), height: 66.h, width:66.w, ), @@ -205,6 +205,18 @@ class _OrderStatus extends State { ]; } - + statusPicture(String status) { + String tripStatus = "assets/image/wait_meal.png"; + if (status.contains(S.of(context).dingdanyiwancheng)) { + tripStatus = "assets/image/order_ok.png"; + } else if (status.contains(S.of(context).dingdanyituikuan)) { + tripStatus = "assets/image/order_refund.png"; + } else if (status.contains(S.of(context).quxiaodingdan)) { + tripStatus = "assets/image/oeder_cancel.png"; + } else if (status.contains(S.of(context).dengdaiyonghuqucan)) { + tripStatus = "assets/image/wait_meal.png"; + } + return tripStatus; + } } \ No newline at end of file diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 2c497735..6155c501 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -365,7 +365,11 @@ class _StoreOrderPage extends State onTap: () { Navigator.of(context).pushNamed( '/router/settlement', - arguments: widget.arguments, + arguments: { + "storeName": storeInfo.storeName, + "address": storeInfo.address, + "headMobile": storeInfo.headMobile, + }, ); }, child: RoundButton( diff --git a/lib/store/store_view/settlement.dart b/lib/store/store_view/settlement.dart index 06605b0d..8a7f2ab8 100644 --- a/lib/store/store_view/settlement.dart +++ b/lib/store/store_view/settlement.dart @@ -7,10 +7,13 @@ import 'package:huixiang/order/order_view/order_commodity.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/rename_dialog.dart'; +import 'package:huixiang/view_widget/rename_dialog_content.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -47,6 +50,7 @@ class _Settlement extends State { } OrderInfo orderInfo; + StoreInfo storeInfo; int payStatus = 0; int orderStatus = 0; int sendStatus = 0; @@ -204,6 +208,7 @@ class _Settlement extends State { String title = ""; String center = ""; + TextEditingController _vc = TextEditingController(); statusTitle() { if (isTakeOut == 0) { @@ -441,7 +446,7 @@ class _Settlement extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "前进麦味·天然烘焙(凯德1818店)", + storeInfo != null ? (storeInfo.storeName ?? "") : "", overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14.sp, @@ -453,7 +458,7 @@ class _Settlement extends State { height: 4, ), Text( - "武昌区中国铁建凯德1818蓝调步行街中北路109附33门牌号05", + storeInfo != null ? storeInfo.address : "", overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -515,17 +520,22 @@ class _Settlement extends State { ), )), Text( - "12309090909", + storeInfo != null ? storeInfo.headMobile:"", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, color: Color(0xFF4C4C4C), ), ), - Image.asset( - "assets/image/pen.png", - height:14.h, - width:14.w, + GestureDetector( + onTap: (){ + showAlertDialog(); + }, + child:Image.asset( + "assets/image/pen.png", + height:14.h, + width:14.w, + ), ), ], ) @@ -793,6 +803,27 @@ class _Settlement extends State { ); } + showAlertDialog() { + //显示对话框 + showDialog( + barrierDismissible: false, + context: context, + builder: (context) { + return RenameDialog( + contentWidget: RenameDialogContent( + title: "请输入新的手机号码", + okBtnTap: () { + // print( + // "输入框中的文字为:${_vc.text}", + // ); + }, + vc: _vc, + cancelBtnTap: () {}, + ), + ); + }); + } + var checkIndex = 1; Widget checkView(var index) { diff --git a/lib/view_widget/rename_dialog.dart b/lib/view_widget/rename_dialog.dart new file mode 100644 index 00000000..9ad45101 --- /dev/null +++ b/lib/view_widget/rename_dialog.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class RenameDialog extends AlertDialog { + RenameDialog({Widget contentWidget}) + : super( + content: contentWidget, + contentPadding: EdgeInsets.zero, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + side: BorderSide(color: Colors.white, width: 3)), + ); +} diff --git a/lib/view_widget/rename_dialog_content.dart b/lib/view_widget/rename_dialog_content.dart new file mode 100644 index 00000000..98e6362d --- /dev/null +++ b/lib/view_widget/rename_dialog_content.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; + +double btnHeight = 60; +double borderWidth = 2; + +class RenameDialogContent extends StatefulWidget { + final String title; + final VoidCallback cancelBtnTap; + final VoidCallback okBtnTap; + final TextEditingController vc; + RenameDialogContent( + {@required this.title, + this.cancelBtnTap, + this.okBtnTap, + this.vc}); + + @override + _RenameDialogContentState createState() => + _RenameDialogContentState(); +} + +class _RenameDialogContentState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 20), + height: 200, + width: 10000, + alignment: Alignment.bottomCenter, + child: Column( + children: [ + Container( + alignment: Alignment.center, + child: Text( + widget.title, + style: TextStyle(color: Colors.grey), + )), + Spacer(), + Padding( + padding: EdgeInsets.fromLTRB(30, 0, 30, 0), + child: TextField( + style: TextStyle(color: Colors.black87), + controller: widget.vc, + decoration: InputDecoration( + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.black), + )), + ), + ), + Container( + // color: Colors.red, + height: btnHeight, + margin: EdgeInsets.fromLTRB(0, 30, 0, 0), + child: Column( + children: [ + Container( + // 按钮上面的横线 + width: double.infinity, + color: Colors.white, + height: borderWidth, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + FlatButton( + onPressed: () { + widget.vc.text = ""; + widget.cancelBtnTap(); + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).quxiao, + style: TextStyle(fontSize: 18, color: Colors.black), + ), + ), + Container( + // 按钮中间的竖线 + width: borderWidth, + color: Colors.grey, + height: btnHeight - borderWidth - borderWidth, + ), + FlatButton( + onPressed: () { + widget.okBtnTap(); + Navigator.of(context).pop(); + widget.vc.text = ""; + }, + child: Text( + S.of(context).queding, + style: TextStyle(fontSize:18, color: Colors.black), + )), + ], + ), + ], + ), + ) + ], + )); + } +}