index.dart 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. GestureDetector(
  110. onTap: () {
  111. // onCancel();
  112. },
  113. child: Container(
  114. width: 150.w,
  115. height: 49.h,
  116. decoration: BoxDecoration(
  117. color: const Color(0xffffffff),
  118. border: Border.all(
  119. color: const Color(0xFFFF703B),
  120. width: 1.w,
  121. style: BorderStyle.solid),
  122. borderRadius:
  123. BorderRadius.all(Radius.circular(24.5.w))),
  124. child: Center(
  125. child: Text(
  126. '取消',
  127. style: TextStyle(
  128. fontSize: 20.sp,
  129. color: const Color(0xFFFF703B),
  130. fontWeight: FontWeight.bold),
  131. ),
  132. ),
  133. ),
  134. ),
  135. DefaultButton(
  136. color: const Color(0xffffffff),
  137. backColor: const Color(0xFFFF703B),
  138. width: 150.w,
  139. height: 49.h,
  140. text: '支付',
  141. onPressed: () {
  142. Fluttertoast.showToast(msg: '支付成功!');
  143. Get.offAllNamed('/');
  144. },
  145. margin: const EdgeInsets.all(0),
  146. fontSize: 20.sp,
  147. radius: 24.5.w,
  148. ),
  149. ],
  150. ),
  151. );
  152. }
  153. }