OrderListCard.dart 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import 'package:farmer_client/utils/processStatus.dart';
  2. import 'package:farmer_client/widgets/Bold.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import '../models/entities/OrderInfoModel.dart';
  7. import 'package:intl/intl.dart';
  8. import 'LinearGradientText.dart';
  9. class TextCell extends StatelessWidget {
  10. String title;
  11. String? value;
  12. TextCell({Key? key, required this.title, this.value}) : super(key: key);
  13. @override
  14. Widget build(BuildContext context) {
  15. return RichText(
  16. text: TextSpan(children: <InlineSpan>[
  17. TextSpan(
  18. text: title,
  19. style: const TextStyle(
  20. color: Color(0xff666666),
  21. fontSize: 16,
  22. fontWeight: FontWeight.bold)),
  23. TextSpan(
  24. text: value,
  25. style: const TextStyle(
  26. color: Color(0xff222222),
  27. fontSize: 16,
  28. fontWeight: FontWeight.bold)),
  29. ]),
  30. );
  31. }
  32. }
  33. class OrderListCard extends StatelessWidget {
  34. final OrderInfoModel item;
  35. late ProcessSign processSign;
  36. OrderListCard({Key? key, required this.item}) : super(key: key) {
  37. processSign = getProcessSign(getProcessStatus(item));
  38. }
  39. @override
  40. Widget build(BuildContext context) {
  41. return Container(
  42. width: 375.w,
  43. height: 345.h,
  44. margin: const EdgeInsets.fromLTRB(0, 0, 0, 20),
  45. decoration: const BoxDecoration(color: Colors.white, boxShadow: [
  46. BoxShadow(
  47. color: Colors.black12,
  48. offset: Offset(0.0, 15.0), //阴影xy轴偏移量
  49. blurRadius: 15.0, //阴影模糊程度
  50. spreadRadius: 1.0 //阴影扩散程度
  51. )
  52. ]),
  53. child: Row(
  54. crossAxisAlignment: CrossAxisAlignment.start,
  55. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  56. children: [
  57. Container(
  58. margin: const EdgeInsets.fromLTRB(15, 20, 15, 0),
  59. width: 18.0,
  60. height: 275.h,
  61. child: const Image(
  62. image: AssetImage('images/ordersLeft.png'),
  63. ),
  64. ),
  65. Expanded(
  66. child: Column(
  67. crossAxisAlignment: CrossAxisAlignment.start,
  68. children: [
  69. Container(
  70. width: 320.w,
  71. margin: const EdgeInsets.fromLTRB(0, 10, 0, 15),
  72. padding: const EdgeInsets.fromLTRB(0, 0, 0, 20),
  73. decoration: const BoxDecoration(
  74. border: Border(
  75. bottom:
  76. BorderSide(width: 0.5, color: Color(0x20000000)
  77. // 0x17000000
  78. ))),
  79. child: GestureDetector(
  80. child: Row(
  81. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  82. children: [
  83. TextCell(title: '订单编号:', value: item.orderNo),
  84. Bold(
  85. text: "详情 >>",
  86. fontSize: 16.sp,
  87. color: const Color(0xff222222)),
  88. ],
  89. ),
  90. onTap: () {
  91. Get.toNamed('/orderPageInfo', arguments: {
  92. 'orderId': item.orderId,
  93. 'title': processSign.label,
  94. 'styleColor': processSign.color
  95. });
  96. },
  97. ),
  98. ),
  99. Expanded(
  100. child: Column(
  101. crossAxisAlignment: CrossAxisAlignment.start,
  102. children: [
  103. Padding(
  104. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  105. child:
  106. TextCell(title: '农机名称:', value: item.machineryName),
  107. ),
  108. Padding(
  109. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  110. child: TextCell(
  111. title: '作业面积:', value: item.amount.toString()),
  112. ),
  113. Padding(
  114. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  115. child: TextCell(
  116. title: '需求时间:',
  117. value: DateFormat("yyyy-MM-dd").format(
  118. DateTime.parse(item.appointmentDate.toString()))),
  119. ),
  120. Padding(
  121. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  122. child: TextCell(
  123. title: '需求时间:',
  124. value: DateFormat("yyyy-MM-dd").format(
  125. DateTime.parse(item.createDate.toString()))),
  126. ),
  127. ],
  128. )),
  129. Container(
  130. margin: const EdgeInsets.fromLTRB(0, 0, 0, 30),
  131. padding: const EdgeInsets.fromLTRB(0, 20, 0, 0),
  132. decoration: const BoxDecoration(
  133. border: Border(
  134. top: BorderSide(
  135. width: 0.5, color: Color(0x20000000)))),
  136. width: 320.w,
  137. child: Row(
  138. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  139. children: [
  140. RichText(
  141. text: TextSpan(children: <InlineSpan>[
  142. const TextSpan(
  143. text: '订单状态:',
  144. style: TextStyle(
  145. color: Color(0xff666666),
  146. fontSize: 16,
  147. fontWeight: FontWeight.bold)),
  148. TextSpan(
  149. text: processSign.label,
  150. style: TextStyle(
  151. color: processSign.color,
  152. fontSize: 16,
  153. fontWeight: FontWeight.bold)),
  154. ]),
  155. ),
  156. Row(
  157. children: [
  158. const Text('费用:',
  159. style: TextStyle(
  160. color: Color(0xff666666),
  161. fontSize: 16,
  162. fontWeight: FontWeight.bold)),
  163. LinearGradientText(
  164. colors: const <Color>[
  165. Color(0xFFFA7878),
  166. Color(0xFFB61515),
  167. ],
  168. child: RichText(
  169. text: TextSpan(children: <InlineSpan>[
  170. TextSpan(
  171. text:
  172. ((item.charges ?? 0) / 100).toString(),
  173. style: const TextStyle(
  174. fontSize: 16,
  175. fontWeight: FontWeight.bold,
  176. )),
  177. const TextSpan(
  178. text: "元",
  179. style: TextStyle(
  180. fontSize: 16,
  181. fontWeight: FontWeight.bold,
  182. )),
  183. ]),
  184. ),
  185. ),
  186. ],
  187. ),
  188. ],
  189. ),
  190. ),
  191. ],
  192. ),
  193. ),
  194. ],
  195. ),
  196. );
  197. }
  198. }