order_management_page.dart 24 KB

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