index.dart 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import 'package:farmer_client/widgets/DefaultButton.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:fluttertoast/fluttertoast.dart';
  5. import 'package:get/get.dart';
  6. import '../../models/entities/OrderInfoModel.dart';
  7. import '../../services/orderAPI.dart';
  8. import '../../widgets/OrderInfoCard.dart';
  9. import '../../widgets/layout/BasicPage.dart';
  10. // class OrderContentInfo {
  11. // String title;
  12. // Color styleColor;
  13. // StyleObj ({ required this.title, required this.styleColor});
  14. // }
  15. class OrderPageInfo extends BasicPage {
  16. String id = '';
  17. String orderStateText = '';
  18. late Color orderStateColor;
  19. final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
  20. // orderStates
  21. @override
  22. void beforeShow() {
  23. // TODO: implement beforeShow
  24. super.beforeShow();
  25. if (Get.arguments['id'] != null) {
  26. id = Get.arguments['id'];
  27. orderStateText = Get.arguments['title'];
  28. orderStateColor = Get.arguments['styleColor'];
  29. orderInfo(id).then((value) {
  30. orderInfoContent.value = OrderInfoModel.fromJson(value);
  31. });
  32. }
  33. }
  34. @override
  35. Widget builder(BuildContext context) {
  36. naviTitle = '订单详情';
  37. return Column(
  38. children: [
  39. Obx(() =>
  40. OrderInfoCard(
  41. item: orderInfoContent.value,
  42. orderStateText: orderStateText,
  43. orderStateColor: orderStateColor
  44. ),
  45. ),
  46. _BottomWidget()
  47. // orderStateText=='已完成'? Text('')
  48. // :orderStateText== '进行中' ?Text('')
  49. // :orderStateText=='待评价'? DefaultButton(
  50. // color: const Color(0xffffffff),
  51. // backColor: const Color(0xFFFF703B),
  52. // width: 300.w,
  53. // height: 49.h,
  54. // text: '评价',
  55. // onPressed: () {
  56. // Fluttertoast.showToast(msg: '评价成功!');
  57. // Get.offAllNamed('/');
  58. // },
  59. // margin: const EdgeInsets.all(0),
  60. // fontSize: 20.sp,
  61. // radius: 24.5.w,
  62. // )
  63. // :orderStateText=='待作业'?DefaultButton(
  64. // color: const Color(0xffffffff),
  65. // backColor: const Color(0xFFFF703B),
  66. // width: 300.w,
  67. // height: 49.h,
  68. // text: '退单',
  69. // onPressed: () {
  70. // Fluttertoast.showToast(msg: '评价成功!');
  71. // Get.offAllNamed('/');
  72. // },
  73. // margin: const EdgeInsets.all(0),
  74. // fontSize: 20.sp,
  75. // radius: 24.5.w,
  76. // )
  77. // :orderStateText=='待付款'?_BottomWidget
  78. // :orderStateText=='已退单'?Text('')
  79. // :orderStateText=='退单申请中'?DefaultButton(
  80. // color: const Color(0xffffffff),
  81. // backColor: const Color(0xFFFF703B),
  82. // width: 300.w,
  83. // height: 49.h,
  84. // text: orderStateText,
  85. // onPressed: () {
  86. // Fluttertoast.showToast(msg: '评价成功!');
  87. // Get.offAllNamed('/');
  88. // },
  89. // margin: const EdgeInsets.all(0),
  90. // fontSize: 20.sp,
  91. // radius: 24.5.w,
  92. // ):Text(''),
  93. // Spacer(),
  94. ],
  95. );
  96. }
  97. }
  98. class _BottomWidget extends StatelessWidget {
  99. const _BottomWidget({Key? key}) : super(key: key);
  100. @override
  101. Widget build(BuildContext context) {
  102. return Container(
  103. height: 100.w,
  104. alignment: Alignment.bottomCenter,
  105. margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 50.h),
  106. child: Row(
  107. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  108. children: [
  109. Container(
  110. width: 150.w,
  111. height: 49.h,
  112. margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
  113. alignment: Alignment.bottomCenter,
  114. child: SizedBox(
  115. width: 150.w,
  116. height: 49.h,
  117. child: ElevatedButton(
  118. onPressed: () {
  119. Get.back();
  120. },
  121. child: const Text(
  122. "取消",
  123. style: TextStyle(
  124. fontSize: 18,
  125. color: Color(0xFFFF703B),
  126. fontWeight: FontWeight.bold),
  127. ),
  128. style: ButtonStyle(
  129. side: MaterialStateProperty.all(
  130. BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
  131. elevation: MaterialStateProperty.all(0),
  132. backgroundColor: MaterialStateProperty.all(Colors.white),
  133. shape: MaterialStateProperty.all(
  134. RoundedRectangleBorder(
  135. borderRadius:
  136. BorderRadius.all(Radius.circular(24.4))),
  137. ),
  138. ),
  139. ),
  140. ),
  141. ),
  142. Container(
  143. margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
  144. alignment: Alignment.bottomCenter,
  145. child: DefaultButton(
  146. color: const Color(0xffffffff),
  147. backColor: const Color(0xFFFF703B),
  148. width: 150.w,
  149. height: 49.h,
  150. text: '支付',
  151. onPressed: () {
  152. Fluttertoast.showToast(msg: '支付成功!');
  153. Get.offAllNamed('/');
  154. },
  155. margin: const EdgeInsets.all(0),
  156. fontSize: 20.sp,
  157. radius: 24.5.w,
  158. ),
  159. ),
  160. ],
  161. ),
  162. );
  163. }
  164. }