add fixed evaluation page

hmxc
张萌 4 years ago
parent 9e33172a0c
commit 094c6cf1e2

@ -114,6 +114,8 @@ class _Manager {
///
String get reportRepairComplete => '/user/reportRepair/completeOrder';
///
String get reportRepairEvaluate => '/user/reportRepair/evaluate';
}
class _Upload {

@ -59,11 +59,26 @@ class ManagerFunc {
return FixedDetailModel.fromJson(response.data);
}
static Future reportRepairCancel(int id) async {
static Future<BaseModel> reportRepairCancel(int id) async {
BaseModel baseModel = await NetUtil().get(API.manager.reportRepairCancel,
params: {
'repairId': id,
},
showMessage: true);
return baseModel;
}
static Future<BaseModel> reportRepairEvaluate(
int id, int rate, String text) async {
BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairEvaluate,
params: {
'repairId': id,
'evaluationLevel': rate,
'evaluationContent': text,
},
showMessage: true,
);
return baseModel;
}
}

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -462,7 +463,9 @@ class _FixedDetailPageState extends State<FixedDetailPage> {
).expand(),
MaterialButton(
minWidth: 375.w,
onPressed: () {},
onPressed: () {
Get.off(FixedEvaluatePage(_model));
},
child: '立即评价'.text.white.size(32.sp).bold.make(),
padding: EdgeInsets.symmetric(vertical: 26.w),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,

@ -1,21 +1,132 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/utils/headers.dart';
class FixedEvaluatePage extends StatefulWidget {
FixedEvaluatePage({Key key}) : super(key: key);
final FixedDetailModel model;
FixedEvaluatePage(this.model, {Key key}) : super(key: key);
@override
_FixedEvaluatePageState createState() => _FixedEvaluatePageState();
}
class _FixedEvaluatePageState extends State<FixedEvaluatePage> {
int _rating;
TextEditingController _textEditingController;
@override
void initState() {
super.initState();
_textEditingController = TextEditingController();
}
@override
void dispose() {
_textEditingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(title: '评价',body: ListView(
return BeeScaffold(
title: '评价',
body: ListView(
padding: EdgeInsets.symmetric(horizontal: 42.w, vertical: 52.w),
children: [],
).expand(),);
children: [
'请您对本次服务进行评价'.text.color(ktextSubColor).size(28.sp).make(),
50.w.heightBox,
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
children: [
'综合评价'.text.color(ktextSubColor).size(28.sp).make(),
35.w.widthBox,
RatingBar(
ratingWidget: RatingWidget(
full: Icon(
CupertinoIcons.star_fill,
color: kDarkPrimaryColor,
),
half: Icon(
CupertinoIcons.star_lefthalf_fill,
color: kDarkPrimaryColor,
),
empty: Icon(
CupertinoIcons.star,
color: kDarkSubColor,
),
),
itemSize: 35.w,
itemCount: 5,
initialRating: 0,
allowHalfRating: true,
itemPadding: EdgeInsets.symmetric(horizontal: 15.w),
onRatingUpdate: (rating) {
_rating = (rating * 2).toInt();
})
],
),
60.w.heightBox,
'请输入内容'.text.black.size(28.sp).make(),
24.w.heightBox,
Container(
padding: EdgeInsets.symmetric(horizontal: 22.w, vertical: 32.w),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFFD4CFBE), width: 1.w),
borderRadius: BorderRadius.circular(8.w),
),
child: TextField(
onChanged: (value) {
setState(() {});
},
controller: _textEditingController,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
isDense: true,
border: InputBorder.none,
hintText: '您对本次服务满意吗?',
hintStyle: TextStyle(
color: ktextSubColor,
),
),
maxLines: 10,
minLines: 6,
),
),
100.w.heightBox,
MaterialButton(
onPressed: () async {
if (_textEditingController.text.isEmpty) {
BotToast.showText(text: '评价内容不能为空!');
} else {
BaseModel baseModel = await ManagerFunc.reportRepairEvaluate(
widget.model.appReportRepairVo.id,
_rating,
_textEditingController.text);
if (baseModel.status) {
Get.back();
}
}
},
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(48.w)),
color: kPrimaryColor,
minWidth: 686.w,
padding: EdgeInsets.symmetric(
vertical: 26.w,
),
child: '发布'.text.black.size(32.sp).bold.make(),
),
],
),
);
}
}
Loading…
Cancel
Save