expert_detail.dart 83 KB

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