123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- import 'package:flustars/flustars.dart' as flustars;
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/common/common.dart';
- import 'package:liftmanager/internal/account/provider/user_provider.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/bbs/model/liftcase_model.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/star_item.dart';
- import 'package:oktoast/oktoast.dart';
- import 'package:provider/provider.dart';
- class Comment extends StatefulWidget {
- Comment(this.id);
- final String id;
- @override
- State<StatefulWidget> createState() {
- return CommentState();
- }
- }
- class CommentState extends State<Comment> with AutomaticKeepAliveClientMixin {
- UserProvider provider = UserProvider();
- bool _hasData = false;
- LiftCasesDetailModel detailObj;
- void getBrandDetail() {
- NewApiService().getLiftcaseDetail(widget.id, onSuccess: (res) {
- detailObj = res;
- _hasData = true;
- setState(() {});
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- void submitComment() {
- if (serviceLevel == 0 || serviceTaidu == 0 || speed == 0) {
- showToast('请打分');
- return;
- }
- if (_controller.text.length == 0) {
- showToast('请填写评价');
- return;
- }
- // double serviceLevel = 0;
- // double serviceTaidu = 0;
- // double speed = 0;
- showLoading(context);
- NewApiService().submitComments({
- "attitude": serviceTaidu,
- "comment": _controller.text,
- "lifeCaseId": widget.id,
- "responseSpeed": speed,
- "tech": serviceLevel,
- "expertId": detailObj.chargerId,
- "userId": int.parse(flustars.SpUtil.getString(Constant.userId)),
- }, onSuccess: (res) {
- dismissLoading(context);
- toasts("评论成功");
- NavigatorUtils.push(context, "${WodeRouter.orderPage}?checkType=0");
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- double serviceLevel = 0;
- double serviceTaidu = 0;
- double speed = 0;
- TextEditingController _controller = TextEditingController();
- @override
- void initState() {
- getBrandDetail();
- super.initState();
- }
- @override
- void dispose() {
- super.dispose();
- }
- FocusNode blankNode = FocusNode();
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return
- // Center(child:new Text("个人中心"));
- ChangeNotifierProvider<UserProvider>(
- create: (_) => provider,
- child: Scaffold(
- appBar: MyAppBar(
- centerTitle: "订单评价",
- ),
- body: GestureDetector(
- onTap: () {
- // 点击空白页面关闭键盘
- FocusScope.of(context).requestFocus(blankNode);
- },
- child: Consumer<UserProvider>(
- builder: (_, provider, __) {
- return Stack(
- children: <Widget>[
- ListView(
- padding: EdgeInsets.all(0.0),
- children: <Widget>[
- _hasData
- ? _orderUserDetail()
- : Center(
- child: null,
- ),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- SizedBox(
- height: 20,
- ),
- Row(
- children: [
- Container(
- height: 13,
- width: 2,
- color: Colours.blue_app_main,
- ),
- SizedBox(
- width: 13,
- ),
- Text(
- '打分评价',
- style: TextStyle(color: Colours.text, fontSize: 15),
- )
- ],
- ),
- Container(
- child: Column(
- children: <Widget>[
- StarItem(
- title: "技术水平:",
- starRating: serviceLevel,
- onRatingChanged: (res) {
- serviceLevel = res;
- setState(() {});
- },
- ),
- StarItem(
- title: "服务态度:",
- starRating: serviceTaidu,
- onRatingChanged: (res) {
- serviceTaidu = res;
- setState(() {});
- },
- ),
- StarItem(
- title: "响应速度:",
- starRating: speed,
- onRatingChanged: (res) {
- speed = res;
- setState(() {});
- },
- ),
- SizedBox(
- height: 8,
- ),
- Container(
- color: Color(0xffFAF7FA),
- height: ScreenUtil().setWidth(5),
- ),
- SizedBox(
- height: 20,
- ),
- Row(
- children: [
- Container(
- height: 13,
- width: 2,
- color: Colours.blue_app_main,
- ),
- SizedBox(
- width: 13,
- ),
- Text(
- '评价描述',
- style: TextStyle(
- color: Colours.text, fontSize: 15),
- )
- ],
- ),
- // Container(
- // decoration: BoxDecoration(
- // border: Border.all(
- // width: 0.5, color: Color(0xffcccccc)),
- // color: Colors.white,
- // ),
- // margin: EdgeInsets.only(
- // left: ScreenUtil().setWidth(15),
- // right: ScreenUtil().setWidth(15)),
- // child: Padding(
- // padding: const EdgeInsets.only(
- // top: 5,
- // left: 15.0,
- // right: 15.0,
- // bottom: 8.0),
- // child: TextField(
- // maxLength: 200,
- // maxLines: 5,
- // autofocus: false,
- // controller: _controller,
- // decoration: InputDecoration(
- // hintText: "您的满意是对专家最大的支持和鼓励",
- // border: InputBorder.none,
- // hintStyle: TextStyles.textGray14,
- // ),
- // ),
- // ),
- // ),
- Container(
- height: ScreenUtil().setWidth(120),
- padding: EdgeInsets.only(
- left: 15, right: 15, bottom: 20, top: 10),
- child: TextFormField(
- // autofocus: true,
- maxLength: 100,
- cursorColor: Color(0xffcccccc),
- controller: _controller,
- maxLines: 5,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(0),
- hintText: '请描述您对专家本次服务的评价',
- hintStyle:
- TextStyle(color: Color(0xffcccccc)),
- focusedBorder: InputBorder.none,
- border: InputBorder.none,
- // filled: true, // 背景色
- // fillColor: Colors.cyan.withAlpha(35),
- // icon: Icon(Icons.person)
- ),
- ),
- ),
- ],
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Container(
- height: 44,
- decoration: BoxDecoration(
- color: Colours.blue_app_main,
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(22)),
- // gradient: const LinearGradient(
- // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
- ),
- margin: EdgeInsets.only(
- top: ScreenUtil().setWidth(20),
- bottom: ScreenUtil().setWidth(20)),
- width: width * 0.9,
- child: FlatButton(
- child: Text("提交"),
- textColor: Colors.white,
- onPressed: () {
- // NavigatorUtils.push(context, WodeRouter.orderPage);
- submitComment();
- },
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- );
- },
- ),
- ),
- ),
- );
- }
- _orderUserDetail() {
- return Container(
- // height: 20,
- padding: EdgeInsets.only(
- bottom: ScreenUtil().setWidth(20), top: ScreenUtil().setWidth(10)),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Expanded(
- child: GestureDetector(
- onTap: () {
- NavigatorUtils.push(context,
- "${BbsRouter.recommendAsk}?id=${detailObj.id}&type=3");
- },
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- ClipRRect(
- borderRadius: BorderRadius.circular(20),
- child: LoadNetworkImage(
- detailObj.avatarUrl,
- width: ScreenUtil().setWidth(43),
- height: ScreenUtil().setWidth(43),
- // alignment: Alignment.centerLeft,
- ),
- ),
- SizedBox(
- width: 10,
- ),
- Expanded(
- child: Container(
- padding:
- EdgeInsets.only(right: ScreenUtil().setWidth(15)),
- child: Column(
- children: <Widget>[
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- detailObj.name ?? '',
- style: TextStyle(
- fontSize: ScreenUtil().setSp(17),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- decoration: BoxDecoration(
- //背景
- color: detailObj.dataTable == 1
- ? Colours.blue_app_main
- : Color(0xffFDAF2C),
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(
- Radius.circular(4.0)),
- ),
- margin: EdgeInsets.only(left: 5),
- padding: EdgeInsets.only(
- left: 5, right: 5, top: 2, bottom: 2),
- child: Text(
- detailObj.dataTable == 1
- ? '问诊服务'
- : '出诊服务',
- style: TextStyle(
- color: Colors.white,
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- detailObj.createTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: detailObj.createTime,
- format: "MM月dd日")
- : '',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- detailObj.brandName ?? '',
- style: TextStyle(
- color: Colours.blue_app_main,
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- )
- ],
- ),
- ],
- ),
- ),
- detailObj.dataTable != 1
- ? Container(
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '出诊时间:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize:
- ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Text(
- detailObj.createTime != null
- ? DateUtils.instance
- .getFormartData(
- timeSamp: detailObj
- .createTime,
- format: "MM月dd日 HH:mm")
- : '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- ],
- ),
- )
- : Container(),
- detailObj.dataTable != 1
- ? Container(
- // margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '出诊地点:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Container(
- width: ScreenUtil().setWidth(230),
- child: Text(
- '${detailObj.address ?? ''}',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- // color: Color(0xff666666),
- // fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- )
- : Container(),
- Container(
- // margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '问题描述:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Container(
- width: ScreenUtil().setWidth(230),
- child: Text(
- '${detailObj.expression ?? ''}',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- // color: Color(0xff666666),
- // fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- );
- }
- @override
- bool get wantKeepAlive => true;
- }
|