order_management_page.dart 25 KB

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