comment.dart 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:liftmanager/internal/account/provider/user_provider.dart';
  5. import 'package:liftmanager/internal/wode/wode_router.dart';
  6. import 'package:liftmanager/res/resources.dart';
  7. import 'package:liftmanager/routers/fluro_navigator.dart';
  8. import 'package:liftmanager/widgets/app_bar.dart';
  9. import 'package:liftmanager/widgets/load_image.dart';
  10. import 'package:liftmanager/widgets/star_item.dart';
  11. import 'package:provider/provider.dart';
  12. class CommentMaster extends StatefulWidget {
  13. // Comment(this.type);
  14. // final String type;
  15. @override
  16. State<StatefulWidget> createState() {
  17. return CommentMasterState();
  18. }
  19. }
  20. class CommentMasterState extends State<CommentMaster> with AutomaticKeepAliveClientMixin {
  21. UserProvider provider = UserProvider();
  22. Map<String,String>obj={
  23. "pic":"temporary/avator2",
  24. "name":"张涛",
  25. "serviceType":"出诊服务",
  26. "time":"01月05日",
  27. "brand":"奥的斯",
  28. "desc":"电梯故障紧急维修、电梯保养、电梯短路处理、电梯闸门故障维修",
  29. "price":"20",
  30. "num":"299",
  31. "point":"5.0",
  32. "id":"2",
  33. "type":"2"
  34. };
  35. double serviceLevel = 0;
  36. double serviceTaidu = 0;
  37. double speed = 0;
  38. TextEditingController _controller = TextEditingController();
  39. @override
  40. void initState() {
  41. // TODO: implement initState
  42. super.initState();
  43. }
  44. @override
  45. void dispose() {
  46. // provider.dispose();
  47. super.dispose();
  48. }
  49. @override
  50. Widget build(BuildContext context) {
  51. double width = MediaQuery.of(context).size.width;
  52. return
  53. // Center(child:new Text("个人中心"));
  54. ChangeNotifierProvider<UserProvider>(
  55. create: (_) => provider,
  56. child:
  57. Scaffold(
  58. appBar: MyAppBar(
  59. centerTitle: "评价本次服务",
  60. ),
  61. body: Consumer<UserProvider>(builder: (_, provider, __) {
  62. return Stack(
  63. children:<Widget>[
  64. ListView(padding: EdgeInsets.all(0.0), children: <Widget>[
  65. UserDetail(obj: obj,),
  66. Container(
  67. color: Color(0xffFAF7FA),
  68. height: ScreenUtil().setWidth(5),
  69. ),
  70. Container(
  71. padding: EdgeInsets.only(left:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(15),bottom:ScreenUtil().setWidth(15)),
  72. child: Text(
  73. '您对专家的服务满意吗?',
  74. style: TextStyle(
  75. color:Color(0xff333333),
  76. fontSize:ScreenUtil().setSp(16)
  77. ),
  78. textAlign:TextAlign.start,
  79. ),
  80. ),
  81. Container(
  82. child:Column(
  83. children:<Widget>[
  84. StarItem(
  85. title: "技术水平:",
  86. starRating: serviceLevel,
  87. onRatingChanged: (res){
  88. serviceLevel = res;
  89. setState(() {
  90. });
  91. },
  92. ),
  93. StarItem(
  94. title: "服务态度:",
  95. starRating: serviceTaidu,
  96. onRatingChanged: (res){
  97. serviceTaidu = res;
  98. setState(() {
  99. });
  100. },
  101. ),
  102. StarItem(
  103. title: "响应速度:",
  104. starRating: speed,
  105. onRatingChanged: (res){
  106. speed = res;
  107. setState(() {
  108. });
  109. },
  110. ),
  111. SizedBox(
  112. height: 8,
  113. ),
  114. Container(
  115. decoration: BoxDecoration(
  116. border: Border.all(
  117. width:0.5,
  118. color:Color(0xffcccccc)
  119. ),
  120. color: Colors.white,
  121. ),
  122. margin: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(15)),
  123. child: Padding(
  124. padding: const EdgeInsets.only(
  125. top: 5, left: 15.0, right: 15.0, bottom: 8.0),
  126. child: TextField(
  127. // maxLength: 100,
  128. maxLines: 5,
  129. autofocus: false,
  130. controller: _controller,
  131. // keyboardType: widget.keyboardType,
  132. //style: TextStyles.textDark14,
  133. decoration: InputDecoration(
  134. hintText: "您的满意是对专家最大的支持和鼓励",
  135. border: InputBorder.none,
  136. hintStyle: TextStyles.textGray14)),
  137. ),
  138. ),
  139. ]
  140. )
  141. )
  142. ]),
  143. Positioned(
  144. bottom:0,
  145. left:0,
  146. child:Row(
  147. children:<Widget>[
  148. Container(
  149. height:44,
  150. decoration: BoxDecoration(
  151. color:Colours.blue_app_main,
  152. borderRadius: BorderRadius.circular(ScreenUtil().setWidth(22)),
  153. // gradient: const LinearGradient(
  154. // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  155. ),
  156. margin: EdgeInsets.all(ScreenUtil().setWidth(20)),
  157. width: width*0.9,
  158. child: FlatButton(
  159. // padding: EdgeInsets.all(15.0),
  160. child: Text("提交"),
  161. // color: Theme
  162. // .of(context)
  163. // .primaryColor,
  164. textColor: Colors.white,
  165. onPressed: () {
  166. NavigatorUtils.push(context,WodeRouter.orderPage);
  167. },
  168. ),
  169. )
  170. ]
  171. )
  172. )
  173. ]
  174. );
  175. })));
  176. }
  177. @override
  178. bool get wantKeepAlive => true;
  179. }
  180. class UserDetail extends StatelessWidget {
  181. UserDetail({Key key,this.obj}) : super(key: key);
  182. Map<String,String>obj;
  183. @override
  184. Widget build(BuildContext context) {
  185. return Container(
  186. // height: 20,
  187. padding:EdgeInsets.only(bottom:ScreenUtil().setWidth(20),top:ScreenUtil().setWidth(10)),
  188. child: Row(
  189. crossAxisAlignment: CrossAxisAlignment.start,
  190. children: <Widget>[
  191. Expanded(
  192. child: GestureDetector(
  193. onTap: (){
  194. NavigatorUtils.push(context, WodeRouter.orderDetail);
  195. },
  196. child:Row(
  197. crossAxisAlignment: CrossAxisAlignment.start,
  198. children:<Widget>[
  199. Container(
  200. margin: EdgeInsets.only(left:ScreenUtil().setWidth(15),right:ScreenUtil().setWidth(10),top:ScreenUtil().setWidth(5)),
  201. decoration: BoxDecoration(
  202. borderRadius: BorderRadius.circular(ScreenUtil().setWidth(25)),
  203. ),
  204. child: LoadAssetImage(
  205. // image: AssetImage(i['img']),
  206. obj["pic"],
  207. width: ScreenUtil().setWidth(43),
  208. height:ScreenUtil().setWidth(43),
  209. // alignment: Alignment.centerLeft,
  210. ),
  211. ),
  212. Expanded(
  213. child: Container(
  214. padding: EdgeInsets.only(right:ScreenUtil().setWidth(15)),
  215. child:Column(
  216. children: <Widget>[
  217. Container(
  218. child:Row(
  219. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  220. children:<Widget>[
  221. Row(
  222. crossAxisAlignment: CrossAxisAlignment.center,
  223. children:<Widget>[
  224. Text(
  225. obj["name"],
  226. style: TextStyle(
  227. color:Color(0xff333333),
  228. fontSize:ScreenUtil().setSp(18)
  229. ),
  230. textAlign:TextAlign.start,
  231. ),
  232. Container(
  233. padding: EdgeInsets.only(left:5),
  234. child:Text(
  235. obj["brand"],
  236. style: TextStyle(
  237. color:Color(0xff666666),
  238. fontSize:ScreenUtil().setSp(14)
  239. ),
  240. textAlign:TextAlign.start,
  241. ),
  242. )
  243. ]
  244. ),
  245. ]
  246. )
  247. ),
  248. Align(
  249. child:Text(
  250. obj["desc"],
  251. style: TextStyle(
  252. color:Color(0xff999999),
  253. fontSize:ScreenUtil().setSp(14)
  254. ),
  255. textAlign:TextAlign.start,
  256. ),
  257. ),
  258. ],
  259. )
  260. )
  261. )
  262. ]
  263. ),
  264. )
  265. ),
  266. ],
  267. ),
  268. );
  269. }
  270. }