OrderListCard.dart 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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: TextStyle(
  20. color: const Color(0xff666666),
  21. fontSize: 16.sp,
  22. fontWeight: FontWeight.bold)),
  23. TextSpan(
  24. text: value,
  25. style: TextStyle(
  26. color: const Color(0xff222222),
  27. fontSize: 16.sp,
  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. margin: EdgeInsets.only(bottom: 20.h),
  44. padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 15.w),
  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. children: [
  55. Container(
  56. margin: EdgeInsets.only(right: 15.w),
  57. width: 17.w,
  58. height: 320.h,
  59. child: const Image(
  60. image: AssetImage('images/ordersLeft.png'),
  61. ),
  62. ),
  63. Column(
  64. crossAxisAlignment: CrossAxisAlignment.start,
  65. children: [
  66. Container(
  67. width: 313.w,
  68. margin: EdgeInsets.only(bottom: 20.h),
  69. padding: EdgeInsets.only(bottom: 20.h),
  70. decoration: const BoxDecoration(
  71. border: Border(
  72. bottom: BorderSide(
  73. width: 0.5,
  74. color: Color(0x20000000),
  75. ),
  76. ),
  77. ),
  78. child: GestureDetector(
  79. child: Row(
  80. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  81. children: [
  82. TextCell(title: '订单编号:', value: item.orderNo),
  83. Bold(
  84. text: "详情 >>",
  85. fontSize: 16.sp,
  86. color: const Color(0xff222222),
  87. ),
  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. Padding(
  100. padding: EdgeInsets.only(bottom: 30.h),
  101. child: TextCell(title: '农机名称:', value: item.machineryName),
  102. ),
  103. Padding(
  104. padding: EdgeInsets.only(bottom: 30.h),
  105. child: TextCell(title: '作业面积:', value: item.amount.toString()),
  106. ),
  107. Padding(
  108. padding: EdgeInsets.only(bottom: 30.h),
  109. child: TextCell(
  110. title: '需求时间:',
  111. value: DateFormat("yyyy-MM-dd").format(
  112. DateTime.parse(item.appointmentDate.toString()))),
  113. ),
  114. TextCell(
  115. title: '下单时间:',
  116. value: DateFormat("yyyy-MM-dd")
  117. .format(DateTime.parse(item.createDate.toString())),
  118. ),
  119. Container(
  120. margin: EdgeInsets.only(top: 22.h),
  121. padding: EdgeInsets.only(top: 30.h),
  122. decoration: const BoxDecoration(
  123. border: Border(
  124. top: BorderSide(
  125. width: 0.5,
  126. color: Color(0x20000000),
  127. ),
  128. ),
  129. ),
  130. width: 313.w,
  131. child: Row(
  132. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  133. children: [
  134. RichText(
  135. text: TextSpan(
  136. children: <InlineSpan>[
  137. TextSpan(
  138. text: '订单状态:',
  139. style: TextStyle(
  140. color: const Color(0xff666666),
  141. fontSize: 16.sp,
  142. fontWeight: FontWeight.bold),
  143. ),
  144. TextSpan(
  145. text: processSign.label,
  146. style: TextStyle(
  147. color: processSign.color,
  148. fontSize: 16.sp,
  149. fontWeight: FontWeight.bold),
  150. ),
  151. ],
  152. ),
  153. ),
  154. Row(
  155. children: [
  156. Text(
  157. '费用:',
  158. style: TextStyle(
  159. color: const Color(0xff666666),
  160. fontSize: 16.sp,
  161. fontWeight: FontWeight.bold),
  162. ),
  163. LinearGradientText(
  164. colors: const <Color>[
  165. Color(0xFFFA7878),
  166. Color(0xFFB61515),
  167. ],
  168. child: RichText(
  169. text: TextSpan(
  170. children: <InlineSpan>[
  171. TextSpan(
  172. text: ((item.charges ?? 0) / 100).toString(),
  173. style: TextStyle(
  174. fontSize: 16.sp,
  175. fontWeight: FontWeight.bold,
  176. ),
  177. ),
  178. TextSpan(
  179. text: "元",
  180. style: TextStyle(
  181. fontSize: 16.sp,
  182. fontWeight: FontWeight.bold,
  183. ),
  184. ),
  185. ],
  186. ),
  187. ),
  188. ),
  189. ],
  190. ),
  191. ],
  192. ),
  193. ),
  194. ],
  195. ),
  196. ],
  197. ),
  198. );
  199. }
  200. }