order_management_page.dart 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'order_management_page/order_detail_page.dart';
  4. class OrderManagementPage extends StatefulWidget {
  5. final Widget child;
  6. OrderManagementPage({
  7. Key key,
  8. this.child
  9. }): super(key: key);
  10. _OrderManagementPageState createState() => _OrderManagementPageState();
  11. }
  12. class _OrderManagementPageState extends State < OrderManagementPage > with AutomaticKeepAliveClientMixin {
  13. @override
  14. Widget build(BuildContext context) {
  15. return Container(
  16. child: Scaffold(
  17. appBar: AppBar(
  18. title: Text('订单管理', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
  19. centerTitle: true,
  20. backgroundColor: Color.fromRGBO(64, 98, 254, 1),
  21. // actions: < Widget > [
  22. // IconButton(
  23. // icon: Icon(Icons.add_circle_outline),
  24. // onPressed: () {},
  25. // )
  26. // ],
  27. ),
  28. body: Container(
  29. decoration: BoxDecoration(
  30. color: Color.fromRGBO(246, 246, 254, 1)
  31. ),
  32. child: QueryWidget()
  33. ),
  34. resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
  35. )
  36. );
  37. }
  38. @override
  39. bool get wantKeepAlive => true;
  40. }
  41. class QueryWidget extends StatefulWidget { //搜索栏
  42. final Widget child;
  43. QueryWidget({
  44. Key key,
  45. this.child
  46. }): super(key: key);
  47. _QueryWidgetState createState() => _QueryWidgetState();
  48. }
  49. class _QueryWidgetState extends State < QueryWidget > {
  50. GlobalKey _globalKey = GlobalKey();
  51. List < bool > statusList = [true, false, false];
  52. double inputPostX = 0;
  53. double inputPostY = 0;
  54. double inputWidth = 0;
  55. double inputHeight = 0;
  56. bool showStatus = true; //提示层显示状态
  57. String orderNo;
  58. @override
  59. void didUpdateWidget(QueryWidget oldWidget) {
  60. // TODO: implement didUpdateWidget
  61. super.didUpdateWidget(oldWidget);
  62. WidgetsBinding.instance.addPostFrameCallback(fun);
  63. }
  64. void fun(Duration timeStamp) {
  65. RenderObject inputObj = _globalKey.currentContext.findRenderObject();
  66. setState(() {
  67. inputWidth = inputObj.paintBounds.size.width;
  68. inputHeight = inputObj.paintBounds.size.height;
  69. inputPostX = inputObj.getTransformTo(null).getTranslation().x;
  70. inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
  71. });
  72. }
  73. @override
  74. Widget build(BuildContext context) {
  75. return Stack(
  76. children: < Widget > [
  77. Container(
  78. child: Column(
  79. children: < Widget > [
  80. Container(
  81. color: Colors.white,
  82. height: ScreenUtil.getInstance().setHeight(222),
  83. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  84. child: Column(
  85. children: < Widget > [
  86. Container(
  87. key: _globalKey,
  88. height: ScreenUtil.getInstance().setHeight(100),
  89. decoration: BoxDecoration(
  90. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  91. borderRadius: BorderRadius.all(Radius.circular(5))
  92. ),
  93. child: Row(
  94. children: < Widget > [
  95. Expanded(
  96. child: TextField(
  97. keyboardType: TextInputType.number,
  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. onChanged: ((value) {
  105. setState(() {
  106. orderNo = value;
  107. });
  108. if (orderNo.length >= 6) {
  109. setState(() {
  110. showStatus = false;
  111. });
  112. } else {
  113. setState(() {
  114. showStatus = true;
  115. });
  116. }
  117. }),
  118. onEditingComplete: () {
  119. FocusScope.of(context).requestFocus(FocusNode());
  120. setState(() {
  121. showStatus = true;
  122. });
  123. },
  124. ),
  125. ),
  126. IconButton(
  127. icon: Image.asset('lib/images/icon_saoyisao.png',
  128. width: ScreenUtil.getInstance().setWidth(38),
  129. height: ScreenUtil.getInstance().setHeight(36),
  130. ),
  131. onPressed: () {},
  132. ),
  133. GestureDetector(
  134. child: Container(
  135. width: ScreenUtil.getInstance().setWidth(120),
  136. decoration: BoxDecoration(
  137. 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)), )
  138. ),
  139. child: Center(
  140. child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
  141. ),
  142. ),
  143. onTap: () {
  144. print("查询");
  145. }
  146. ),
  147. ],
  148. ),
  149. ),
  150. Container(
  151. height: ScreenUtil.getInstance().setHeight(100),
  152. child: Container(
  153. padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
  154. child: Row(
  155. mainAxisAlignment: MainAxisAlignment.spaceAround,
  156. children: < Widget > [
  157. GestureDetector(
  158. child: Container(
  159. height: ScreenUtil.getInstance().setHeight(80),
  160. decoration: BoxDecoration(
  161. border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  162. ),
  163. child: Center(
  164. child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  165. )
  166. ),
  167. onTap: () {
  168. if (statusList[0]) {
  169. return;
  170. } else {
  171. setState(() {
  172. statusList = [true, false, false];
  173. });
  174. }
  175. },
  176. ),
  177. GestureDetector(
  178. child: Container(
  179. height: ScreenUtil.getInstance().setHeight(80),
  180. decoration: BoxDecoration(
  181. border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  182. ),
  183. child: Center(
  184. child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  185. )
  186. ),
  187. onTap: () {
  188. if (statusList[1]) {
  189. return;
  190. } else {
  191. setState(() {
  192. statusList = [false, true, false];
  193. });
  194. }
  195. },
  196. ),
  197. GestureDetector(
  198. child: Container(
  199. height: ScreenUtil.getInstance().setHeight(80),
  200. decoration: BoxDecoration(
  201. border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  202. ),
  203. child: Center(
  204. child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  205. )
  206. ),
  207. onTap: () {
  208. if (statusList[2]) {
  209. return;
  210. } else {
  211. setState(() {
  212. statusList = [false, false, true];
  213. });
  214. }
  215. },
  216. ),
  217. ],
  218. )
  219. )
  220. ),
  221. ],
  222. )
  223. ),
  224. Expanded(
  225. child: Container(
  226. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  227. child: ListView(
  228. children: < Widget > [
  229. _cardWiget(),
  230. _cardWiget(),
  231. _cardWiget(),
  232. ],
  233. ),
  234. ),
  235. )
  236. ],
  237. )
  238. ),
  239. Positioned(
  240. left: inputPostX,
  241. top: inputPostY,
  242. child: Offstage(
  243. offstage: showStatus,
  244. child:
  245. Container(
  246. width: inputWidth,
  247. height: ScreenUtil.getInstance().setHeight(320),
  248. margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
  249. decoration: BoxDecoration(
  250. color: Color.fromRGBO(244, 248, 251, 1),
  251. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  252. borderRadius: BorderRadius.all(Radius.circular(5))
  253. ),
  254. child: ListView(
  255. children: < Widget > [
  256. Padding(
  257. padding: EdgeInsets.all(10),
  258. child: Text("11012312312312312313123131"),
  259. ),
  260. Padding(
  261. padding: EdgeInsets.all(10),
  262. child: Text("11012312312312312313123131"),
  263. ),
  264. Padding(
  265. padding: EdgeInsets.all(10),
  266. child: Text("11012312312312312313123131"),
  267. ),
  268. Padding(
  269. padding: EdgeInsets.all(10),
  270. child: Text("11012312312312312313123131"),
  271. ),
  272. Padding(
  273. padding: EdgeInsets.all(10),
  274. child: Text("11012312312312312313123131"),
  275. ),
  276. Padding(
  277. padding: EdgeInsets.all(10),
  278. child: Text("11012312312312312313123131"),
  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: Container(
  350. width: ScreenUtil.getInstance().setWidth(94),
  351. height: ScreenUtil.getInstance().setHeight(48),
  352. decoration: BoxDecoration(
  353. color: Color.fromRGBO(239, 243, 249, 1),
  354. borderRadius: BorderRadius.all(Radius.circular(4.0))
  355. ),
  356. child: Center(
  357. child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  358. ),
  359. ),
  360. onTap: () {
  361. print("作废");
  362. },
  363. ),
  364. GestureDetector(
  365. child: Container(
  366. width: ScreenUtil.getInstance().setWidth(94),
  367. height: ScreenUtil.getInstance().setHeight(48),
  368. decoration: BoxDecoration(
  369. color: Color.fromRGBO(239, 243, 249, 1),
  370. borderRadius: BorderRadius.all(Radius.circular(4.0))
  371. ),
  372. child: Center(
  373. child: Text('寄件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  374. ),
  375. ),
  376. onTap: () {
  377. print("寄件");
  378. },
  379. )
  380. ],
  381. )
  382. ],
  383. ),
  384. )
  385. ),
  386. onTap: () {
  387. Navigator.push(context, MaterialPageRoute(builder: (context) {
  388. return OrderDetailPage(orderId: 123456, );
  389. }));
  390. },
  391. );
  392. }
  393. }