瀏覽代碼

订单管理页填写运单号逻辑

daxu0403 7 年之前
父節點
當前提交
ad62f02fb1

二進制
android/.gradle/4.10.2/fileHashes/fileHashes.bin


二進制
android/.gradle/4.10.2/fileHashes/fileHashes.lock


二進制
android/.gradle/4.10.2/taskHistory/taskHistory.bin


二進制
android/.gradle/4.10.2/taskHistory/taskHistory.lock


二進制
android/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 183 - 53
lib/pages/order_management_page.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'order_management_page/order_detail_page.dart';
-
+import '../showDialog.dart';
 class OrderManagementPage extends StatefulWidget {
   final Widget child;
 
@@ -56,14 +56,17 @@ class QueryWidget extends StatefulWidget { //搜索栏
 }
 
 class _QueryWidgetState extends State < QueryWidget > {
-  GlobalKey _globalKey = GlobalKey();//搜索栏key
+  //单号的输入框控制器
+  TextEditingController _orderController = TextEditingController();
+
+  GlobalKey _globalKey = GlobalKey(); //搜索栏key
   List < bool > statusList = [true, false, false];
   double inputPostX = 0;
   double inputPostY = 0;
   double inputWidth = 0;
   double inputHeight = 0;
   bool showStatus = true; //提示层显示状态
-  String orderNo;
+  String _orderNo = "";
 
   @override
   Widget build(BuildContext context) {
@@ -89,14 +92,17 @@ class _QueryWidgetState extends State < QueryWidget > {
                         children: < Widget > [
                           Expanded(
                             child: TextField(
+                              controller: _orderController,
                               keyboardType: TextInputType.number,
+                              autofocus: true,
+                              autocorrect: true,
                               decoration: InputDecoration(
                                 border: InputBorder.none,
                                 hintText: "输入运单号后6位查询物流",
                                 hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(155, 155, 155, 1)),
                                 contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), 0, ScreenUtil.getInstance().setWidth(30), 0)
                               ),
-                              onTap: (){
+                              onTap: () {
                                 RenderObject inputObj = _globalKey.currentContext.findRenderObject();
                                 setState(() {
                                   inputWidth = inputObj.paintBounds.size.width;
@@ -106,10 +112,11 @@ class _QueryWidgetState extends State < QueryWidget > {
                                 });
                               },
                               onChanged: ((value) {
+                                print(value);
                                 setState(() {
-                                  orderNo = value;
+                                  _orderNo = value;
                                 });
-                                if (orderNo.length >= 6) {
+                                if (_orderNo.length >= 6) {
                                   setState(() {
                                     showStatus = false;
                                   });
@@ -257,30 +264,20 @@ class _QueryWidgetState extends State < QueryWidget > {
               ),
               child: ListView(
                 children: < Widget > [
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
-                  Padding(
-                    padding: EdgeInsets.all(10),
-                    child: Text("11012312312312312313123131"),
-                  ),
+                  InkWell(
+                    child: Padding(
+                      padding: EdgeInsets.all(10),
+                      child: Text("11012312312312312313123131"),
+                    ),
+                    onTap: () {
+                      setState(() {
+                        _orderController.text = ('11122223333333');
+                        showStatus = true;
+                        FocusScope.of(context).requestFocus(FocusNode());
+                      });
+                    },
+                  )
+
                 ],
               ),
             ),
@@ -350,38 +347,173 @@ class _QueryWidgetState extends State < QueryWidget > {
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: < Widget > [
                   GestureDetector(
-                    child: Container(
-                      width: ScreenUtil.getInstance().setWidth(94),
-                      height: ScreenUtil.getInstance().setHeight(48),
-                      decoration: BoxDecoration(
-                        color: Color.fromRGBO(239, 243, 249, 1),
-                        borderRadius: BorderRadius.all(Radius.circular(4.0))
-                      ),
-                      child: Center(
-                        child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                    child: Offstage(
+                      offstage: false,
+                      child: Container(
+                        width: ScreenUtil.getInstance().setWidth(94),
+                        height: ScreenUtil.getInstance().setHeight(48),
+                        decoration: BoxDecoration(
+                          color: Color.fromRGBO(239, 243, 249, 1),
+                          borderRadius: BorderRadius.all(Radius.circular(4.0))
+                        ),
+                        child: Center(
+                          child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                        ),
                       ),
                     ),
                     onTap: () {
+                      showDialog < Null > (
+                      context: context, //BuildContext对象
+                      barrierDismissible: false,
+                      builder: (BuildContext context) {
+                        return new LoadingDialog( //调用对话框
+                          text:'是否确认作废',childCallback: (val){
+                            if(val){
+                              //widget.callback(widget.index);
+                            }else{
+                              return;
+                            }
+                          },
+                        );
+                      });
                       print("作废");
                     },
                   ),
                   GestureDetector(
-                    child: Container(
-                      width: ScreenUtil.getInstance().setWidth(94),
-                      height: ScreenUtil.getInstance().setHeight(48),
-                      decoration: BoxDecoration(
-                        color: Color.fromRGBO(239, 243, 249, 1),
-                        borderRadius: BorderRadius.all(Radius.circular(4.0))
+                    child: Offstage(
+                      offstage: false,
+                      child: Container(
+                        width: ScreenUtil.getInstance().setWidth(94),
+                        height: ScreenUtil.getInstance().setHeight(48),
+                        decoration: BoxDecoration(
+                          color: Color.fromRGBO(239, 243, 249, 1),
+                          borderRadius: BorderRadius.all(Radius.circular(4.0))
+                        ),
+                        child: Center(
+                          child: Text('拒收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                        ),
                       ),
-                      child: Center(
-                        child: Text('寄件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                    ),
+                    onTap: () {
+                      showDialog < Null > (
+                      context: context, //BuildContext对象
+                      barrierDismissible: false,
+                      builder: (BuildContext context) {
+                        return new LoadingDialog( //调用对话框
+                          text:'是否确认拒收',childCallback: (val){
+                            if(val){
+                              //widget.callback(widget.index);
+                            }else{
+                              return;
+                            }
+                          },
+                        );
+                      });
+                      print("拒收");
+                    },
+                  ),
+                  GestureDetector(
+                    child: Offstage(
+                      offstage: false,
+                      child: Container(
+                        width: ScreenUtil.getInstance().setWidth(94),
+                        height: ScreenUtil.getInstance().setHeight(48),
+                        decoration: BoxDecoration(
+                          color: Color.fromRGBO(239, 243, 249, 1),
+                          borderRadius: BorderRadius.all(Radius.circular(4.0))
+                        ),
+                        child: Center(
+                          child: Text('签收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                        ),
                       ),
                     ),
                     onTap: () {
-                      print("寄件");
+                      showDialog < Null > (
+                      context: context, //BuildContext对象
+                      barrierDismissible: false,
+                      builder: (BuildContext context) {
+                        return new LoadingDialog( //调用对话框
+                          text:'是否确认签收',childCallback: (val){
+                            if(val){
+                              //widget.callback(widget.index);
+                            }else{
+                              return;
+                            }
+                          },
+                        );
+                      });
+                      print("签收");
                     },
-                  )
-
+                  ),
+                  GestureDetector(
+                    child: Offstage(
+                      offstage: false,
+                      child: Container(
+                        width: ScreenUtil.getInstance().setWidth(94),
+                        height: ScreenUtil.getInstance().setHeight(48),
+                        decoration: BoxDecoration(
+                          color: Color.fromRGBO(239, 243, 249, 1),
+                          borderRadius: BorderRadius.all(Radius.circular(4.0))
+                        ),
+                        child: Center(
+                          child: Text('改单', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                        ),
+                      ),
+                    ),
+                    onTap: () {
+                      showDialog < Null > (
+                      context: context, //BuildContext对象
+                      barrierDismissible: false,
+                      builder: (BuildContext context) {
+                        return new LoadingDialog( //调用对话框
+                          text:'是否确认改单',childCallback: (val){
+                            if(val){
+                              print(val);
+                               Navigator.push(context, MaterialPageRoute(builder: (context) {
+                                  return OrderDetailPage(orderId: 123456, );
+                                }));
+                            }else{
+                              return;
+                            }
+                          },
+                        );
+                      });
+                      print("改单");
+                    },
+                  ),
+                  GestureDetector(
+                    child: Offstage(
+                      offstage: false,
+                      child: Container(
+                        width: ScreenUtil.getInstance().setWidth(94),
+                        height: ScreenUtil.getInstance().setHeight(48),
+                        decoration: BoxDecoration(
+                          color: Color.fromRGBO(239, 243, 249, 1),
+                          borderRadius: BorderRadius.all(Radius.circular(4.0))
+                        ),
+                        child: Center(
+                          child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
+                        ),
+                      ),
+                    ),
+                    onTap: () {
+                      showDialog < Null > (
+                      context: context, //BuildContext对象
+                      barrierDismissible: false,
+                      builder: (BuildContext context) {
+                        return new LoadingDialog( //调用对话框
+                          text:'是否确认打印',childCallback: (val){
+                            if(val){
+                              //widget.callback(widget.index);
+                            }else{
+                              return;
+                            }
+                          },
+                        );
+                      });
+                      print("打印");
+                    },
+                  ),
                 ],
               )
             ],
@@ -389,9 +521,7 @@ class _QueryWidgetState extends State < QueryWidget > {
         )
       ),
       onTap: () {
-        Navigator.push(context, MaterialPageRoute(builder: (context) {
-          return OrderDetailPage(orderId: 123456, );
-        }));
+       
       },
     );
   }

+ 1 - 1
lib/showDialog.dart

@@ -82,8 +82,8 @@ class LoadingDialog extends Dialog {
                               )
                             ),
                             onTap: (){
+                               Navigator.pop(context);
                               childCallback(true);
-                              Navigator.pop(context);
                             },
                           )