order_management_page.dart 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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();//搜索栏key
  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. Widget build(BuildContext context) {
  60. return Stack(
  61. children: < Widget > [
  62. Container(
  63. child: Column(
  64. children: < Widget > [
  65. Container(
  66. color: Colors.white,
  67. height: ScreenUtil.getInstance().setHeight(222),
  68. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  69. child: Column(
  70. children: < Widget > [
  71. Container(
  72. key: _globalKey,
  73. height: ScreenUtil.getInstance().setHeight(100),
  74. decoration: BoxDecoration(
  75. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  76. borderRadius: BorderRadius.all(Radius.circular(5))
  77. ),
  78. child: Row(
  79. children: < Widget > [
  80. Expanded(
  81. child: TextField(
  82. keyboardType: TextInputType.number,
  83. decoration: InputDecoration(
  84. border: InputBorder.none,
  85. hintText: "输入运单号后6位查询物流",
  86. hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(155, 155, 155, 1)),
  87. contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), 0, ScreenUtil.getInstance().setWidth(30), 0)
  88. ),
  89. onTap: (){
  90. RenderObject inputObj = _globalKey.currentContext.findRenderObject();
  91. setState(() {
  92. inputWidth = inputObj.paintBounds.size.width;
  93. inputHeight = inputObj.paintBounds.size.height;
  94. inputPostX = inputObj.getTransformTo(null).getTranslation().x;
  95. inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
  96. });
  97. },
  98. onChanged: ((value) {
  99. setState(() {
  100. orderNo = value;
  101. });
  102. if (orderNo.length >= 6) {
  103. setState(() {
  104. showStatus = false;
  105. });
  106. } else {
  107. setState(() {
  108. showStatus = true;
  109. });
  110. }
  111. }),
  112. onEditingComplete: () {
  113. FocusScope.of(context).requestFocus(FocusNode());
  114. setState(() {
  115. showStatus = true;
  116. });
  117. },
  118. ),
  119. ),
  120. IconButton(
  121. icon: Image.asset('lib/images/icon_saoyisao.png',
  122. width: ScreenUtil.getInstance().setWidth(38),
  123. height: ScreenUtil.getInstance().setHeight(36),
  124. ),
  125. onPressed: () {},
  126. ),
  127. GestureDetector(
  128. child: Container(
  129. width: ScreenUtil.getInstance().setWidth(120),
  130. decoration: BoxDecoration(
  131. 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)), )
  132. ),
  133. child: Center(
  134. child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
  135. ),
  136. ),
  137. onTap: () {
  138. print("查询");
  139. }
  140. ),
  141. ],
  142. ),
  143. ),
  144. Container(
  145. height: ScreenUtil.getInstance().setHeight(100),
  146. child: Container(
  147. padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
  148. child: Row(
  149. mainAxisAlignment: MainAxisAlignment.spaceAround,
  150. children: < Widget > [
  151. GestureDetector(
  152. child: Container(
  153. height: ScreenUtil.getInstance().setHeight(80),
  154. decoration: BoxDecoration(
  155. border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  156. ),
  157. child: Center(
  158. child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  159. )
  160. ),
  161. onTap: () {
  162. if (statusList[0]) {
  163. return;
  164. } else {
  165. setState(() {
  166. statusList = [true, false, false];
  167. });
  168. }
  169. },
  170. ),
  171. GestureDetector(
  172. child: Container(
  173. height: ScreenUtil.getInstance().setHeight(80),
  174. decoration: BoxDecoration(
  175. border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  176. ),
  177. child: Center(
  178. child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  179. )
  180. ),
  181. onTap: () {
  182. if (statusList[1]) {
  183. return;
  184. } else {
  185. setState(() {
  186. statusList = [false, true, false];
  187. });
  188. }
  189. },
  190. ),
  191. GestureDetector(
  192. child: Container(
  193. height: ScreenUtil.getInstance().setHeight(80),
  194. decoration: BoxDecoration(
  195. border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  196. ),
  197. child: Center(
  198. child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  199. )
  200. ),
  201. onTap: () {
  202. if (statusList[2]) {
  203. return;
  204. } else {
  205. setState(() {
  206. statusList = [false, false, true];
  207. });
  208. }
  209. },
  210. ),
  211. ],
  212. )
  213. )
  214. ),
  215. ],
  216. )
  217. ),
  218. Expanded(
  219. child: Container(
  220. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  221. child: ListView(
  222. children: < Widget > [
  223. _cardWiget(),
  224. _cardWiget(),
  225. _cardWiget(),
  226. ],
  227. ),
  228. ),
  229. )
  230. ],
  231. )
  232. ),
  233. Positioned(
  234. left: inputPostX,
  235. top: inputPostY,
  236. child: Offstage(
  237. offstage: showStatus,
  238. child:
  239. Container(
  240. width: inputWidth,
  241. height: ScreenUtil.getInstance().setHeight(320),
  242. margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
  243. decoration: BoxDecoration(
  244. color: Color.fromRGBO(244, 248, 251, 1),
  245. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  246. borderRadius: BorderRadius.all(Radius.circular(5))
  247. ),
  248. child: ListView(
  249. children: < Widget > [
  250. Padding(
  251. padding: EdgeInsets.all(10),
  252. child: Text("11012312312312312313123131"),
  253. ),
  254. Padding(
  255. padding: EdgeInsets.all(10),
  256. child: Text("11012312312312312313123131"),
  257. ),
  258. Padding(
  259. padding: EdgeInsets.all(10),
  260. child: Text("11012312312312312313123131"),
  261. ),
  262. Padding(
  263. padding: EdgeInsets.all(10),
  264. child: Text("11012312312312312313123131"),
  265. ),
  266. Padding(
  267. padding: EdgeInsets.all(10),
  268. child: Text("11012312312312312313123131"),
  269. ),
  270. Padding(
  271. padding: EdgeInsets.all(10),
  272. child: Text("11012312312312312313123131"),
  273. ),
  274. ],
  275. ),
  276. ),
  277. )
  278. )
  279. ],
  280. );
  281. }
  282. Widget _cardWiget() {
  283. return GestureDetector(
  284. child: Card(
  285. color: Colors.white,
  286. child: Container(
  287. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(20)),
  288. child: Column(
  289. children: < Widget > [
  290. Padding(
  291. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  292. child: Row(
  293. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  294. children: < Widget > [
  295. Text('订单号:10893477897899', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
  296. Text("待取货", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
  297. ],
  298. )
  299. ),
  300. Padding(
  301. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  302. child: Row(
  303. children: < Widget > [
  304. Text('朝阳门大阳汽贸 --> 香河汽修厂', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
  305. ],
  306. )
  307. ),
  308. Padding(
  309. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(15)),
  310. child: Row(
  311. children: < Widget > [
  312. SizedBox(
  313. width: ScreenUtil.getInstance().setWidth(355),
  314. child: Text('货物名称:汽车轮胎', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  315. ),
  316. Text('代收款:2800元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  317. ],
  318. ),
  319. ),
  320. Padding(
  321. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  322. child: Row(
  323. children: < Widget > [
  324. SizedBox(
  325. width: ScreenUtil.getInstance().setWidth(355),
  326. child: Text('货物件数:4件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  327. ),
  328. Text('运费:280元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  329. ],
  330. ),
  331. ),
  332. Padding(
  333. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  334. child: Container(
  335. height: ScreenUtil.getInstance().setHeight(1),
  336. color: Color.fromRGBO(223, 223, 223, 1),
  337. ),
  338. ),
  339. Row(
  340. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  341. children: < Widget > [
  342. GestureDetector(
  343. child: Container(
  344. width: ScreenUtil.getInstance().setWidth(94),
  345. height: ScreenUtil.getInstance().setHeight(48),
  346. decoration: BoxDecoration(
  347. color: Color.fromRGBO(239, 243, 249, 1),
  348. borderRadius: BorderRadius.all(Radius.circular(4.0))
  349. ),
  350. child: Center(
  351. child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  352. ),
  353. ),
  354. onTap: () {
  355. print("作废");
  356. },
  357. ),
  358. GestureDetector(
  359. child: Container(
  360. width: ScreenUtil.getInstance().setWidth(94),
  361. height: ScreenUtil.getInstance().setHeight(48),
  362. decoration: BoxDecoration(
  363. color: Color.fromRGBO(239, 243, 249, 1),
  364. borderRadius: BorderRadius.all(Radius.circular(4.0))
  365. ),
  366. child: Center(
  367. child: Text('寄件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  368. ),
  369. ),
  370. onTap: () {
  371. print("寄件");
  372. },
  373. )
  374. ],
  375. )
  376. ],
  377. ),
  378. )
  379. ),
  380. onTap: () {
  381. Navigator.push(context, MaterialPageRoute(builder: (context) {
  382. return OrderDetailPage(orderId: 123456, );
  383. }));
  384. },
  385. );
  386. }
  387. }