OrderInfoCard.dart 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import 'package:farmer_client/models/entities/OrderInfoModel.dart';
  2. import 'package:farmer_client/pages/index.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:intl/intl.dart';
  7. import 'LinearGradientText.dart';
  8. class OrderInfoCard extends StatelessWidget {
  9. final OrderInfoModel item;
  10. final String? orderStateText;
  11. final Color? orderStateColor;
  12. // final DateTime timeNew=item.appointmentDate;
  13. const OrderInfoCard(
  14. {Key? key,
  15. required this.item,
  16. required this.orderStateColor,
  17. required this.orderStateText})
  18. : super(key: key);
  19. @override
  20. Widget build(BuildContext context) {
  21. return Container(
  22. width: 345.w,
  23. height: 484.5.h,
  24. margin: EdgeInsets.fromLTRB(15.w, 17.w, 15.w, 0),
  25. decoration: BoxDecoration(
  26. color: Colors.white,
  27. //设置四周圆角 角度
  28. borderRadius: BorderRadius.all(Radius.circular(2.0)),
  29. //设置四周边框
  30. boxShadow: [
  31. BoxShadow(
  32. blurRadius: 10, //阴影范围
  33. spreadRadius: 0.1, //阴影浓度
  34. color: Colors.grey.withOpacity(0.2), //阴影颜色
  35. ),
  36. ],
  37. ),
  38. child: Column(
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. children: [
  41. Container(
  42. margin: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
  43. child: Column(
  44. crossAxisAlignment: CrossAxisAlignment.start,
  45. children: [
  46. Container(
  47. padding: EdgeInsets.fromLTRB(0, 15, 0, 20),
  48. width: 314.w,
  49. decoration: const BoxDecoration(
  50. border: Border(
  51. bottom:
  52. BorderSide(width: 0.5, color: Color(0x20000000)
  53. // 0x17000000
  54. ))),
  55. child: RichText(
  56. text: TextSpan(children: <InlineSpan>[
  57. TextSpan(
  58. text: '订单编号:',
  59. style: TextStyle(
  60. color: Color(0xff666666),
  61. fontSize: 16,
  62. fontWeight: FontWeight.bold)),
  63. TextSpan(
  64. text: item.orderNo.toString(),
  65. style: TextStyle(
  66. color: Color(0xff222222),
  67. fontSize: 16,
  68. fontWeight: FontWeight.bold)),
  69. ]),
  70. ),
  71. ),
  72. Padding(
  73. padding: EdgeInsets.fromLTRB(0, 20, 0, 15),
  74. child: RichText(
  75. text: TextSpan(children: <InlineSpan>[
  76. TextSpan(
  77. text: '农机名称:',
  78. style: TextStyle(
  79. color: Color(0xff666666),
  80. fontSize: 16,
  81. fontWeight: FontWeight.bold)),
  82. TextSpan(
  83. text: item.machineryName.toString(),
  84. style: TextStyle(
  85. color: Color(0xff222222),
  86. fontSize: 16,
  87. fontWeight: FontWeight.bold)),
  88. ]),
  89. ),
  90. ),
  91. Padding(
  92. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  93. child: RichText(
  94. text: TextSpan(children: <InlineSpan>[
  95. TextSpan(
  96. text: '作业面积:',
  97. style: TextStyle(
  98. color: Color(0xff666666),
  99. fontSize: 16,
  100. fontWeight: FontWeight.bold)),
  101. TextSpan(
  102. text: item.amount.toString(),
  103. style: TextStyle(
  104. color: Color(0xff222222),
  105. fontSize: 16,
  106. fontWeight: FontWeight.bold)),
  107. ]),
  108. ),
  109. ),
  110. Padding(
  111. padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
  112. child: RichText(
  113. text: TextSpan(children: <InlineSpan>[
  114. TextSpan(
  115. text: '需求时间:',
  116. style: TextStyle(
  117. color: Color(0xff666666),
  118. fontSize: 16,
  119. fontWeight: FontWeight.bold)),
  120. TextSpan(
  121. // '${DateFormat("yyyy-MM-dd").format(item.appointmentDate.toString())}'
  122. text: item.appointmentDate != null
  123. ? DateFormat("yyyy-MM-dd").format(
  124. DateTime.parse(
  125. item.appointmentDate.toString()))
  126. : item.appointmentDate.toString(),
  127. style: TextStyle(
  128. color: Color(0xff222222),
  129. fontSize: 16,
  130. fontWeight: FontWeight.bold)),
  131. ]),
  132. ),
  133. ),
  134. Padding(
  135. padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
  136. child: RichText(
  137. text: TextSpan(children: <InlineSpan>[
  138. const TextSpan(
  139. text: '下单时间:',
  140. style: TextStyle(
  141. color: Color(0xff666666),
  142. fontSize: 16,
  143. fontWeight: FontWeight.bold)),
  144. TextSpan(
  145. // text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate!.toString())),
  146. text: item.createDate != null
  147. ? DateFormat("yyyy-MM-dd").format(
  148. DateTime.parse(item.createDate.toString()))
  149. : item.createDate.toString(),
  150. style: const TextStyle(
  151. color: Color(0xff222222),
  152. fontSize: 16,
  153. fontWeight: FontWeight.bold)),
  154. ]),
  155. ),
  156. ),
  157. Padding(
  158. padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
  159. child: RichText(
  160. text: TextSpan(children: <InlineSpan>[
  161. TextSpan(
  162. text: '订单状态:',
  163. style: TextStyle(
  164. color: Color(0xff666666),
  165. fontSize: 16,
  166. fontWeight: FontWeight.bold)),
  167. TextSpan(
  168. text: orderStateText == null
  169. ? '待支付'
  170. : orderStateText == '已付款'
  171. ? '已付款,待调度'
  172. : orderStateText,
  173. style: TextStyle(
  174. color: orderStateColor ?? Colors.black,
  175. fontSize: 16,
  176. fontWeight: FontWeight.bold)),
  177. ]),
  178. ),
  179. ),
  180. Container(
  181. padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
  182. width: 314.w,
  183. decoration: const BoxDecoration(
  184. border: Border(
  185. top: BorderSide(
  186. width: 0.8, color: Color(0x20000000)
  187. // 0x17000000
  188. ))),
  189. child: Column(
  190. children: [
  191. Row(
  192. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  193. children: [
  194. const Text('费用:',
  195. style: TextStyle(
  196. color: Color(0xff666666),
  197. fontSize: 16,
  198. fontWeight: FontWeight.bold)),
  199. LinearGradientText(
  200. colors: const <Color>[
  201. Color(0xFFFA7878),
  202. Color(0xFFB61515),
  203. ],
  204. child: Text(
  205. ((item.charges ?? 0) / 100).toString(),
  206. style: TextStyle(
  207. color: Color(0xffB61515),
  208. fontSize: 16,
  209. fontWeight: FontWeight.bold)),
  210. ),
  211. ],
  212. ),
  213. Padding(
  214. padding: EdgeInsets.fromLTRB(0, 30, 0, 0),
  215. child: Row(
  216. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  217. children: [
  218. Text('状态:',
  219. style: TextStyle(
  220. color: Color(0xff666666),
  221. fontSize: 16,
  222. fontWeight: FontWeight.bold)),
  223. Text(orderStateText ?? '未支付',
  224. style: TextStyle(
  225. color: orderStateColor ?? Colors.black,
  226. fontSize: 16,
  227. fontWeight: FontWeight.bold)),
  228. ],
  229. ),
  230. ),
  231. ],
  232. )),
  233. ],
  234. )),
  235. ],
  236. ),
  237. );
  238. }
  239. }