|
@@ -1,4 +1,6 @@
|
|
1
|
+import 'package:farmer_client/pages/orderInfo/widgets/star.dart';
|
1
|
2
|
import 'package:farmer_client/widgets/DefaultButton.dart';
|
|
3
|
+import 'package:ff_stars/ff_stars.dart';
|
2
|
4
|
import 'package:flutter/material.dart';
|
3
|
5
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
4
|
6
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
@@ -21,6 +23,10 @@ class OrderPageInfo extends BasicPage {
|
21
|
23
|
final orderStateText = Rx<String>('待支付');
|
22
|
24
|
final orderStateColor = Rx<Color>(Colors.black);
|
23
|
25
|
final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
|
|
26
|
+ final evalText=Rx<String>('');
|
|
27
|
+ final evalStars=Rx<num>(-1);
|
|
28
|
+
|
|
29
|
+
|
24
|
30
|
// orderStates
|
25
|
31
|
|
26
|
32
|
@override
|
|
@@ -75,8 +81,85 @@ class OrderPageInfo extends BasicPage {
|
75
|
81
|
height: 49.h,
|
76
|
82
|
text: '评价',
|
77
|
83
|
onPressed: () {
|
78
|
|
- Fluttertoast.showToast(msg: '评价成功!');
|
79
|
|
- Get.offNamed('/order');
|
|
84
|
+
|
|
85
|
+ modal.showDialog(
|
|
86
|
+ title: '评价此订单',
|
|
87
|
+ content: Container(
|
|
88
|
+ alignment: Alignment.center,
|
|
89
|
+ child:Container(
|
|
90
|
+ margin: const EdgeInsets.fromLTRB(15, 20, 15, 20),
|
|
91
|
+ child: Column(
|
|
92
|
+ children: [
|
|
93
|
+ Container(
|
|
94
|
+ padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
|
|
95
|
+ decoration: const BoxDecoration(
|
|
96
|
+ border: Border(
|
|
97
|
+ bottom: BorderSide(
|
|
98
|
+ width: 0.8, color: Color(0x20000000)
|
|
99
|
+ // 0x17000000
|
|
100
|
+ ))),
|
|
101
|
+ child: Row(
|
|
102
|
+ children: [
|
|
103
|
+ Text('满意度:',style: TextStyle(fontSize: 17.sp,fontWeight: FontWeight.bold),),
|
|
104
|
+ FFStars(
|
|
105
|
+ //https://pub.dev/packages/ff_stars
|
|
106
|
+ normalStar:Image.asset('images/icons/starOff.png'),
|
|
107
|
+ selectedStar:Image.asset('images/icons/starOn.png'),
|
|
108
|
+ starsChanged: (realStars, selectedStars) {
|
|
109
|
+ evalStars(realStars);
|
|
110
|
+ print("real: $selectedStars, final: $realStars");
|
|
111
|
+ },
|
|
112
|
+ step: 1,
|
|
113
|
+ defaultStars: 0,
|
|
114
|
+ ),
|
|
115
|
+ ],
|
|
116
|
+ ),
|
|
117
|
+ ),
|
|
118
|
+ Container(
|
|
119
|
+ margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
|
|
120
|
+ width: 300.w,
|
|
121
|
+ height: 100.w,
|
|
122
|
+ decoration: BoxDecoration(
|
|
123
|
+ border: Border.all(
|
|
124
|
+ color: Color(0x20000000),
|
|
125
|
+ width: 0.8,
|
|
126
|
+ ),
|
|
127
|
+ ),
|
|
128
|
+ child: TextField(
|
|
129
|
+ minLines: 6,
|
|
130
|
+ maxLines: 6,
|
|
131
|
+ style: TextStyle(fontSize: 17.sp, height: 1.5),
|
|
132
|
+ decoration: const InputDecoration(
|
|
133
|
+ isCollapsed: true,
|
|
134
|
+ border: InputBorder.none,
|
|
135
|
+ counterText: '',
|
|
136
|
+ hintText: '请输入评价内容',
|
|
137
|
+ floatingLabelBehavior: FloatingLabelBehavior.never,
|
|
138
|
+ ),
|
|
139
|
+ onChanged: (e) {
|
|
140
|
+ evalText(e);
|
|
141
|
+ },
|
|
142
|
+ ),
|
|
143
|
+ )
|
|
144
|
+
|
|
145
|
+ ],
|
|
146
|
+ )
|
|
147
|
+ ,
|
|
148
|
+ )
|
|
149
|
+ ),
|
|
150
|
+ onCancel: () => true,
|
|
151
|
+ onConfirm:() {
|
|
152
|
+ if(evalStars.value!=-1&&evalText.value!=''){
|
|
153
|
+ orderEvaluation(id,evalStars.value,evalText.value).then((value) {
|
|
154
|
+ Fluttertoast.showToast(msg: '评价成功!');
|
|
155
|
+ Get.offNamed('/order');
|
|
156
|
+ });
|
|
157
|
+ }else{
|
|
158
|
+ Fluttertoast.showToast(msg: '请完整选择评分或输入评价内容');
|
|
159
|
+ return false;
|
|
160
|
+ }
|
|
161
|
+ }
|
|
162
|
+ );
|
80
|
163
|
},
|
81
|
164
|
margin: const EdgeInsets.all(0),
|
82
|
165
|
fontSize: 20.sp,
|