expert_detail.dart 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361
  1. import 'dart:convert';
  2. import 'dart:math' as math;
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  6. import 'package:liftmanager/internal/bbs/model/expert_comment_model.dart'
  7. as comment;
  8. import 'package:liftmanager/internal/bbs/model/expert_model.dart';
  9. import 'package:liftmanager/internal/bbs/presenter/expert_comment_list_presenter.dart';
  10. import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
  11. import 'package:liftmanager/mvp/base_page_state.dart';
  12. import 'package:liftmanager/net/api_service.dart';
  13. import 'package:liftmanager/res/resources.dart';
  14. import 'package:liftmanager/routers/fluro_navigator.dart';
  15. import 'package:liftmanager/utils/theme_utils.dart';
  16. import 'package:liftmanager/utils/time_format.dart';
  17. import 'package:liftmanager/utils/toast.dart';
  18. import 'package:liftmanager/widgets/app_bar.dart';
  19. import 'package:liftmanager/widgets/clip_widgets.dart';
  20. import 'package:liftmanager/widgets/load_image.dart';
  21. import 'package:liftmanager/widgets/my_refresh_list.dart';
  22. import 'package:liftmanager/widgets/star_item.dart';
  23. import 'package:provider/provider.dart';
  24. import 'package:shared_preferences/shared_preferences.dart';
  25. import 'package:umeng_common_sdk/umeng_common_sdk.dart';
  26. class ExpertDetail extends StatefulWidget {
  27. ExpertDetail(this.id);
  28. final String id;
  29. @override
  30. ExpertDetailState createState() => ExpertDetailState();
  31. }
  32. class ExpertDetailState
  33. extends BasePageState<ExpertDetail, ExpertCommentListPresenter> {
  34. BaseListProvider<comment.Records> provider =
  35. BaseListProvider<comment.Records>();
  36. // ExpertListState({Key key}) : super(key: key);
  37. ScrollController _scrollController;
  38. int listLength = 0;
  39. List<String> labelList = ["特邀专家", "回复及时"];
  40. @override
  41. void initState() {
  42. super.initState();
  43. getExpertDetail();
  44. _onRefresh();
  45. }
  46. bool _hasData = false;
  47. bool kaiType = false;
  48. int _page = 1;
  49. Records detailObj;
  50. Future getExpertDetail() async {
  51. await NewApiService().getExpertDetail(widget.id, onSuccess: (res) {
  52. if (res != null) {
  53. _hasData = true;
  54. detailObj = res;
  55. print(123456);
  56. print(jsonEncode(res));
  57. setState(() {});
  58. }
  59. }, onError: (code, msg) {
  60. toasts(msg);
  61. });
  62. }
  63. @override
  64. Widget build(BuildContext context) {
  65. double width = MediaQuery.of(context).size.width;
  66. double height = MediaQuery.of(context).size.height;
  67. return ChangeNotifierProvider<BaseListProvider<comment.Records>>(
  68. create: (_) => provider,
  69. child: Scaffold(
  70. appBar: MyAppBar(
  71. centerTitle: '专家详情',
  72. // title: '专家详情',
  73. actions: <Widget>[
  74. // FlatButton(
  75. // child: Icon(
  76. // IconData(
  77. // 0xe6f4,
  78. // fontFamily:"Iconfont"
  79. // ),
  80. // size: 26.0,
  81. // color:Color.fromRGBO(255, 255, 255, 1),
  82. // ),
  83. // textColor: Colours.dark_text,
  84. // highlightColor: Colors.transparent,
  85. // onPressed: () {
  86. // },
  87. // )
  88. ],
  89. ),
  90. body: Container(
  91. child: _hasData
  92. ? Stack(
  93. children: <Widget>[
  94. Column(
  95. crossAxisAlignment: CrossAxisAlignment.start,
  96. children: <Widget>[
  97. // provider.list.length<1?expertDetailWisget():Container(child: null,),
  98. expertDetailWisget(),
  99. listLength == 0
  100. ? Expanded(
  101. child: ListView(
  102. children: <Widget>[
  103. Column(children: <Widget>[
  104. Container(
  105. padding: EdgeInsets.only(
  106. left: ScreenUtil().setWidth(20),
  107. right:
  108. ScreenUtil().setWidth(15),
  109. top: ScreenUtil().setWidth(10),
  110. bottom:
  111. ScreenUtil().setWidth(10)),
  112. decoration: BoxDecoration(
  113. border: Border(
  114. bottom: BorderSide(
  115. width: 0.5,
  116. color: Colours.line),
  117. ),
  118. ),
  119. child: Row(
  120. mainAxisAlignment:
  121. MainAxisAlignment.start,
  122. children: <Widget>[
  123. Container(
  124. padding: EdgeInsets.only(
  125. right: 5),
  126. child: LoadAssetImage(
  127. // image: AssetImage(i['img']),
  128. "expert_three",
  129. width: ScreenUtil()
  130. .setWidth(32),
  131. height: ScreenUtil()
  132. .setWidth(32),
  133. // alignment: Alignment.centerLeft,
  134. ),
  135. ),
  136. Text(
  137. "专家简介",
  138. style: TextStyle(
  139. fontSize: ScreenUtil()
  140. .setSp(17)),
  141. textAlign: TextAlign.start,
  142. ),
  143. // Text(
  144. // "奥的斯",
  145. // style: TextStyle(
  146. // color:Color(0xff999999),
  147. // fontSize:18
  148. // ),
  149. // textAlign:TextAlign.start,
  150. // ),
  151. ]),
  152. ),
  153. !kaiType
  154. ? Container(
  155. width: width,
  156. padding: EdgeInsets.only(
  157. left: ScreenUtil()
  158. .setWidth(20),
  159. right: ScreenUtil()
  160. .setWidth(15),
  161. top: ScreenUtil()
  162. .setWidth(10)),
  163. child: Text(
  164. detailObj.introduction ??
  165. '暂无',
  166. style: TextStyle(
  167. color:
  168. Color(0xff999999),
  169. fontSize: ScreenUtil()
  170. .setSp(14)),
  171. textAlign: TextAlign.start,
  172. maxLines: 2,
  173. overflow:
  174. TextOverflow.ellipsis,
  175. ),
  176. )
  177. : Container(
  178. width: width,
  179. padding: EdgeInsets.only(
  180. left: ScreenUtil()
  181. .setWidth(20),
  182. right: ScreenUtil()
  183. .setWidth(15),
  184. top: ScreenUtil()
  185. .setWidth(10)),
  186. child: Text(
  187. detailObj.introduction ??
  188. '暂无',
  189. style: TextStyle(
  190. color:
  191. Color(0xff999999),
  192. fontSize: ScreenUtil()
  193. .setSp(14)),
  194. textAlign: TextAlign.start,
  195. ),
  196. ),
  197. // !kaiType?
  198. InkWell(
  199. onTap: () {
  200. setState(() {
  201. kaiType = !kaiType;
  202. });
  203. },
  204. child: Container(
  205. color: Color(0x195887FF),
  206. // this.bgcolor =const Color(0x195887FF),
  207. // this.textcolor= const Color(0xff5887FF),
  208. padding: EdgeInsets.only(
  209. right: 20, bottom: 10),
  210. width: width,
  211. child: Text(
  212. !kaiType ? "展开" : "收起",
  213. style: TextStyle(
  214. color: Color(0xff5887FF),
  215. fontSize:
  216. ScreenUtil().setSp(14)),
  217. textAlign: TextAlign.end,
  218. ),
  219. ),
  220. )
  221. // :Container(child: null,)
  222. ,
  223. Container(
  224. height: 5,
  225. color: ThemeUtils
  226. .getDialogTextFieldColor(
  227. context),
  228. child: null,
  229. ),
  230. Container(
  231. padding: EdgeInsets.only(
  232. left: ScreenUtil().setWidth(20),
  233. right:
  234. ScreenUtil().setWidth(15),
  235. top: ScreenUtil().setWidth(10),
  236. bottom:
  237. ScreenUtil().setWidth(10)),
  238. decoration: BoxDecoration(
  239. border: Border(
  240. bottom: BorderSide(
  241. width: 0.5,
  242. color: Colours.line),
  243. ),
  244. ),
  245. child: Row(
  246. mainAxisAlignment:
  247. MainAxisAlignment.start,
  248. children: <Widget>[
  249. Container(
  250. padding: EdgeInsets.only(
  251. right: 5),
  252. child: LoadAssetImage(
  253. // image: AssetImage(i['img']),
  254. "expert_two",
  255. width: ScreenUtil()
  256. .setWidth(32),
  257. height: ScreenUtil()
  258. .setWidth(32),
  259. // alignment: Alignment.centerLeft,
  260. ),
  261. ),
  262. Text(
  263. "执业经历",
  264. style: TextStyle(
  265. fontSize: ScreenUtil()
  266. .setSp(17)),
  267. textAlign: TextAlign.start,
  268. ),
  269. // Text(
  270. // "奥的斯",
  271. // style: TextStyle(
  272. // color:Color(0xff999999),
  273. // fontSize:18
  274. // ),
  275. // textAlign:TextAlign.start,
  276. // ),
  277. ]),
  278. ),
  279. Container(
  280. width: width,
  281. padding: EdgeInsets.only(
  282. left: ScreenUtil().setWidth(20),
  283. right:
  284. ScreenUtil().setWidth(15),
  285. top: ScreenUtil().setWidth(10),
  286. bottom:
  287. ScreenUtil().setWidth(10)),
  288. decoration: BoxDecoration(
  289. border: Border(
  290. bottom: BorderSide(
  291. width: 5,
  292. color: ThemeUtils
  293. .getDialogTextFieldColor(
  294. context)),
  295. ),
  296. ),
  297. child: Text(
  298. detailObj.experience ?? '暂无',
  299. style: TextStyle(
  300. color: Color(0xff999999),
  301. fontSize:
  302. ScreenUtil().setSp(14)),
  303. textAlign: TextAlign.start,
  304. ),
  305. ),
  306. Container(
  307. padding: EdgeInsets.only(
  308. left: ScreenUtil().setWidth(20),
  309. right:
  310. ScreenUtil().setWidth(15),
  311. top: ScreenUtil().setWidth(10),
  312. bottom:
  313. ScreenUtil().setWidth(10)),
  314. decoration: BoxDecoration(
  315. border: Border(
  316. bottom: BorderSide(
  317. width: 0.5,
  318. color: Colours.line),
  319. ),
  320. ),
  321. child: Row(
  322. mainAxisAlignment:
  323. MainAxisAlignment.start,
  324. children: <Widget>[
  325. Container(
  326. padding: EdgeInsets.only(
  327. right: 5),
  328. child: LoadAssetImage(
  329. // image: AssetImage(i['img']),
  330. "expert_one",
  331. width: ScreenUtil()
  332. .setWidth(32),
  333. height: ScreenUtil()
  334. .setWidth(32),
  335. // alignment: Alignment.centerLeft,
  336. ),
  337. ),
  338. Text(
  339. "用户评价",
  340. style: TextStyle(
  341. fontSize: ScreenUtil()
  342. .setSp(17)),
  343. textAlign: TextAlign.start,
  344. ),
  345. ]),
  346. ),
  347. Center(
  348. child: Container(
  349. padding: EdgeInsets.only(top: 10),
  350. child: Text(
  351. '无数据',
  352. style: TextStyle(
  353. color: Color(0xff999999),
  354. fontSize:
  355. ScreenUtil().setSp(14)),
  356. textAlign: TextAlign.start,
  357. ),
  358. )),
  359. ])
  360. ],
  361. ),
  362. )
  363. : Container(
  364. child: null,
  365. ),
  366. listLength != 0
  367. ? Expanded(
  368. flex: 1,
  369. child: Consumer<
  370. BaseListProvider<comment.Records>>(
  371. builder: (_, provider, __) {
  372. return MyListView(
  373. key: Key('expert_comment_list'),
  374. pageSize: 4,
  375. normal: false,
  376. itemCount: provider.list.length,
  377. stateType: provider.stateType,
  378. onRefresh: _onRefresh,
  379. loadMore: _loadMore,
  380. hasMore: provider.hasMore,
  381. itemBuilder: (_, index) {
  382. return Container(
  383. child: Column(
  384. children: <Widget>[
  385. index == 0
  386. ? Column(children: <Widget>[
  387. Container(
  388. padding: EdgeInsets.only(
  389. left: ScreenUtil()
  390. .setWidth(20),
  391. right:
  392. ScreenUtil()
  393. .setWidth(
  394. 15),
  395. top: ScreenUtil()
  396. .setWidth(10),
  397. bottom:
  398. ScreenUtil()
  399. .setWidth(
  400. 10)),
  401. decoration:
  402. BoxDecoration(
  403. border: Border(
  404. bottom: BorderSide(
  405. width: 0.5,
  406. color: Colours
  407. .line),
  408. ),
  409. ),
  410. child: Row(
  411. mainAxisAlignment:
  412. MainAxisAlignment
  413. .start,
  414. children: <
  415. Widget>[
  416. Container(
  417. padding: EdgeInsets
  418. .only(
  419. right:
  420. 5),
  421. child:
  422. LoadAssetImage(
  423. // image: AssetImage(i['img']),
  424. "expert_three",
  425. width: ScreenUtil()
  426. .setWidth(
  427. 32),
  428. height: ScreenUtil()
  429. .setWidth(
  430. 32),
  431. // alignment: Alignment.centerLeft,
  432. ),
  433. ),
  434. Text(
  435. "专家简介",
  436. style: TextStyle(
  437. fontSize:
  438. ScreenUtil()
  439. .setSp(17)),
  440. textAlign:
  441. TextAlign
  442. .start,
  443. ),
  444. // Text(
  445. // "奥的斯",
  446. // style: TextStyle(
  447. // color:Color(0xff999999),
  448. // fontSize:18
  449. // ),
  450. // textAlign:TextAlign.start,
  451. // ),
  452. ]),
  453. ),
  454. !kaiType
  455. ? Container(
  456. width: width,
  457. padding: EdgeInsets.only(
  458. left: ScreenUtil()
  459. .setWidth(
  460. 20),
  461. right: ScreenUtil()
  462. .setWidth(
  463. 15),
  464. top: ScreenUtil()
  465. .setWidth(
  466. 10)),
  467. child: Text(
  468. detailObj
  469. .introduction ??
  470. '暂无',
  471. style: TextStyle(
  472. color: Color(
  473. 0xff999999),
  474. fontSize:
  475. ScreenUtil()
  476. .setSp(14)),
  477. textAlign:
  478. TextAlign
  479. .start,
  480. maxLines: 2,
  481. overflow:
  482. TextOverflow
  483. .ellipsis,
  484. ),
  485. )
  486. : Container(
  487. width: width,
  488. padding: EdgeInsets.only(
  489. left: ScreenUtil()
  490. .setWidth(
  491. 20),
  492. right: ScreenUtil()
  493. .setWidth(
  494. 15),
  495. top: ScreenUtil()
  496. .setWidth(
  497. 10)),
  498. child: Text(
  499. detailObj
  500. .introduction ??
  501. '暂无',
  502. style: TextStyle(
  503. color: Color(
  504. 0xff999999),
  505. fontSize:
  506. ScreenUtil()
  507. .setSp(14)),
  508. textAlign:
  509. TextAlign
  510. .start,
  511. ),
  512. ),
  513. !kaiType
  514. ? InkWell(
  515. onTap: () {
  516. setState(() {
  517. kaiType =
  518. true;
  519. });
  520. },
  521. child: Row(
  522. children: [
  523. Expanded(
  524. child:
  525. Container()),
  526. Container(
  527. color: Color(
  528. 0x195887FF),
  529. padding: EdgeInsets.only(
  530. right:
  531. 5,
  532. left:
  533. 5,
  534. bottom:
  535. 3,
  536. top:
  537. 3),
  538. // width: width,
  539. child:
  540. Text(
  541. "展开",
  542. style: TextStyle(
  543. color:
  544. Color(0xff5887FF),
  545. fontSize: ScreenUtil().setSp(14)),
  546. textAlign:
  547. TextAlign.center,
  548. ),
  549. ),
  550. SizedBox(
  551. width: 5,
  552. )
  553. ],
  554. ))
  555. : Container(
  556. child: null,
  557. ),
  558. Container(
  559. padding: EdgeInsets.only(
  560. left: ScreenUtil()
  561. .setWidth(20),
  562. right:
  563. ScreenUtil()
  564. .setWidth(
  565. 15),
  566. top: ScreenUtil()
  567. .setWidth(10),
  568. bottom:
  569. ScreenUtil()
  570. .setWidth(
  571. 10)),
  572. decoration:
  573. BoxDecoration(
  574. border: Border(
  575. bottom: BorderSide(
  576. width: 0.5,
  577. color: Colours
  578. .line),
  579. ),
  580. ),
  581. child: Row(
  582. mainAxisAlignment:
  583. MainAxisAlignment
  584. .start,
  585. children: <
  586. Widget>[
  587. Container(
  588. padding: EdgeInsets
  589. .only(
  590. right:
  591. 5),
  592. child:
  593. LoadAssetImage(
  594. // image: AssetImage(i['img']),
  595. "expert_two",
  596. width: ScreenUtil()
  597. .setWidth(
  598. 32),
  599. height: ScreenUtil()
  600. .setWidth(
  601. 32),
  602. // alignment: Alignment.centerLeft,
  603. ),
  604. ),
  605. Text(
  606. "执业经历",
  607. style: TextStyle(
  608. fontSize:
  609. ScreenUtil()
  610. .setSp(17)),
  611. textAlign:
  612. TextAlign
  613. .start,
  614. ),
  615. // Text(
  616. // "奥的斯",
  617. // style: TextStyle(
  618. // color:Color(0xff999999),
  619. // fontSize:18
  620. // ),
  621. // textAlign:TextAlign.start,
  622. // ),
  623. ]),
  624. ),
  625. Container(
  626. width: width,
  627. padding: EdgeInsets.only(
  628. left: ScreenUtil()
  629. .setWidth(20),
  630. right:
  631. ScreenUtil()
  632. .setWidth(
  633. 15),
  634. top: ScreenUtil()
  635. .setWidth(10),
  636. bottom:
  637. ScreenUtil()
  638. .setWidth(
  639. 10)),
  640. decoration:
  641. BoxDecoration(
  642. border: Border(
  643. bottom: BorderSide(
  644. width: 5,
  645. color: ThemeUtils
  646. .getDialogTextFieldColor(
  647. context)),
  648. ),
  649. ),
  650. child: Text(
  651. detailObj
  652. .proficiency ??
  653. '',
  654. style: TextStyle(
  655. color: Color(
  656. 0xff999999),
  657. fontSize:
  658. ScreenUtil()
  659. .setSp(
  660. 14)),
  661. textAlign:
  662. TextAlign.start,
  663. ),
  664. ),
  665. Container(
  666. padding: EdgeInsets.only(
  667. left: ScreenUtil()
  668. .setWidth(20),
  669. right:
  670. ScreenUtil()
  671. .setWidth(
  672. 15),
  673. top: ScreenUtil()
  674. .setWidth(10),
  675. bottom:
  676. ScreenUtil()
  677. .setWidth(
  678. 10)),
  679. decoration:
  680. BoxDecoration(
  681. border: Border(
  682. bottom: BorderSide(
  683. width: 0.5,
  684. color: Colours
  685. .line),
  686. ),
  687. ),
  688. child: Row(
  689. mainAxisAlignment:
  690. MainAxisAlignment
  691. .start,
  692. children: <
  693. Widget>[
  694. Container(
  695. padding: EdgeInsets
  696. .only(
  697. right:
  698. 5),
  699. child:
  700. LoadAssetImage(
  701. // image: AssetImage(i['img']),
  702. "expert_one",
  703. width: ScreenUtil()
  704. .setWidth(
  705. 32),
  706. height: ScreenUtil()
  707. .setWidth(
  708. 32),
  709. // alignment: Alignment.centerLeft,
  710. ),
  711. ),
  712. Text(
  713. "用户评价",
  714. style: TextStyle(
  715. fontSize:
  716. ScreenUtil()
  717. .setSp(17)),
  718. textAlign:
  719. TextAlign
  720. .start,
  721. ),
  722. ]),
  723. ),
  724. ])
  725. : Container(child: null),
  726. Container(
  727. child: Container(
  728. padding: EdgeInsets.only(
  729. top: ScreenUtil()
  730. .setWidth(10),
  731. left: ScreenUtil()
  732. .setWidth(20),
  733. right: ScreenUtil()
  734. .setWidth(20),
  735. bottom: ScreenUtil()
  736. .setWidth(10)),
  737. decoration: BoxDecoration(
  738. border: Border(
  739. bottom: BorderSide(
  740. width: 0.5,
  741. color: Colours.line),
  742. ),
  743. ),
  744. child: Column(
  745. crossAxisAlignment:
  746. CrossAxisAlignment
  747. .start,
  748. children: <Widget>[
  749. Row(
  750. mainAxisAlignment:
  751. MainAxisAlignment
  752. .spaceBetween,
  753. children: <Widget>[
  754. Row(
  755. children: <
  756. Widget>[
  757. Text(
  758. provider.list[index].mobile !=
  759. null
  760. ? (provider.list[index].mobile).replaceRange(
  761. 3,
  762. 7,
  763. "****")
  764. : "",
  765. style: TextStyle(
  766. color: Color(
  767. 0xff666666),
  768. fontSize:
  769. ScreenUtil().setSp(16)),
  770. textAlign:
  771. TextAlign
  772. .start,
  773. ),
  774. Container(
  775. width: 6,
  776. child:
  777. null,
  778. ),
  779. // provider.list[index].comment!=""?
  780. // Text(
  781. // "采纳",
  782. // style: TextStyle(
  783. // color:Colors.red,
  784. // fontSize:ScreenUtil().setSp(14)
  785. // ),
  786. // textAlign:TextAlign.start,
  787. // )
  788. // :
  789. // Text(""),
  790. ]),
  791. Text(
  792. provider.list[index].createTime !=
  793. null
  794. ? DateUtils.instance.getFormartData(
  795. timeSamp: provider
  796. .list[
  797. index]
  798. .createTime,
  799. format:
  800. "yyyy-MM-dd")
  801. : '',
  802. style: TextStyle(
  803. color: Color(
  804. 0xff999999),
  805. fontSize: ScreenUtil()
  806. .setSp(
  807. 14)),
  808. textAlign:
  809. TextAlign
  810. .start,
  811. ),
  812. ]),
  813. Container(
  814. child: Text(
  815. provider.list[index]
  816. .comment ??
  817. '',
  818. style: TextStyle(
  819. color: Color(
  820. 0xff333333),
  821. fontSize:
  822. ScreenUtil()
  823. .setSp(
  824. 14)),
  825. textAlign:
  826. TextAlign.start,
  827. ),
  828. ),
  829. Container(
  830. height: ScreenUtil()
  831. .setWidth(10),
  832. decoration:
  833. BoxDecoration(
  834. color: Colors.red,
  835. ),
  836. child: Transform.rotate(
  837. origin: Offset(
  838. ScreenUtil()
  839. .setWidth(
  840. 25),
  841. ScreenUtil()
  842. .setWidth(
  843. 20)),
  844. angle:
  845. math.pi / 2,
  846. child: CustomPaint(
  847. painter: ChatBoxPainter(
  848. color: Color(
  849. 0xffF8F8F8),
  850. width: ScreenUtil().setWidth(
  851. 10),
  852. height:
  853. ScreenUtil().setWidth(20))))),
  854. Container(
  855. padding: EdgeInsets.only(
  856. top: ScreenUtil()
  857. .setWidth(10),
  858. bottom:
  859. ScreenUtil()
  860. .setWidth(
  861. 10),
  862. left: ScreenUtil()
  863. .setWidth(5),
  864. right:
  865. ScreenUtil()
  866. .setWidth(
  867. 5)),
  868. color:
  869. Color(0xffF8F8F8),
  870. child: Text(
  871. "问题描述:" +
  872. (provider
  873. .list[
  874. index]
  875. .expression !=
  876. null
  877. ? provider
  878. .list[
  879. index]
  880. .expression
  881. : ""),
  882. style: TextStyle(
  883. color: Color(
  884. 0xff999999),
  885. fontSize:
  886. ScreenUtil()
  887. .setSp(
  888. 14)),
  889. textAlign:
  890. TextAlign.start,
  891. ),
  892. ),
  893. ]),
  894. ))
  895. ],
  896. ),
  897. );
  898. },
  899. );
  900. }))
  901. : Container(
  902. child: null,
  903. ),
  904. Container(
  905. height: ScreenUtil().setWidth(80),
  906. ),
  907. ],
  908. ),
  909. Positioned(
  910. bottom: 0,
  911. left: 0,
  912. child: Container(
  913. width: width,
  914. padding: EdgeInsets.only(
  915. top: ScreenUtil().setWidth(15),
  916. bottom: ScreenUtil().setWidth(15),
  917. left: ScreenUtil().setWidth(25),
  918. right: ScreenUtil().setWidth(25)),
  919. color:
  920. ThemeUtils.getDialogTextFieldColor(context),
  921. child: Container(
  922. height: ScreenUtil().setWidth(44),
  923. decoration: BoxDecoration(
  924. borderRadius: BorderRadius.circular(
  925. ScreenUtil().setWidth(22)),
  926. // gradient: const LinearGradient(colors: [
  927. // Color(0xFF00D9FF),
  928. // Color(0xFF0287FF)
  929. // ]
  930. // ),
  931. color: Colours.blue_app_main),
  932. child: FlatButton(
  933. // padding: EdgeInsets.all(15.0),
  934. child: detailObj.serviceFee != null
  935. ? Text(
  936. "线上咨询(¥${detailObj.serviceFee}元/次)")
  937. : Text("线上咨询(¥0元/次)"),
  938. textColor: Colors.white,
  939. onPressed: () {
  940. UmengCommonSdk.onEvent(
  941. 'ym_wenzhen_onClickPay',
  942. {
  943. "formName": '专家:${detailObj.name}',
  944. },
  945. );
  946. setExpertName(detailObj.name ?? "");
  947. setExpertFee(detailObj.serviceFee ?? 0.0);
  948. NavigatorUtils.push(context,
  949. "${BbsRouter.buyService}?id=${widget.id}");
  950. },
  951. ),
  952. ),
  953. ))
  954. ],
  955. )
  956. : Center(
  957. child: Text("正在加载..."),
  958. ))),
  959. );
  960. }
  961. getLevel(level) {
  962. String img;
  963. if (level == 1) {
  964. img = "L1@2x";
  965. } else if (level == 2) {
  966. img = "L2@2x";
  967. } else if (level == 3) {
  968. img = "L3@2x";
  969. } else if (level == 4) {
  970. img = "L4@2x";
  971. } else if (level == 5) {
  972. img = "L5@2x";
  973. }
  974. return img;
  975. }
  976. Widget expertDetailWisget() {
  977. double width = MediaQuery.of(context).size.width;
  978. double height = MediaQuery.of(context).size.height;
  979. List<Widget> textWidgets = [Text('擅长品牌:')];
  980. detailObj.proficiencyBrandName.split(',').forEach((element) {
  981. if (element != '') {
  982. textWidgets.add(ClipText(title: element));
  983. }
  984. // textWidgets.add(ClipText(title: element));
  985. });
  986. return Column(
  987. children: <Widget>[
  988. Container(
  989. // height: ScreenUtil().setWidth(150),
  990. padding: EdgeInsets.only(bottom: 10),
  991. // decoration: BoxDecoration(
  992. // gradient: const LinearGradient(
  993. // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  994. // ),
  995. child: Column(
  996. children: <Widget>[
  997. Container(
  998. child: Row(
  999. crossAxisAlignment: CrossAxisAlignment.start,
  1000. children: <Widget>[
  1001. Container(
  1002. margin: EdgeInsets.only(
  1003. left: ScreenUtil().setWidth(10),
  1004. right: ScreenUtil().setWidth(10),
  1005. top: ScreenUtil().setWidth(5)),
  1006. decoration: BoxDecoration(
  1007. borderRadius: BorderRadius.circular(
  1008. ScreenUtil().setWidth(25)),
  1009. ),
  1010. child: Container(
  1011. width: ScreenUtil().setWidth(50),
  1012. height: ScreenUtil().setWidth(70),
  1013. child: Stack(
  1014. children: <Widget>[
  1015. Container(
  1016. padding: EdgeInsets.only(
  1017. left: ScreenUtil().setWidth(3)),
  1018. child: ClipRRect(
  1019. borderRadius:
  1020. BorderRadius.all(Radius.circular(50)),
  1021. child: LoadNetworkImage(
  1022. // image: AssetImage(i['img']),
  1023. detailObj.avatarUrl,
  1024. width: ScreenUtil().setWidth(44),
  1025. height: ScreenUtil().setWidth(44),
  1026. // alignment: Alignment.centerLeft,
  1027. ),
  1028. ),
  1029. ),
  1030. // Positioned(
  1031. // top: ScreenUtil().setWidth(34),
  1032. // left: 0,
  1033. // child: LoadAssetImage(
  1034. // // image: AssetImage(i['img']),
  1035. // getLevel(detailObj.expertLevel),
  1036. // width: ScreenUtil().setWidth(50),
  1037. // height: ScreenUtil().setWidth(13),
  1038. // // alignment: Alignment.centerLeft,
  1039. // ),
  1040. // )
  1041. ],
  1042. ),
  1043. )),
  1044. Expanded(
  1045. child: Container(
  1046. padding: EdgeInsets.only(
  1047. right: ScreenUtil().setWidth(15)),
  1048. child: Column(
  1049. crossAxisAlignment: CrossAxisAlignment.start,
  1050. children: <Widget>[
  1051. Row(
  1052. mainAxisAlignment:
  1053. MainAxisAlignment.spaceBetween,
  1054. children: <Widget>[
  1055. Text(
  1056. detailObj.name ?? "",
  1057. style: TextStyle(
  1058. color: Color(0xff333333),
  1059. fontSize: ScreenUtil().setSp(18)),
  1060. ),
  1061. StarItemShow(
  1062. starRating:
  1063. detailObj.averageScore != null
  1064. ? double.parse(detailObj
  1065. .averageScore
  1066. .toString())
  1067. : 0.0,
  1068. ),
  1069. ],
  1070. ),
  1071. Container(
  1072. alignment: Alignment.topLeft,
  1073. child: Wrap(
  1074. spacing: 2.0,
  1075. runSpacing: 3.0,
  1076. children: textWidgets),
  1077. ),
  1078. // detailObj.proficiencyBrandName.split(',');
  1079. // Text(
  1080. // "擅长品牌:" +
  1081. // detailObj.proficiencyBrandName ??
  1082. // '',
  1083. // style: TextStyle(
  1084. // color: Color(0xff666666),
  1085. // fontSize: ScreenUtil().setSp(14)),
  1086. // // textAlign:TextAlign.start,
  1087. // ),
  1088. detailObj.platformInvitedFlag == 0
  1089. ? Container(
  1090. padding: EdgeInsets.only(
  1091. left: 5, right: 5),
  1092. margin: EdgeInsets.only(
  1093. right: 5, top: 5),
  1094. // color:Colors.red,
  1095. decoration: BoxDecoration(
  1096. borderRadius:
  1097. BorderRadius.circular(1.0),
  1098. border: Border.all(
  1099. width: 0.5,
  1100. color: Color(0xffB0E2FF),
  1101. ),
  1102. ),
  1103. child: Text(
  1104. "特邀专家",
  1105. style: TextStyle(
  1106. color: Colours.blue_app_main,
  1107. fontSize:
  1108. ScreenUtil().setSp(12)),
  1109. textAlign: TextAlign.center,
  1110. ),
  1111. )
  1112. : Container(
  1113. child: null,
  1114. ),
  1115. // Row(
  1116. // children: <Widget>[
  1117. // Expanded(
  1118. // child: Container(
  1119. // decoration: BoxDecoration(
  1120. // color: Color(0x195887FF),
  1121. // borderRadius:
  1122. // new BorderRadius.circular(
  1123. // (5.0))),
  1124. // padding: EdgeInsets.all(5),
  1125. // margin: EdgeInsets.only(
  1126. // right: 5, top: 5),
  1127. // // color:Colors.red,
  1128. // // decoration: BoxDecoration(
  1129. // // borderRadius: BorderRadius.circular(2.0),
  1130. // // border: Border.all(
  1131. // // width:0.5,
  1132. // // color:Color(0xffB0E2FF),
  1133. // // ),
  1134. // // color:Colors.white30,
  1135. // // ),
  1136. // child: Row(
  1137. // crossAxisAlignment:
  1138. // CrossAxisAlignment.start,
  1139. // children: <Widget>[
  1140. // Icon(
  1141. // const IconData(0xe64a,
  1142. // fontFamily: "Iconfont"),
  1143. // size: 17.0,
  1144. // color: Color(0x195887FF),
  1145. // ),
  1146. // SizedBox(
  1147. // width: 5,
  1148. // ),
  1149. // Expanded(
  1150. // child: Container(
  1151. // child: Text(
  1152. // // "detailObj",
  1153. // detailObj.address != null
  1154. // ? detailObj.address
  1155. // .split(",")[0]
  1156. // : "",
  1157. // style: TextStyle(
  1158. // color: Colours
  1159. // .blue_app_main,
  1160. // fontSize: ScreenUtil()
  1161. // .setSp(12)),
  1162. // textAlign: TextAlign.left,
  1163. // // overflow:TextOverflow.ellipsis,
  1164. // ),
  1165. // ))
  1166. // ],
  1167. // )),
  1168. // )
  1169. // ],
  1170. // ),
  1171. ],
  1172. )))
  1173. ]),
  1174. ),
  1175. Container(
  1176. padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
  1177. child: Row(
  1178. crossAxisAlignment: CrossAxisAlignment.center,
  1179. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1180. children: <Widget>[
  1181. Container(
  1182. child: Row(
  1183. crossAxisAlignment: CrossAxisAlignment.center,
  1184. children: <Widget>[
  1185. Text(
  1186. detailObj.workDate != null
  1187. ? detailObj.workDate.toString()
  1188. : "0",
  1189. style: TextStyle(
  1190. color: Color(0xff333333),
  1191. fontSize: ScreenUtil().setSp(19),
  1192. fontWeight: FontWeight.w500),
  1193. textAlign: TextAlign.start,
  1194. ),
  1195. Text(
  1196. " 从业年数",
  1197. style: TextStyle(
  1198. color: Color(0xff666666),
  1199. fontSize: ScreenUtil().setSp(12),
  1200. fontWeight: FontWeight.w400),
  1201. textAlign: TextAlign.start,
  1202. ),
  1203. ])),
  1204. Container(
  1205. child: Row(
  1206. crossAxisAlignment: CrossAxisAlignment.center,
  1207. children: <Widget>[
  1208. Text(
  1209. detailObj.serviceCounts != null
  1210. ? detailObj.serviceCounts.toString()
  1211. : "0",
  1212. style: TextStyle(
  1213. color: Color(0xff333333),
  1214. fontSize: ScreenUtil().setSp(19),
  1215. fontWeight: FontWeight.w500),
  1216. textAlign: TextAlign.start,
  1217. ),
  1218. Text(
  1219. " 服务次数",
  1220. style: TextStyle(
  1221. color: Color(0xff666666),
  1222. fontSize: ScreenUtil().setSp(12),
  1223. fontWeight: FontWeight.w400),
  1224. textAlign: TextAlign.start,
  1225. ),
  1226. ])),
  1227. // Container(
  1228. // child:Column(
  1229. // crossAxisAlignment: CrossAxisAlignment.center,
  1230. // children:<Widget>[
  1231. // Text(
  1232. // "99.9",
  1233. // style: TextStyle(
  1234. // color:Colors.white,
  1235. // fontSize:ScreenUtil().setSp(16)
  1236. // ),
  1237. // textAlign:TextAlign.start,
  1238. // ),
  1239. // Text(
  1240. // "好评率(%)",
  1241. // style: TextStyle(
  1242. // color:Colors.white,
  1243. // fontSize:ScreenUtil().setSp(14)
  1244. // ),
  1245. // textAlign:TextAlign.start,
  1246. // ),
  1247. // ]
  1248. // )
  1249. // ),
  1250. Container(
  1251. child: Row(
  1252. crossAxisAlignment: CrossAxisAlignment.center,
  1253. children: <Widget>[
  1254. Text(
  1255. detailObj.adoptCounts != null
  1256. ? detailObj.adoptCounts.toString()
  1257. : "0",
  1258. style: TextStyle(
  1259. color: Color(0xff333333),
  1260. fontSize: ScreenUtil().setSp(19),
  1261. fontWeight: FontWeight.w500),
  1262. textAlign: TextAlign.start,
  1263. ),
  1264. Text(
  1265. " 采纳次数",
  1266. style: TextStyle(
  1267. color: Color(0xff666666),
  1268. fontSize: ScreenUtil().setSp(12),
  1269. fontWeight: FontWeight.w400),
  1270. textAlign: TextAlign.start,
  1271. ),
  1272. ])),
  1273. ])),
  1274. ],
  1275. )),
  1276. ],
  1277. );
  1278. }
  1279. @override
  1280. void dispose() {
  1281. super.dispose();
  1282. }
  1283. void setExpertName(String expertName) async {
  1284. SharedPreferences prefs = await SharedPreferences.getInstance();
  1285. prefs.setString("expertName", expertName);
  1286. }
  1287. void setExpertFee(double expertFee) async {
  1288. SharedPreferences prefs = await SharedPreferences.getInstance();
  1289. prefs.setDouble("expertFee", expertFee);
  1290. }
  1291. Future _onRefresh() async {
  1292. _page = 1;
  1293. await presenter.getExpertCommentList(_page, int.parse(widget.id),
  1294. getLength: (length) {
  1295. setState(() {
  1296. listLength = length;
  1297. });
  1298. });
  1299. }
  1300. Future _loadMore() async {
  1301. _page++;
  1302. await presenter.getExpertCommentList(_page, int.parse(widget.id),
  1303. getLength: (length) {});
  1304. }
  1305. @override
  1306. ExpertCommentListPresenter createPresenter() {
  1307. return ExpertCommentListPresenter();
  1308. }
  1309. }
  1310. class ChatBoxPainter extends CustomPainter {
  1311. ChatBoxPainter(
  1312. {@required this.width, @required this.height, @required this.color});
  1313. final double width;
  1314. final double height;
  1315. final Color color;
  1316. @override
  1317. void paint(Canvas canvas, Size size) {
  1318. Path path = Path()
  1319. ..moveTo(0, height / 2)
  1320. ..lineTo(width, height)
  1321. ..lineTo(width, 0)
  1322. ..lineTo(0, height / 2);
  1323. Paint paint = Paint()
  1324. ..style = PaintingStyle.fill
  1325. ..color = color;
  1326. canvas.drawPath(path, paint);
  1327. }
  1328. @override
  1329. bool shouldRepaint(ChatBoxPainter oldDelegate) => false;
  1330. @override
  1331. bool shouldRebuildSemantics(ChatBoxPainter oldDelegate) => false;
  1332. }