order_management_page.dart 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'order_management_page/order_detail_page.dart';
  4. import '../showDialog.dart';
  5. class OrderManagementPage extends StatefulWidget {
  6. final Widget child;
  7. OrderManagementPage({
  8. Key key,
  9. this.child
  10. }): super(key: key);
  11. _OrderManagementPageState createState() => _OrderManagementPageState();
  12. }
  13. class _OrderManagementPageState extends State < OrderManagementPage > with AutomaticKeepAliveClientMixin {
  14. @override
  15. Widget build(BuildContext context) {
  16. return Container(
  17. child: Scaffold(
  18. appBar: AppBar(
  19. title: Text('订单管理', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
  20. centerTitle: true,
  21. backgroundColor: Color.fromRGBO(64, 98, 254, 1),
  22. // actions: < Widget > [
  23. // IconButton(
  24. // icon: Icon(Icons.add_circle_outline),
  25. // onPressed: () {},
  26. // )
  27. // ],
  28. ),
  29. body: Container(
  30. decoration: BoxDecoration(
  31. color: Color.fromRGBO(246, 246, 254, 1)
  32. ),
  33. child: QueryWidget()
  34. ),
  35. resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
  36. )
  37. );
  38. }
  39. @override
  40. bool get wantKeepAlive => true;
  41. }
  42. class QueryWidget extends StatefulWidget { //搜索栏
  43. final Widget child;
  44. QueryWidget({
  45. Key key,
  46. this.child
  47. }): super(key: key);
  48. _QueryWidgetState createState() => _QueryWidgetState();
  49. }
  50. class _QueryWidgetState extends State < QueryWidget > {
  51. //单号的输入框控制器
  52. TextEditingController _orderController = TextEditingController();
  53. GlobalKey _globalKey = GlobalKey(); //搜索栏key
  54. List < bool > statusList = [true, false, false];
  55. double inputPostX = 0;
  56. double inputPostY = 0;
  57. double inputWidth = 0;
  58. double inputHeight = 0;
  59. bool showStatus = true; //提示层显示状态
  60. String _orderNo = "";
  61. @override
  62. Widget build(BuildContext context) {
  63. return Stack(
  64. children: < Widget > [
  65. Container(
  66. child: Column(
  67. children: < Widget > [
  68. Container(
  69. color: Colors.white,
  70. height: ScreenUtil.getInstance().setHeight(222),
  71. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  72. child: Column(
  73. children: < Widget > [
  74. Container(
  75. key: _globalKey,
  76. height: ScreenUtil.getInstance().setHeight(100),
  77. decoration: BoxDecoration(
  78. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  79. borderRadius: BorderRadius.all(Radius.circular(5))
  80. ),
  81. child: Row(
  82. children: < Widget > [
  83. Expanded(
  84. child: TextField(
  85. controller: _orderController,
  86. keyboardType: TextInputType.number,
  87. autofocus: true,
  88. autocorrect: true,
  89. decoration: InputDecoration(
  90. border: InputBorder.none,
  91. hintText: "输入运单号后6位查询物流",
  92. hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(155, 155, 155, 1)),
  93. contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), 0, ScreenUtil.getInstance().setWidth(30), 0)
  94. ),
  95. onTap: () {
  96. RenderObject inputObj = _globalKey.currentContext.findRenderObject();
  97. setState(() {
  98. inputWidth = inputObj.paintBounds.size.width;
  99. inputHeight = inputObj.paintBounds.size.height;
  100. inputPostX = inputObj.getTransformTo(null).getTranslation().x;
  101. inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
  102. });
  103. },
  104. onChanged: ((value) {
  105. print(value);
  106. setState(() {
  107. _orderNo = value;
  108. });
  109. if (_orderNo.length >= 6) {
  110. setState(() {
  111. showStatus = false;
  112. });
  113. } else {
  114. setState(() {
  115. showStatus = true;
  116. });
  117. }
  118. }),
  119. onEditingComplete: () {
  120. FocusScope.of(context).requestFocus(FocusNode());
  121. setState(() {
  122. showStatus = true;
  123. });
  124. },
  125. ),
  126. ),
  127. IconButton(
  128. icon: Image.asset('lib/images/icon_saoyisao.png',
  129. width: ScreenUtil.getInstance().setWidth(38),
  130. height: ScreenUtil.getInstance().setHeight(36),
  131. ),
  132. onPressed: () {},
  133. ),
  134. GestureDetector(
  135. child: Container(
  136. width: ScreenUtil.getInstance().setWidth(120),
  137. decoration: BoxDecoration(
  138. 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)), )
  139. ),
  140. child: Center(
  141. child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
  142. ),
  143. ),
  144. onTap: () {
  145. print("查询");
  146. }
  147. ),
  148. ],
  149. ),
  150. ),
  151. Container(
  152. height: ScreenUtil.getInstance().setHeight(100),
  153. child: Container(
  154. padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
  155. child: Row(
  156. mainAxisAlignment: MainAxisAlignment.spaceAround,
  157. children: < Widget > [
  158. GestureDetector(
  159. child: Container(
  160. height: ScreenUtil.getInstance().setHeight(80),
  161. decoration: BoxDecoration(
  162. border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  163. ),
  164. child: Center(
  165. child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  166. )
  167. ),
  168. onTap: () {
  169. if (statusList[0]) {
  170. return;
  171. } else {
  172. setState(() {
  173. statusList = [true, false, false];
  174. });
  175. }
  176. },
  177. ),
  178. GestureDetector(
  179. child: Container(
  180. height: ScreenUtil.getInstance().setHeight(80),
  181. decoration: BoxDecoration(
  182. border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  183. ),
  184. child: Center(
  185. child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  186. )
  187. ),
  188. onTap: () {
  189. if (statusList[1]) {
  190. return;
  191. } else {
  192. setState(() {
  193. statusList = [false, true, false];
  194. });
  195. }
  196. },
  197. ),
  198. GestureDetector(
  199. child: Container(
  200. height: ScreenUtil.getInstance().setHeight(80),
  201. decoration: BoxDecoration(
  202. border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  203. ),
  204. child: Center(
  205. child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  206. )
  207. ),
  208. onTap: () {
  209. if (statusList[2]) {
  210. return;
  211. } else {
  212. setState(() {
  213. statusList = [false, false, true];
  214. });
  215. }
  216. },
  217. ),
  218. ],
  219. )
  220. )
  221. ),
  222. ],
  223. )
  224. ),
  225. Expanded(
  226. child: Container(
  227. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  228. child: ListView(
  229. children: < Widget > [
  230. _cardWiget(),
  231. _cardWiget(),
  232. _cardWiget(),
  233. ],
  234. ),
  235. ),
  236. )
  237. ],
  238. )
  239. ),
  240. Positioned(
  241. left: inputPostX,
  242. top: inputPostY,
  243. child: Offstage(
  244. offstage: showStatus,
  245. child:
  246. Container(
  247. width: inputWidth,
  248. height: ScreenUtil.getInstance().setHeight(320),
  249. margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
  250. decoration: BoxDecoration(
  251. color: Color.fromRGBO(244, 248, 251, 1),
  252. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  253. borderRadius: BorderRadius.all(Radius.circular(5))
  254. ),
  255. child: ListView(
  256. children: < Widget > [
  257. InkWell(
  258. child: Padding(
  259. padding: EdgeInsets.all(10),
  260. child: Text("11012312312312312313123131"),
  261. ),
  262. onTap: () {
  263. setState(() {
  264. _orderController.text = ('11122223333333');
  265. showStatus = true;
  266. FocusScope.of(context).requestFocus(FocusNode());
  267. });
  268. },
  269. )
  270. ],
  271. ),
  272. ),
  273. )
  274. )
  275. ],
  276. );
  277. }
  278. Widget _cardWiget() {
  279. return GestureDetector(
  280. child: Card(
  281. color: Colors.white,
  282. child: Container(
  283. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(20)),
  284. child: Column(
  285. children: < Widget > [
  286. Padding(
  287. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  288. child: Row(
  289. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  290. children: < Widget > [
  291. Text('订单号:10893477897899', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
  292. Text("待取货", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
  293. ],
  294. )
  295. ),
  296. Padding(
  297. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  298. child: Row(
  299. children: < Widget > [
  300. Text('朝阳门大阳汽贸 --> 香河汽修厂', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
  301. ],
  302. )
  303. ),
  304. Padding(
  305. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(15)),
  306. child: Row(
  307. children: < Widget > [
  308. SizedBox(
  309. width: ScreenUtil.getInstance().setWidth(355),
  310. child: Text('货物名称:汽车轮胎', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  311. ),
  312. Text('代收款:2800元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  313. ],
  314. ),
  315. ),
  316. Padding(
  317. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  318. child: Row(
  319. children: < Widget > [
  320. SizedBox(
  321. width: ScreenUtil.getInstance().setWidth(355),
  322. child: Text('货物件数:4件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  323. ),
  324. Text('运费:280元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  325. ],
  326. ),
  327. ),
  328. Padding(
  329. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  330. child: Container(
  331. height: ScreenUtil.getInstance().setHeight(1),
  332. color: Color.fromRGBO(223, 223, 223, 1),
  333. ),
  334. ),
  335. Row(
  336. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  337. children: < Widget > [
  338. GestureDetector(
  339. child: Offstage(
  340. offstage: false,
  341. child: Container(
  342. width: ScreenUtil.getInstance().setWidth(94),
  343. height: ScreenUtil.getInstance().setHeight(48),
  344. decoration: BoxDecoration(
  345. color: Color.fromRGBO(239, 243, 249, 1),
  346. borderRadius: BorderRadius.all(Radius.circular(4.0))
  347. ),
  348. child: Center(
  349. child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  350. ),
  351. ),
  352. ),
  353. onTap: () {
  354. showDialog < Null > (
  355. context: context, //BuildContext对象
  356. barrierDismissible: false,
  357. builder: (BuildContext context) {
  358. return new LoadingDialog( //调用对话框
  359. text:'是否确认作废',childCallback: (val){
  360. if(val){
  361. //widget.callback(widget.index);
  362. }else{
  363. return;
  364. }
  365. },
  366. );
  367. });
  368. print("作废");
  369. },
  370. ),
  371. GestureDetector(
  372. child: Offstage(
  373. offstage: false,
  374. child: Container(
  375. width: ScreenUtil.getInstance().setWidth(94),
  376. height: ScreenUtil.getInstance().setHeight(48),
  377. decoration: BoxDecoration(
  378. color: Color.fromRGBO(239, 243, 249, 1),
  379. borderRadius: BorderRadius.all(Radius.circular(4.0))
  380. ),
  381. child: Center(
  382. child: Text('拒收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  383. ),
  384. ),
  385. ),
  386. onTap: () {
  387. showDialog < Null > (
  388. context: context, //BuildContext对象
  389. barrierDismissible: false,
  390. builder: (BuildContext context) {
  391. return new LoadingDialog( //调用对话框
  392. text:'是否确认拒收',childCallback: (val){
  393. if(val){
  394. //widget.callback(widget.index);
  395. }else{
  396. return;
  397. }
  398. },
  399. );
  400. });
  401. print("拒收");
  402. },
  403. ),
  404. GestureDetector(
  405. child: Offstage(
  406. offstage: false,
  407. child: Container(
  408. width: ScreenUtil.getInstance().setWidth(94),
  409. height: ScreenUtil.getInstance().setHeight(48),
  410. decoration: BoxDecoration(
  411. color: Color.fromRGBO(239, 243, 249, 1),
  412. borderRadius: BorderRadius.all(Radius.circular(4.0))
  413. ),
  414. child: Center(
  415. child: Text('签收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  416. ),
  417. ),
  418. ),
  419. onTap: () {
  420. showDialog < Null > (
  421. context: context, //BuildContext对象
  422. barrierDismissible: false,
  423. builder: (BuildContext context) {
  424. return new LoadingDialog( //调用对话框
  425. text:'是否确认签收',childCallback: (val){
  426. if(val){
  427. //widget.callback(widget.index);
  428. }else{
  429. return;
  430. }
  431. },
  432. );
  433. });
  434. print("签收");
  435. },
  436. ),
  437. GestureDetector(
  438. child: Offstage(
  439. offstage: false,
  440. child: Container(
  441. width: ScreenUtil.getInstance().setWidth(94),
  442. height: ScreenUtil.getInstance().setHeight(48),
  443. decoration: BoxDecoration(
  444. color: Color.fromRGBO(239, 243, 249, 1),
  445. borderRadius: BorderRadius.all(Radius.circular(4.0))
  446. ),
  447. child: Center(
  448. child: Text('改单', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  449. ),
  450. ),
  451. ),
  452. onTap: () {
  453. showDialog < Null > (
  454. context: context, //BuildContext对象
  455. barrierDismissible: false,
  456. builder: (BuildContext context) {
  457. return new LoadingDialog( //调用对话框
  458. text:'是否确认改单',childCallback: (val){
  459. if(val){
  460. print(val);
  461. Navigator.push(context, MaterialPageRoute(builder: (context) {
  462. return OrderDetailPage(orderId: 123456, );
  463. }));
  464. }else{
  465. return;
  466. }
  467. },
  468. );
  469. });
  470. print("改单");
  471. },
  472. ),
  473. GestureDetector(
  474. child: Offstage(
  475. offstage: false,
  476. child: Container(
  477. width: ScreenUtil.getInstance().setWidth(94),
  478. height: ScreenUtil.getInstance().setHeight(48),
  479. decoration: BoxDecoration(
  480. color: Color.fromRGBO(239, 243, 249, 1),
  481. borderRadius: BorderRadius.all(Radius.circular(4.0))
  482. ),
  483. child: Center(
  484. child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  485. ),
  486. ),
  487. ),
  488. onTap: () {
  489. showDialog < Null > (
  490. context: context, //BuildContext对象
  491. barrierDismissible: false,
  492. builder: (BuildContext context) {
  493. return new LoadingDialog( //调用对话框
  494. text:'是否确认打印',childCallback: (val){
  495. if(val){
  496. //widget.callback(widget.index);
  497. }else{
  498. return;
  499. }
  500. },
  501. );
  502. });
  503. print("打印");
  504. },
  505. ),
  506. ],
  507. )
  508. ],
  509. ),
  510. )
  511. ),
  512. onTap: () {
  513. },
  514. );
  515. }
  516. }