OrderListCard.dart 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:get/get.dart';
  4. import '../models/entities/OrderListAll.dart';
  5. import '../pages/OrderConfirmation/index.dart';
  6. import '../pages/orderInfo/index.dart';
  7. import 'LinearGradientText.dart';
  8. class OrderListCard extends StatefulWidget {
  9. final OrderListAll item;
  10. const OrderListCard({Key? key, required this.item}) : super(key: key);
  11. @override
  12. _OrderListCardPages createState() => _OrderListCardPages(item);
  13. }
  14. class StyleObj {
  15. String title;
  16. Color styleColor;
  17. StyleObj ({ required this.title, required this.styleColor});
  18. }
  19. class _OrderListCardPages extends State<OrderListCard> {
  20. @override
  21. void initState() {
  22. // TODO: implement initState
  23. super.initState();
  24. }
  25. final OrderListAll item;
  26. _OrderListCardPages(this.item);
  27. StyleObj orderStates(){
  28. if (item.payStatus == 0) {
  29. return StyleObj(
  30. title: '待付款',
  31. styleColor: Color(0xFF51D4FF)
  32. );
  33. } else if (item.payStatus == 1 && item.workStatus == 0 && item.dispatchStatus == 0) {
  34. return StyleObj(
  35. title: '已付款',
  36. styleColor: Color(0xFFFF703B)
  37. );
  38. } else if (item.payStatus == 1 && item.dispatchStatus == 1 && item.workStatus == 0) {
  39. return StyleObj(
  40. title: '待作业',
  41. styleColor: Color(0xFFFF703B)
  42. );
  43. } else if (item.payStatus == 1 && (item.workStatus == 1 || item.workStatus == 2)) {
  44. return StyleObj(
  45. title: '进行中',
  46. styleColor: Color(0xFF44F68B)
  47. );
  48. } else if (item.workStatus == 3 && item.isEvaluated == 0) {
  49. return StyleObj(
  50. title: '待评价',
  51. styleColor: Color(0xFF51D4FF)
  52. );
  53. } if (item.workStatus == 3 && item.isEvaluated == 1 && item.dispatchStatus == 1) {
  54. return StyleObj(
  55. title: '已完成',
  56. styleColor: Color(0xFFFF703B)
  57. );
  58. } else if (item.payStatus == -1 && item.workStatus == 0 && item.isRefund == 1) {
  59. return StyleObj(
  60. title: '已退单',
  61. styleColor: Color(0xFFFF703B)
  62. );
  63. } else if (item.payStatus == 3 && (item.dispatchStatus == 1 || item.dispatchStatus == 0)) {
  64. return StyleObj(
  65. title: '退单申请中',
  66. styleColor: Color(0xFFFF703B)
  67. );
  68. } else {
  69. return StyleObj(
  70. title: '异常',
  71. styleColor: Color(0xFFFF0000)
  72. );
  73. }
  74. }
  75. @override
  76. Widget build(BuildContext context) {
  77. return Container(
  78. width: 375.w,
  79. height: 345.h,
  80. margin: EdgeInsets.fromLTRB(0, 0, 0, 20),
  81. decoration: const BoxDecoration(color: Colors.white, boxShadow: [
  82. BoxShadow(
  83. color: Colors.black12,
  84. offset: Offset(0.0, 15.0), //阴影xy轴偏移量
  85. blurRadius: 15.0, //阴影模糊程度
  86. spreadRadius: 1.0 //阴影扩散程度
  87. )
  88. ]),
  89. child: Row(
  90. crossAxisAlignment: CrossAxisAlignment.start,
  91. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  92. children: [
  93. Container(
  94. margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
  95. width: 18.0,
  96. height: 275.h,
  97. child: Image(
  98. image: AssetImage('images/ordersLeft.png'),
  99. ),
  100. ),
  101. Expanded(
  102. child: Column(
  103. crossAxisAlignment: CrossAxisAlignment.start,
  104. children: [
  105. Container(
  106. width: 320.w,
  107. margin: EdgeInsets.fromLTRB(0, 10, 0, 15),
  108. padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
  109. decoration: const BoxDecoration(
  110. border: Border(
  111. bottom:
  112. BorderSide(width: 0.5, color: Color(0x20000000)
  113. // 0x17000000
  114. ))),
  115. child: Row(
  116. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  117. children: [
  118. Container(
  119. child: RichText(
  120. text: TextSpan(children: <InlineSpan>[
  121. TextSpan(
  122. text: '订单编号:',
  123. style: TextStyle(
  124. color: Color(0xff666666),
  125. fontSize: 16,
  126. fontWeight: FontWeight.bold)),
  127. TextSpan(
  128. text: item.orderNo,
  129. style: TextStyle(
  130. color: Color(0xff222222),
  131. fontSize: 16,
  132. fontWeight: FontWeight.bold)),
  133. ]),
  134. ),
  135. ),
  136. GestureDetector(
  137. child: const Text('详情 >>',
  138. style: TextStyle(
  139. color: Color(0xff222222),
  140. fontSize: 16,
  141. fontWeight: FontWeight.bold,
  142. )),
  143. onTap: () {
  144. print('进入详情');
  145. Get.toNamed('/orderPageInfo');
  146. },
  147. )
  148. ],
  149. ),
  150. ),
  151. Expanded(
  152. child: Column(
  153. crossAxisAlignment: CrossAxisAlignment.start,
  154. children: [
  155. Padding(
  156. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  157. child: RichText(
  158. text: TextSpan(children: <InlineSpan>[
  159. TextSpan(
  160. text: '农机名称:',
  161. style: TextStyle(
  162. color: Color(0xff666666),
  163. fontSize: 16,
  164. fontWeight: FontWeight.bold)),
  165. TextSpan(
  166. text: item.machineryName,
  167. style: TextStyle(
  168. color: Color(0xff222222),
  169. fontSize: 16,
  170. fontWeight: FontWeight.bold)),
  171. ]),
  172. ),
  173. ),
  174. Padding(
  175. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  176. child: RichText(
  177. text: TextSpan(children: <InlineSpan>[
  178. TextSpan(
  179. text: '作业面积:',
  180. style: TextStyle(
  181. color: Color(0xff666666),
  182. fontSize: 16,
  183. fontWeight: FontWeight.bold)),
  184. TextSpan(
  185. text: item.amount.toString(),
  186. style: TextStyle(
  187. color: Color(0xff222222),
  188. fontSize: 16,
  189. fontWeight: FontWeight.bold)),
  190. ]),
  191. ),
  192. ),
  193. Padding(
  194. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  195. child: RichText(
  196. text: TextSpan(children: <InlineSpan>[
  197. TextSpan(
  198. text: '需求时间:',
  199. style: TextStyle(
  200. color: Color(0xff666666),
  201. fontSize: 16,
  202. fontWeight: FontWeight.bold)),
  203. TextSpan(
  204. text: item.appointmentDate.toString(),
  205. style: TextStyle(
  206. color: Color(0xff222222),
  207. fontSize: 16,
  208. fontWeight: FontWeight.bold)),
  209. ]),
  210. ),
  211. ),
  212. Padding(
  213. padding: EdgeInsets.fromLTRB(0, 0, 0, 4),
  214. child: RichText(
  215. text: TextSpan(children: <InlineSpan>[
  216. TextSpan(
  217. text: '下单时间:',
  218. style: TextStyle(
  219. color: Color(0xff666666),
  220. fontSize: 16,
  221. fontWeight: FontWeight.bold)),
  222. TextSpan(
  223. text: item.createDate.toString(),
  224. style: TextStyle(
  225. color: Color(0xff222222),
  226. fontSize: 16,
  227. fontWeight: FontWeight.bold)),
  228. ]),
  229. ),
  230. ),
  231. ],
  232. )),
  233. Container(
  234. margin: EdgeInsets.fromLTRB(0, 0, 0, 30),
  235. padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
  236. decoration: const BoxDecoration(
  237. border: Border(
  238. top: BorderSide(
  239. width: 0.5, color: Color(0x20000000)))),
  240. width: 320.w,
  241. child: Row(
  242. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  243. children: [
  244. RichText(
  245. text: TextSpan(children: <InlineSpan>[
  246. TextSpan(
  247. text: '订单状态:',
  248. style: TextStyle(
  249. color:Color(0xff666666),
  250. fontSize: 16,
  251. fontWeight: FontWeight.bold)),
  252. TextSpan(
  253. text: orderStates().title,
  254. style: TextStyle(
  255. color:orderStates().styleColor,
  256. fontSize: 16,
  257. fontWeight: FontWeight.bold)),
  258. ]),
  259. ),
  260. Container(
  261. child: Row(
  262. children: [
  263. const Text('费用:',style: TextStyle(
  264. color: Color(0xff666666),
  265. fontSize: 16,
  266. fontWeight: FontWeight.bold)),
  267. LinearGradientText(
  268. colors: const <Color>[
  269. Color(0xFFFA7878),
  270. Color(0xFFB61515),
  271. ],
  272. child: RichText(
  273. text: TextSpan(
  274. children: <InlineSpan>[
  275. TextSpan(
  276. text:( item.charges!/100).toString(),
  277. style: TextStyle(
  278. fontSize: 16,
  279. fontWeight: FontWeight.bold,
  280. )),
  281. TextSpan(
  282. text: "元",
  283. style: TextStyle(
  284. fontSize: 16,
  285. fontWeight: FontWeight.bold,
  286. )),
  287. ]
  288. ),
  289. ),
  290. ),
  291. ],
  292. ),
  293. ),
  294. ],
  295. ),
  296. ),
  297. ],
  298. ),
  299. ),
  300. ],
  301. ),
  302. );
  303. }
  304. }