OrderListCard.dart 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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:
  81. Row(
  82. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  83. children: [
  84. TextCell(title: '订单编号:', value: item.orderNo),
  85. Bold(text: "详情 >>", fontSize: 16.sp, color: const Color(0xff222222)),
  86. ],
  87. ),
  88. onTap: () {
  89. Get.toNamed('/orderPageInfo', arguments: {
  90. 'id': item.orderId,
  91. 'title': processSign.label,
  92. 'styleColor': processSign.color
  93. });
  94. },
  95. ),
  96. ),
  97. Expanded(
  98. child: Column(
  99. crossAxisAlignment: CrossAxisAlignment.start,
  100. children: [
  101. Padding(
  102. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  103. child: TextCell(title: '农机名称:', value: item.machineryName),
  104. ),
  105. Padding(
  106. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  107. child: TextCell(title: '作业面积:', value: item.amount.toString()),
  108. ),
  109. Padding(
  110. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  111. child: TextCell(title: '需求时间:', value: DateFormat("yyyy-MM-dd").format(
  112. DateTime.parse(item.appointmentDate.toString()))),
  113. ),
  114. Padding(
  115. padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
  116. child: TextCell(title: '需求时间:', value: DateFormat("yyyy-MM-dd").format(
  117. DateTime.parse(item.createDate.toString()))),
  118. ),
  119. ],
  120. )),
  121. Container(
  122. margin: const EdgeInsets.fromLTRB(0, 0, 0, 30),
  123. padding: const EdgeInsets.fromLTRB(0, 20, 0, 0),
  124. decoration: const BoxDecoration(
  125. border: Border(
  126. top: BorderSide(
  127. width: 0.5, color: Color(0x20000000)))),
  128. width: 320.w,
  129. child: Row(
  130. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  131. children: [
  132. RichText(
  133. text: TextSpan(children: <InlineSpan>[
  134. const TextSpan(
  135. text: '订单状态:',
  136. style: TextStyle(
  137. color: Color(0xff666666),
  138. fontSize: 16,
  139. fontWeight: FontWeight.bold)),
  140. TextSpan(
  141. text: processSign.label,
  142. style: TextStyle(
  143. color: processSign.color,
  144. fontSize: 16,
  145. fontWeight: FontWeight.bold)),
  146. ]),
  147. ),
  148. Row(
  149. children: [
  150. const Text('费用:',
  151. style: TextStyle(
  152. color: Color(0xff666666),
  153. fontSize: 16,
  154. fontWeight: FontWeight.bold)),
  155. LinearGradientText(
  156. colors: const <Color>[
  157. Color(0xFFFA7878),
  158. Color(0xFFB61515),
  159. ],
  160. child: RichText(
  161. text: TextSpan(children: <InlineSpan>[
  162. TextSpan(
  163. text: ((item.charges ?? 0) / 100)
  164. .toString(),
  165. style: const TextStyle(
  166. fontSize: 16,
  167. fontWeight: FontWeight.bold,
  168. )),
  169. const TextSpan(
  170. text: "元",
  171. style: TextStyle(
  172. fontSize: 16,
  173. fontWeight: FontWeight.bold,
  174. )),
  175. ]),
  176. ),
  177. ),
  178. ],
  179. ),
  180. ],
  181. ),
  182. ),
  183. ],
  184. ),
  185. ),
  186. ],
  187. ),
  188. );
  189. }
  190. }