OrderInfoCard.dart 10KB

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