Prechádzať zdrojové kódy

订单管理页提示栏

daxu0403 7 rokov pred
rodič
commit
cbb7639bf8

BIN
android/.gradle/4.10.2/fileHashes/fileHashes.bin


BIN
android/.gradle/4.10.2/fileHashes/fileHashes.lock


BIN
android/.gradle/4.10.2/taskHistory/taskHistory.bin


BIN
android/.gradle/4.10.2/taskHistory/taskHistory.lock


BIN
android/.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 223 - 94
lib/pages/order_management_page.dart

@@ -56,116 +56,245 @@ class QueryWidget extends StatefulWidget { //搜索栏
 }
 
 class _QueryWidgetState extends State < QueryWidget > {
+  GlobalKey _globalKey = GlobalKey();
+  List < bool > statusList = [true, false, false];
+  double inputPostX = 0;
+  double inputPostY = 0;
+  double inputWidth = 0;
+  double inputHeight = 0;
+  bool showStatus = true; //提示层显示状态
+  String orderNo;
 
+  @override
+  void didUpdateWidget(QueryWidget oldWidget) {
+    // TODO: implement didUpdateWidget
+    super.didUpdateWidget(oldWidget);
+    WidgetsBinding.instance.addPostFrameCallback(fun);
+  }
+
+
+  void fun(Duration timeStamp) {
+    RenderObject inputObj = _globalKey.currentContext.findRenderObject();
+    setState(() {
+      inputWidth = inputObj.paintBounds.size.width;
+      inputHeight = inputObj.paintBounds.size.height;
+      inputPostX = inputObj.getTransformTo(null).getTranslation().x;
+      inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
+    });
+  }
   @override
   Widget build(BuildContext context) {
-    return Container(
-      child: Column(
-        children: < Widget > [
-          Container(
-            color: Colors.white,
-            height: ScreenUtil.getInstance().setHeight(222),
-            padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
-            child: Column(
-              children: < Widget > [
-                Container(
-                  height: ScreenUtil.getInstance().setHeight(100),
-                  decoration: BoxDecoration(
-                    border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
-                    borderRadius: BorderRadius.all(Radius.circular(5))
-                  ),
-                  child: Row(
-                    children: < Widget > [
-                      Expanded(
-                        child: TextField(
-                          keyboardType: TextInputType.number,
-                          decoration: InputDecoration(
-                            border: InputBorder.none,
-                            hintText: "输入运单号查询物流",
-                            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)
-                          ),
-                        ),
-                      ),
-                      IconButton(
-                        icon: Image.asset('lib/images/icon_saoyisao.png',
-                          width: ScreenUtil.getInstance().setWidth(38),
-                          height: ScreenUtil.getInstance().setHeight(36),
-                        ),
-                        onPressed: () {},
+    return Stack(
+      children: < Widget > [
+        Container(
+          child: Column(
+            children: < Widget > [
+              Container(
+                color: Colors.white,
+                height: ScreenUtil.getInstance().setHeight(222),
+                padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
+                child: Column(
+                  children: < Widget > [
+                    Container(
+                      key: _globalKey,
+                      height: ScreenUtil.getInstance().setHeight(100),
+                      decoration: BoxDecoration(
+                        border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
+                        borderRadius: BorderRadius.all(Radius.circular(5))
                       ),
-                      GestureDetector(
-                        child: Container(
-                          width: ScreenUtil.getInstance().setWidth(120),
-                          decoration: BoxDecoration(
-                            border: Border(left: BorderSide.merge(BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 1), BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 0)), )
+                      child: Row(
+                        children: < Widget > [
+                          Expanded(
+                            child: TextField(
+                              keyboardType: TextInputType.number,
+                              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)
+                              ),
+                              onChanged: ((value) {
+                                setState(() {
+                                  orderNo = value;
+                                });
+                                if (orderNo.length >= 6) {
+                                  setState(() {
+                                    showStatus = false;
+                                  });
+                                } else {
+                                  setState(() {
+                                    showStatus = true;
+                                  });
+                                }
+                              }),
+                              onEditingComplete: () {
+                                FocusScope.of(context).requestFocus(FocusNode());
+                                setState(() {
+                                  showStatus = true;
+                                });
+                              },
+                            ),
                           ),
-                          child: Center(
-                            child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
+                          IconButton(
+                            icon: Image.asset('lib/images/icon_saoyisao.png',
+                              width: ScreenUtil.getInstance().setWidth(38),
+                              height: ScreenUtil.getInstance().setHeight(36),
+                            ),
+                            onPressed: () {},
                           ),
-                        ),
-                        onTap: () {
-                          print("查询");
-                        }
+                          GestureDetector(
+                            child: Container(
+                              width: ScreenUtil.getInstance().setWidth(120),
+                              decoration: BoxDecoration(
+                                border: Border(left: BorderSide.merge(BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 1), BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 0)), )
+                              ),
+                              child: Center(
+                                child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
+                              ),
+                            ),
+                            onTap: () {
+                              print("查询");
+                            }
+                          ),
+                        ],
                       ),
+                    ),
+                    Container(
+                      height: ScreenUtil.getInstance().setHeight(100),
+                      child: Container(
+                        padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
+                        child: Row(
+                          mainAxisAlignment: MainAxisAlignment.spaceAround,
+                          children: < Widget > [
+                            GestureDetector(
+                              child: Container(
+                                height: ScreenUtil.getInstance().setHeight(80),
+                                decoration: BoxDecoration(
+                                  border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
+                                ),
+                                child: Center(
+                                  child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
+                                )
+                              ),
+                              onTap: () {
+                                if (statusList[0]) {
+                                  return;
+                                } else {
+                                  setState(() {
+                                    statusList = [true, false, false];
+                                  });
+                                }
+                              },
+                            ),
+                            GestureDetector(
+                              child: Container(
+                                height: ScreenUtil.getInstance().setHeight(80),
+                                decoration: BoxDecoration(
+                                  border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
+                                ),
+                                child: Center(
+                                  child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
+                                )
+                              ),
+                              onTap: () {
+                                if (statusList[1]) {
+                                  return;
+                                } else {
+                                  setState(() {
+                                    statusList = [false, true, false];
+                                  });
+                                }
+                              },
+                            ),
+                            GestureDetector(
+                              child: Container(
+                                height: ScreenUtil.getInstance().setHeight(80),
+                                decoration: BoxDecoration(
+                                  border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
+                                ),
+                                child: Center(
+                                  child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
+                                )
+                              ),
+                              onTap: () {
+                                if (statusList[2]) {
+                                  return;
+                                } else {
+                                  setState(() {
+                                    statusList = [false, false, true];
+                                  });
+                                }
+                              },
+                            ),
+                          ],
+                        )
+                      )
+                    ),
+                  ],
+                )
+              ),
+              Expanded(
+                child: Container(
+                  padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
+                  child: ListView(
+                    children: < Widget > [
+                      _cardWiget(),
+                      _cardWiget(),
+                      _cardWiget(),
                     ],
                   ),
                 ),
-                Container(
-                  height: ScreenUtil.getInstance().setHeight(100),
-                  child: Container(
-                    padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
-                    child: Row(
-                      mainAxisAlignment: MainAxisAlignment.spaceAround,
-                      children: < Widget > [
-                        Container(
-                          height: ScreenUtil.getInstance().setHeight(80),
-                          decoration: BoxDecoration(
-                            border: Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), )
-                          ),
-                          child: Center(
-                            child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
-                          )
-                        ),
-                        Container(
-                          height: ScreenUtil.getInstance().setHeight(80),
-                          decoration: BoxDecoration(
-                            border: Border()
-                          ),
-                          child: Center(
-                            child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(155, 155, 155, 1)), ),
-                          )
-                        ),
-                        Container(
-                          height: ScreenUtil.getInstance().setHeight(80),
-                          decoration: BoxDecoration(
-                            border: Border()
-                          ),
-                          child: Center(
-                            child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(155, 155, 155, 1)), ),
-                          )
-                        ),
-                      ],
-                    )
-                  )
-                ),
-              ],
-            )
-          ),
-          Expanded(
-            child: Container(
-              padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
+              )
+            ],
+          )
+        ),
+        Positioned(
+          left: inputPostX,
+          top: inputPostY,
+          child: Offstage(
+            offstage: showStatus,
+            child:
+            Container(
+              width: inputWidth,
+              height: ScreenUtil.getInstance().setHeight(320),
+              margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
+              decoration: BoxDecoration(
+                color: Color.fromRGBO(244, 248, 251, 1),
+                border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
+                borderRadius: BorderRadius.all(Radius.circular(5))
+              ),
               child: ListView(
                 children: < Widget > [
-                  _cardWiget(),
-                  _cardWiget(),
-                  _cardWiget(),
+                  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"),
+                  ),
                 ],
               ),
             ),
           )
-        ],
-      )
+        )
+      ],
     );
   }
   Widget _cardWiget() {