expert_detail.dart 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/res/gaps.dart';
  3. import 'package:liftmanager/net/api_service.dart';
  4. import 'package:liftmanager/utils/toast.dart';
  5. import 'package:liftmanager/widgets/app_bar.dart';
  6. import 'package:liftmanager/internal/search/search_router.dart';
  7. import 'package:liftmanager/widgets/app_search_bar.dart';
  8. import 'package:liftmanager/res/resources.dart';
  9. import 'package:liftmanager/routers/fluro_navigator.dart';
  10. import 'package:liftmanager/widgets/load_image.dart';
  11. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  12. import 'dart:math' as math;
  13. import 'package:flutter_screenutil/flutter_screenutil.dart';
  14. import 'dart:convert';
  15. import 'package:liftmanager/internal/bbs/model/expert_model.dart';
  16. import 'package:liftmanager/utils/url.dart';
  17. import 'package:liftmanager/mvp/base_page_state.dart';
  18. import 'package:liftmanager/internal/bbs/model/expert_comment_model.dart' as comment;
  19. import 'package:liftmanager/internal/bbs/presenter/expert_comment_list_presenter.dart';
  20. import 'package:liftmanager/utils/time_format.dart';
  21. import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
  22. import 'package:liftmanager/widgets/state_layout.dart';
  23. import 'package:provider/provider.dart';
  24. import 'package:liftmanager/widgets/my_refresh_list.dart';
  25. import 'package:liftmanager/utils/url.dart';
  26. import 'package:shared_preferences/shared_preferences.dart';
  27. import 'package:liftmanager/utils/theme_utils.dart';
  28. import 'package:liftmanager/widgets/star_item.dart';
  29. class ExpertDetail extends StatefulWidget {
  30. ExpertDetail(this.id);
  31. final String id;
  32. @override
  33. ExpertDetailState createState() => ExpertDetailState();
  34. }
  35. class ExpertDetailState extends BasePageState<ExpertDetail,ExpertCommentListPresenter> {
  36. BaseListProvider<comment.Records> provider = BaseListProvider<comment.Records>();
  37. // ExpertListState({Key key}) : super(key: key);
  38. ScrollController _scrollController;
  39. int listLength = 0;
  40. List<String> labelList = ["特邀专家","回复及时"];
  41. @override
  42. void initState() {
  43. super.initState();
  44. getExpertDetail();
  45. _onRefresh();
  46. }
  47. bool _hasData = false;
  48. bool kaiType = false;
  49. int _page = 1;
  50. Records detailObj;
  51. Future getExpertDetail() async {
  52. await NewApiService().getExpertDetail(widget.id,onSuccess: (res) {
  53. if (res != null) {
  54. _hasData = true;
  55. detailObj = res;
  56. print(123456);
  57. print(jsonEncode(res));
  58. setState(() {});
  59. }
  60. }, onError: (code, msg) {
  61. toasts(msg);
  62. });
  63. }
  64. @override
  65. Widget build(BuildContext context) {
  66. double width = MediaQuery.of(context).size.width;
  67. double height = MediaQuery.of(context).size.height;
  68. return ChangeNotifierProvider<BaseListProvider<comment.Records>>(
  69. create: (_) => provider,
  70. child:Scaffold(
  71. appBar: MyAppBar(
  72. actions:<Widget>[
  73. // FlatButton(
  74. // child: Icon(
  75. // IconData(
  76. // 0xe6f4,
  77. // fontFamily:"myfont"
  78. // ),
  79. // size: 26.0,
  80. // color:Color.fromRGBO(255, 255, 255, 1),
  81. // ),
  82. // textColor: Colours.dark_text,
  83. // highlightColor: Colors.transparent,
  84. // onPressed: () {
  85. // },
  86. // )
  87. ],
  88. ),
  89. body:Container(
  90. child:_hasData? Stack(
  91. children: <Widget>[
  92. Column(
  93. crossAxisAlignment: CrossAxisAlignment.start,
  94. children: <Widget>[
  95. // provider.list.length<1?expertDetailWisget():Container(child: null,),
  96. expertDetailWisget(),
  97. listLength==0?
  98. Expanded(
  99. child: ListView(
  100. children: <Widget>[
  101. Column(
  102. children:<Widget>[
  103. Container(
  104. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  105. decoration: BoxDecoration(
  106. border: Border(
  107. bottom: BorderSide(width: 0.5, color: Colours.line),
  108. ),
  109. ),
  110. child: Row(
  111. mainAxisAlignment: MainAxisAlignment.start,
  112. children:<Widget>[
  113. Container(
  114. padding: EdgeInsets.only(right:5),
  115. child: LoadAssetImage(
  116. // image: AssetImage(i['img']),
  117. "expert_three",
  118. width: ScreenUtil().setWidth(20),
  119. height: ScreenUtil().setWidth(20),
  120. // alignment: Alignment.centerLeft,
  121. ),
  122. ),
  123. Text(
  124. "专家简介",
  125. style: TextStyle(
  126. fontSize:ScreenUtil().setSp(17)
  127. ),
  128. textAlign:TextAlign.start,
  129. ),
  130. // Text(
  131. // "奥的斯",
  132. // style: TextStyle(
  133. // color:Color(0xff999999),
  134. // fontSize:18
  135. // ),
  136. // textAlign:TextAlign.start,
  137. // ),
  138. ]
  139. ),
  140. ),
  141. !kaiType?Container(
  142. width:width,
  143. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10)),
  144. child: Text(
  145. detailObj.introduction??'暂无',
  146. style: TextStyle(
  147. color:Color(0xff999999),
  148. fontSize:ScreenUtil().setSp(14)
  149. ),
  150. textAlign:TextAlign.start,
  151. maxLines: 2,
  152. overflow:TextOverflow.ellipsis,
  153. ),
  154. ):Container(
  155. width:width,
  156. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10)),
  157. child: Text(
  158. detailObj.introduction??'暂无',
  159. style: TextStyle(
  160. color:Color(0xff999999),
  161. fontSize:ScreenUtil().setSp(14)
  162. ),
  163. textAlign:TextAlign.start,
  164. ),
  165. ),
  166. !kaiType?
  167. InkWell(
  168. onTap: (){
  169. setState(() {
  170. kaiType = true;
  171. });
  172. },
  173. child: Container(
  174. padding: EdgeInsets.only(right:20,bottom:10),
  175. width: width,
  176. child: Text(
  177. "[展开]",
  178. style: TextStyle(
  179. color:Color(0xFF0287FF),
  180. fontSize:ScreenUtil().setSp(14)
  181. ),
  182. textAlign:TextAlign.end,
  183. ),
  184. ),
  185. )
  186. :Container(child: null,),
  187. Container(
  188. height:5,
  189. color: ThemeUtils.getDialogTextFieldColor(context),
  190. child: null,
  191. ),
  192. Container(
  193. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  194. decoration: BoxDecoration(
  195. border: Border(
  196. bottom: BorderSide(width: 0.5, color: Colours.line),
  197. ),
  198. ),
  199. child: Row(
  200. mainAxisAlignment: MainAxisAlignment.start,
  201. children:<Widget>[
  202. Container(
  203. padding: EdgeInsets.only(right:5),
  204. child: LoadAssetImage(
  205. // image: AssetImage(i['img']),
  206. "expert_two",
  207. width: ScreenUtil().setWidth(20),
  208. height: ScreenUtil().setWidth(20),
  209. // alignment: Alignment.centerLeft,
  210. ),
  211. ),
  212. Text(
  213. "执业经历",
  214. style: TextStyle(
  215. fontSize:ScreenUtil().setSp(17)
  216. ),
  217. textAlign:TextAlign.start,
  218. ),
  219. // Text(
  220. // "奥的斯",
  221. // style: TextStyle(
  222. // color:Color(0xff999999),
  223. // fontSize:18
  224. // ),
  225. // textAlign:TextAlign.start,
  226. // ),
  227. ]
  228. ),
  229. ),
  230. Container(
  231. width:width,
  232. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  233. decoration: BoxDecoration(
  234. border: Border(
  235. bottom: BorderSide(width: 5, color: ThemeUtils.getDialogTextFieldColor(context)),
  236. ),
  237. ),
  238. child: Text(
  239. detailObj.experience??'暂无',
  240. style: TextStyle(
  241. color:Color(0xff999999),
  242. fontSize:ScreenUtil().setSp(14)
  243. ),
  244. textAlign:TextAlign.start,
  245. ),
  246. ),
  247. Container(
  248. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  249. decoration: BoxDecoration(
  250. border: Border(
  251. bottom: BorderSide(width: 0.5, color: Colours.line),
  252. ),
  253. ),
  254. child: Row(
  255. mainAxisAlignment: MainAxisAlignment.start,
  256. children:<Widget>[
  257. Container(
  258. padding: EdgeInsets.only(right:5),
  259. child: LoadAssetImage(
  260. // image: AssetImage(i['img']),
  261. "expert_one",
  262. width: ScreenUtil().setWidth(20),
  263. height: ScreenUtil().setWidth(20),
  264. // alignment: Alignment.centerLeft,
  265. ),
  266. ),
  267. Text(
  268. "用户评价",
  269. style: TextStyle(
  270. fontSize:ScreenUtil().setSp(17)
  271. ),
  272. textAlign:TextAlign.start,
  273. ),
  274. ]
  275. ),
  276. ),
  277. Center(
  278. child: Container(
  279. padding: EdgeInsets.only(top:10),
  280. child: Text(
  281. '无数据',
  282. style: TextStyle(
  283. color:Color(0xff999999),
  284. fontSize:ScreenUtil().setSp(14)
  285. ),
  286. textAlign:TextAlign.start,
  287. ),
  288. )
  289. ),
  290. ]
  291. )
  292. ],
  293. ),
  294. )
  295. :Container(child: null,),
  296. listLength!=0?Expanded(
  297. flex: 1,
  298. child: Consumer<BaseListProvider<comment.Records>>(
  299. builder: (_, provider, __) {
  300. return MyListView(
  301. key: Key('expert_comment_list'),
  302. pageSize:4,
  303. normal:false,
  304. itemCount: provider.list.length,
  305. stateType: provider.stateType,
  306. onRefresh: _onRefresh,
  307. loadMore: _loadMore,
  308. hasMore: provider.hasMore,
  309. itemBuilder: (_, index) {
  310. return Container(
  311. child: Column(
  312. children: <Widget>[
  313. index==0?
  314. Column(
  315. children:<Widget>[
  316. Container(
  317. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  318. decoration: BoxDecoration(
  319. border: Border(
  320. bottom: BorderSide(width: 0.5, color: Colours.line),
  321. ),
  322. ),
  323. child: Row(
  324. mainAxisAlignment: MainAxisAlignment.start,
  325. children:<Widget>[
  326. Container(
  327. padding: EdgeInsets.only(right:5),
  328. child: LoadAssetImage(
  329. // image: AssetImage(i['img']),
  330. "expert_three",
  331. width: ScreenUtil().setWidth(20),
  332. height: ScreenUtil().setWidth(20),
  333. // alignment: Alignment.centerLeft,
  334. ),
  335. ),
  336. Text(
  337. "专家简介",
  338. style: TextStyle(
  339. fontSize:ScreenUtil().setSp(17)
  340. ),
  341. textAlign:TextAlign.start,
  342. ),
  343. // Text(
  344. // "奥的斯",
  345. // style: TextStyle(
  346. // color:Color(0xff999999),
  347. // fontSize:18
  348. // ),
  349. // textAlign:TextAlign.start,
  350. // ),
  351. ]
  352. ),
  353. ),
  354. !kaiType?Container(
  355. width:width,
  356. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10)),
  357. child: Text(
  358. detailObj.introduction??'暂无',
  359. style: TextStyle(
  360. color:Color(0xff999999),
  361. fontSize:ScreenUtil().setSp(14)
  362. ),
  363. textAlign:TextAlign.start,
  364. maxLines: 2,
  365. overflow:TextOverflow.ellipsis,
  366. ),
  367. ):Container(
  368. width:width,
  369. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10)),
  370. child: Text(
  371. detailObj.introduction??'暂无',
  372. style: TextStyle(
  373. color:Color(0xff999999),
  374. fontSize:ScreenUtil().setSp(14)
  375. ),
  376. textAlign:TextAlign.start,
  377. ),
  378. ),
  379. !kaiType?
  380. InkWell(
  381. onTap: (){
  382. setState(() {
  383. kaiType = true;
  384. });
  385. },
  386. child: Container(
  387. padding: EdgeInsets.only(right:20,bottom:10),
  388. width: width,
  389. child: Text(
  390. "[展开]",
  391. style: TextStyle(
  392. color:Color(0xFF0287FF),
  393. fontSize:ScreenUtil().setSp(14)
  394. ),
  395. textAlign:TextAlign.end,
  396. ),
  397. ),
  398. )
  399. :Container(child: null,),
  400. Container(
  401. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  402. decoration: BoxDecoration(
  403. border: Border(
  404. bottom: BorderSide(width: 0.5, color: Colours.line),
  405. ),
  406. ),
  407. child: Row(
  408. mainAxisAlignment: MainAxisAlignment.start,
  409. children:<Widget>[
  410. Container(
  411. padding: EdgeInsets.only(right:5),
  412. child: LoadAssetImage(
  413. // image: AssetImage(i['img']),
  414. "expert_two",
  415. width: ScreenUtil().setWidth(20),
  416. height: ScreenUtil().setWidth(20),
  417. // alignment: Alignment.centerLeft,
  418. ),
  419. ),
  420. Text(
  421. "执业经历",
  422. style: TextStyle(
  423. fontSize:ScreenUtil().setSp(17)
  424. ),
  425. textAlign:TextAlign.start,
  426. ),
  427. // Text(
  428. // "奥的斯",
  429. // style: TextStyle(
  430. // color:Color(0xff999999),
  431. // fontSize:18
  432. // ),
  433. // textAlign:TextAlign.start,
  434. // ),
  435. ]
  436. ),
  437. ),
  438. Container(
  439. width:width,
  440. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  441. decoration: BoxDecoration(
  442. border: Border(
  443. bottom: BorderSide(width: 5, color: ThemeUtils.getDialogTextFieldColor(context)),
  444. ),
  445. ),
  446. child: Text(
  447. detailObj.proficiency??'',
  448. style: TextStyle(
  449. color:Color(0xff999999),
  450. fontSize:ScreenUtil().setSp(14)
  451. ),
  452. textAlign:TextAlign.start,
  453. ),
  454. ),
  455. Container(
  456. padding: EdgeInsets.only(left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(15),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10)),
  457. decoration: BoxDecoration(
  458. border: Border(
  459. bottom: BorderSide(width: 0.5, color: Colours.line),
  460. ),
  461. ),
  462. child: Row(
  463. mainAxisAlignment: MainAxisAlignment.start,
  464. children:<Widget>[
  465. Container(
  466. padding: EdgeInsets.only(right:5),
  467. child: LoadAssetImage(
  468. // image: AssetImage(i['img']),
  469. "expert_one",
  470. width: ScreenUtil().setWidth(20),
  471. height: ScreenUtil().setWidth(20),
  472. // alignment: Alignment.centerLeft,
  473. ),
  474. ),
  475. Text(
  476. "用户评价",
  477. style: TextStyle(
  478. fontSize:ScreenUtil().setSp(17)
  479. ),
  480. textAlign:TextAlign.start,
  481. ),
  482. ]
  483. ),
  484. ),
  485. ]
  486. )
  487. :Container(child:null),
  488. Container(
  489. child:Container(
  490. padding: EdgeInsets.only(top:ScreenUtil().setWidth(10),left:ScreenUtil().setWidth(20),right:ScreenUtil().setWidth(20),bottom:ScreenUtil().setWidth(10)),
  491. decoration: BoxDecoration(
  492. border: Border(
  493. bottom: BorderSide(width: 0.5, color: Colours.line),
  494. ),
  495. ),
  496. child: Column(
  497. crossAxisAlignment: CrossAxisAlignment.start,
  498. children:<Widget>[
  499. Row(
  500. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  501. children:<Widget>[
  502. Row(
  503. children:<Widget>[
  504. Text(
  505. provider.list[index].mobile!=null?(provider.list[index].mobile).replaceRange(3,7,"****"):"",
  506. style: TextStyle(
  507. color:Color(0xff666666),
  508. fontSize:ScreenUtil().setSp(16)
  509. ),
  510. textAlign:TextAlign.start,
  511. ),
  512. Container(
  513. width:6,
  514. child: null,
  515. ),
  516. // provider.list[index].comment!=""?
  517. // Text(
  518. // "采纳",
  519. // style: TextStyle(
  520. // color:Colors.red,
  521. // fontSize:ScreenUtil().setSp(14)
  522. // ),
  523. // textAlign:TextAlign.start,
  524. // )
  525. // :
  526. // Text(""),
  527. ]
  528. ),
  529. Text(
  530. provider
  531. .list[index]
  532. .createTime!=null?DateUtils.instance
  533. .getFormartData(
  534. timeSamp: provider
  535. .list[index]
  536. .createTime,
  537. format: "yyyy-MM-dd"):'',
  538. style: TextStyle(
  539. color:Color(0xff999999),
  540. fontSize:ScreenUtil().setSp(14)
  541. ),
  542. textAlign:TextAlign.start,
  543. ),
  544. ]
  545. ),
  546. Container(
  547. child:Text(
  548. provider.list[index].comment??'',
  549. style: TextStyle(
  550. color:Color(0xff333333),
  551. fontSize:ScreenUtil().setSp(14)
  552. ),
  553. textAlign:TextAlign.start,
  554. ),
  555. ),
  556. Container(
  557. height:ScreenUtil().setWidth(10),
  558. decoration: BoxDecoration(
  559. color: Colors.red,
  560. ),
  561. child:Transform.rotate(
  562. origin: Offset(ScreenUtil().setWidth(25), ScreenUtil().setWidth(20)),
  563. angle: math.pi/2,
  564. child:CustomPaint(
  565. painter:ChatBoxPainter(
  566. color:Color(0xffF8F8F8),
  567. width:ScreenUtil().setWidth(10),
  568. height:ScreenUtil().setWidth(20)
  569. )
  570. )
  571. )
  572. ),
  573. Container(
  574. padding: EdgeInsets.only(top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10),left:ScreenUtil().setWidth(5),right:ScreenUtil().setWidth(5)),
  575. color: Color(0xffF8F8F8),
  576. child:Text(
  577. "问题描述:"+(provider.list[index].expression!=null?provider.list[index].expression:""),
  578. style: TextStyle(
  579. color:Color(0xff999999),
  580. fontSize:ScreenUtil().setSp(14)
  581. ),
  582. textAlign:TextAlign.start,
  583. ),
  584. ),
  585. ]
  586. ),
  587. )
  588. )
  589. ],
  590. ),
  591. );
  592. },
  593. );
  594. })):Container(child: null,),
  595. Container(
  596. height:ScreenUtil().setWidth(80),
  597. ),
  598. ],
  599. ),
  600. Positioned(
  601. bottom:0,
  602. left:0,
  603. child:Container(
  604. width: width,
  605. padding: EdgeInsets.only(top:ScreenUtil().setWidth(15),bottom:ScreenUtil().setWidth(15),left:ScreenUtil().setWidth(25),right:ScreenUtil().setWidth(25)),
  606. color:ThemeUtils.getDialogTextFieldColor(context),
  607. child: Container(
  608. height:ScreenUtil().setWidth(44),
  609. decoration: BoxDecoration(
  610. borderRadius: BorderRadius.circular(ScreenUtil().setWidth(22)),
  611. gradient: const LinearGradient(
  612. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  613. ),
  614. child: FlatButton(
  615. // padding: EdgeInsets.all(15.0),
  616. child: detailObj.serviceFee!=null?Text("线上咨询(¥${detailObj.serviceFee}元/次)"):Text("线上咨询(¥0元/次)"),
  617. textColor: Colors.white,
  618. onPressed: () {
  619. setExpertName(detailObj.name??"");
  620. setExpertFee(detailObj.serviceFee??0.0);
  621. NavigatorUtils.push(context, "${BbsRouter.buyService}?id=${widget.id}");
  622. },
  623. ),
  624. ),
  625. )
  626. )
  627. ],
  628. )
  629. :Center(
  630. child: Text("正在加载..."),
  631. )
  632. )
  633. ),
  634. );
  635. }
  636. getLevel(level){
  637. String img;
  638. if(level == 1){
  639. img = "L1@2x";
  640. }else if (level == 2){
  641. img = "L2@2x";
  642. }else if (level == 3){
  643. img = "L3@2x";
  644. }else if (level == 4){
  645. img = "L4@2x";
  646. }else if (level == 5){
  647. img = "L5@2x";
  648. }
  649. return img;
  650. }
  651. Widget expertDetailWisget (){
  652. double width = MediaQuery.of(context).size.width;
  653. double height = MediaQuery.of(context).size.height;
  654. return Column(
  655. children: <Widget>[
  656. Container(
  657. // height: ScreenUtil().setWidth(150),
  658. padding: EdgeInsets.only(bottom:10),
  659. decoration: BoxDecoration(
  660. gradient: const LinearGradient(
  661. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  662. ),
  663. child:Column(
  664. children: <Widget>[
  665. Container(
  666. child: Row(
  667. crossAxisAlignment: CrossAxisAlignment.start,
  668. children:<Widget>[
  669. Container(
  670. margin: EdgeInsets.only(left:ScreenUtil().setWidth(10),right:ScreenUtil().setWidth(10),top:ScreenUtil().setWidth(5)),
  671. decoration: BoxDecoration(
  672. borderRadius: BorderRadius.circular(ScreenUtil().setWidth(25)),
  673. ),
  674. child: Container(
  675. width: ScreenUtil().setWidth(50),
  676. height: ScreenUtil().setWidth(70),
  677. child: Stack(
  678. children: <Widget>[
  679. Container(
  680. padding: EdgeInsets.only(left:ScreenUtil().setWidth(3)),
  681. child: ClipRRect(
  682. borderRadius: BorderRadius.all(
  683. Radius.circular(50)),
  684. child: LoadNetworkImage(
  685. // image: AssetImage(i['img']),
  686. detailObj.avatarUrl,
  687. width: ScreenUtil().setWidth(44),
  688. height: ScreenUtil().setWidth(44),
  689. // alignment: Alignment.centerLeft,
  690. ),
  691. ),
  692. ),
  693. Positioned(
  694. top:ScreenUtil().setWidth(34),
  695. left: 0,
  696. child: LoadAssetImage(
  697. // image: AssetImage(i['img']),
  698. getLevel(detailObj.expertLevel),
  699. width: ScreenUtil().setWidth(50),
  700. height: ScreenUtil().setWidth(13),
  701. // alignment: Alignment.centerLeft,
  702. ),
  703. )
  704. ],
  705. ),
  706. )
  707. ),
  708. Expanded(
  709. child: Container(
  710. padding: EdgeInsets.only(right:ScreenUtil().setWidth(15)),
  711. child:Column(
  712. crossAxisAlignment: CrossAxisAlignment.start,
  713. children: <Widget>[
  714. Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,
  715. children: <Widget>[
  716. Text(
  717. detailObj.name??"",
  718. style: TextStyle(
  719. color:Colors.white,
  720. fontSize:ScreenUtil().setSp(18)
  721. ),
  722. ),
  723. StarItemShow(
  724. starRating: detailObj.averageScore!=null? double.parse(detailObj.averageScore.toString()):0.0,
  725. ),
  726. ],
  727. ),
  728. Text(
  729. detailObj.proficiencyBrandName??'',
  730. style: TextStyle(
  731. color:Colors.white,
  732. fontSize:ScreenUtil().setSp(14)
  733. ),
  734. // textAlign:TextAlign.start,
  735. ),
  736. detailObj.platformInvitedFlag==0?Container(
  737. padding:EdgeInsets.only(left:5,right:5),
  738. margin: EdgeInsets.only(right:5,top:5),
  739. // color:Colors.red,
  740. decoration: BoxDecoration(
  741. borderRadius: BorderRadius.circular(1.0),
  742. border: Border.all(
  743. width:0.5,
  744. color:Color(0xffB0E2FF),
  745. ),
  746. ),
  747. child:Text(
  748. "特邀专家",
  749. style: TextStyle(
  750. color:Colors.white,
  751. fontSize:ScreenUtil().setSp(12)
  752. ),
  753. textAlign:TextAlign.center,
  754. ),
  755. ):Container(child: null,),
  756. Row(
  757. children: <Widget>[
  758. Expanded(
  759. child: Container(
  760. padding:EdgeInsets.all(5),
  761. margin: EdgeInsets.only(right:5,top:5),
  762. // color:Colors.red,
  763. // decoration: BoxDecoration(
  764. // borderRadius: BorderRadius.circular(2.0),
  765. // border: Border.all(
  766. // width:0.5,
  767. // color:Color(0xffB0E2FF),
  768. // ),
  769. // color:Colors.white30,
  770. // ),
  771. child:Row(
  772. crossAxisAlignment: CrossAxisAlignment.start,
  773. children: <Widget>[
  774. Icon(
  775. IconData(0xe7a6,
  776. fontFamily: "myfont"),
  777. size: 14.0,
  778. color: Color(0xffffffff),
  779. ),
  780. SizedBox(
  781. width: 5,
  782. ),
  783. Expanded(
  784. child: Container(
  785. // padding:EdgeInsets.all(5),
  786. // margin: EdgeInsets.only(right:5,top:5),
  787. // // color:Colors.red,
  788. // decoration: BoxDecoration(
  789. // borderRadius: BorderRadius.circular(2.0),
  790. // border: Border.all(
  791. // width:0.5,
  792. // color:Color(0xffB0E2FF),
  793. // ),
  794. // color:Colors.white30,
  795. // ),
  796. child: Text(
  797. // "detailObj",
  798. detailObj.address!=null?detailObj.address.split(",")[0]:"",
  799. style: TextStyle(
  800. color:Colors.white,
  801. fontSize:ScreenUtil().setSp(12)
  802. ),
  803. textAlign:TextAlign.left,
  804. // overflow:TextOverflow.ellipsis,
  805. ),
  806. )
  807. )
  808. ],
  809. )
  810. ),
  811. )
  812. ],
  813. ),
  814. ],
  815. )
  816. )
  817. )
  818. ]
  819. ),
  820. ),
  821. Container(
  822. padding:EdgeInsets.only(top:ScreenUtil().setWidth(10)),
  823. child:Row(
  824. crossAxisAlignment: CrossAxisAlignment.center,
  825. mainAxisAlignment: MainAxisAlignment.spaceAround,
  826. children:<Widget>[
  827. Container(
  828. child:Column(
  829. crossAxisAlignment: CrossAxisAlignment.center,
  830. children:<Widget>[
  831. Text(
  832. detailObj.workDate!=null?detailObj.workDate.toString():"0",
  833. style: TextStyle(
  834. color:Colors.white,
  835. fontSize:ScreenUtil().setSp(16)
  836. ),
  837. textAlign:TextAlign.start,
  838. ),
  839. Text(
  840. "从业年数",
  841. style: TextStyle(
  842. color:Colors.white,
  843. fontSize:ScreenUtil().setSp(14)
  844. ),
  845. textAlign:TextAlign.start,
  846. ),
  847. ]
  848. )
  849. ),
  850. Container(
  851. child:Column(
  852. crossAxisAlignment: CrossAxisAlignment.center,
  853. children:<Widget>[
  854. Text(
  855. detailObj.serviceCounts!=null?detailObj.serviceCounts.toString():"0",
  856. style: TextStyle(
  857. color:Colors.white,
  858. fontSize:ScreenUtil().setSp(16)
  859. ),
  860. textAlign:TextAlign.start,
  861. ),
  862. Text(
  863. "服务次数",
  864. style: TextStyle(
  865. color:Colors.white,
  866. fontSize:ScreenUtil().setSp(14)
  867. ),
  868. textAlign:TextAlign.start,
  869. ),
  870. ]
  871. )
  872. ),
  873. // Container(
  874. // child:Column(
  875. // crossAxisAlignment: CrossAxisAlignment.center,
  876. // children:<Widget>[
  877. // Text(
  878. // "99.9",
  879. // style: TextStyle(
  880. // color:Colors.white,
  881. // fontSize:ScreenUtil().setSp(16)
  882. // ),
  883. // textAlign:TextAlign.start,
  884. // ),
  885. // Text(
  886. // "好评率(%)",
  887. // style: TextStyle(
  888. // color:Colors.white,
  889. // fontSize:ScreenUtil().setSp(14)
  890. // ),
  891. // textAlign:TextAlign.start,
  892. // ),
  893. // ]
  894. // )
  895. // ),
  896. Container(
  897. child:Column(
  898. crossAxisAlignment: CrossAxisAlignment.center,
  899. children:<Widget>[
  900. Text(
  901. detailObj.adoptCounts!=null?detailObj.adoptCounts.toString():"0",
  902. style: TextStyle(
  903. color:Colors.white,
  904. fontSize:ScreenUtil().setSp(16)
  905. ),
  906. textAlign:TextAlign.start,
  907. ),
  908. Text(
  909. "采纳次数",
  910. style: TextStyle(
  911. color:Colors.white,
  912. fontSize:ScreenUtil().setSp(14)
  913. ),
  914. textAlign:TextAlign.start,
  915. ),
  916. ]
  917. )
  918. ),
  919. ]
  920. )
  921. ),
  922. ],
  923. )
  924. ),
  925. ],
  926. );
  927. }
  928. @override
  929. void dispose() {
  930. super.dispose();
  931. }
  932. void setExpertName (String expertName)async{
  933. SharedPreferences prefs = await SharedPreferences.getInstance();
  934. prefs.setString("expertName", expertName);
  935. }
  936. void setExpertFee (double expertFee)async{
  937. SharedPreferences prefs = await SharedPreferences.getInstance();
  938. prefs.setDouble("expertFee", expertFee);
  939. }
  940. Future _onRefresh() async {
  941. _page = 1;
  942. await presenter.getExpertCommentList(_page,int.parse(widget.id),getLength: (length){
  943. setState(() {
  944. listLength = length;
  945. });
  946. });
  947. }
  948. Future _loadMore() async {
  949. _page++;
  950. await presenter.getExpertCommentList(_page,int.parse(widget.id),getLength: (length){
  951. });
  952. }
  953. @override
  954. ExpertCommentListPresenter createPresenter() {
  955. return ExpertCommentListPresenter();
  956. }
  957. }
  958. class ChatBoxPainter extends CustomPainter {
  959. ChatBoxPainter({@required this.width,@required this.height,@required this.color});
  960. final double width;
  961. final double height;
  962. final Color color;
  963. @override
  964. void paint(Canvas canvas, Size size) {
  965. Path path = Path()
  966. ..moveTo(0, height/2)
  967. ..lineTo(width, height)
  968. ..lineTo(width, 0)
  969. ..lineTo(0, height/2);
  970. Paint paint = Paint()
  971. ..style = PaintingStyle.fill
  972. ..color = color;
  973. canvas.drawPath(path,paint);
  974. }
  975. @override
  976. bool shouldRepaint(ChatBoxPainter oldDelegate) => false;
  977. @override
  978. bool shouldRebuildSemantics(ChatBoxPainter oldDelegate) => false;
  979. }