expert_detail.dart 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365
  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. // padding:EdgeInsets.all(5),
  1145. // margin: EdgeInsets.only(right:5,top:5),
  1146. // // color:Colors.red,
  1147. // decoration: BoxDecoration(
  1148. // borderRadius: BorderRadius.circular(2.0),
  1149. // border: Border.all(
  1150. // width:0.5,
  1151. // color:Color(0xffB0E2FF),
  1152. // ),
  1153. // color:Colors.white30,
  1154. // ),
  1155. child: Text(
  1156. // "detailObj",
  1157. detailObj.address != null
  1158. ? detailObj.address
  1159. .split(",")[0]
  1160. : "",
  1161. style: TextStyle(
  1162. color: Colours
  1163. .blue_app_main,
  1164. fontSize: ScreenUtil()
  1165. .setSp(12)),
  1166. textAlign: TextAlign.left,
  1167. // overflow:TextOverflow.ellipsis,
  1168. ),
  1169. ))
  1170. ],
  1171. )),
  1172. )
  1173. ],
  1174. ),
  1175. ],
  1176. )))
  1177. ]),
  1178. ),
  1179. Container(
  1180. padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
  1181. child: Row(
  1182. crossAxisAlignment: CrossAxisAlignment.center,
  1183. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1184. children: <Widget>[
  1185. Container(
  1186. child: Row(
  1187. crossAxisAlignment: CrossAxisAlignment.center,
  1188. children: <Widget>[
  1189. Text(
  1190. detailObj.workDate != null
  1191. ? detailObj.workDate.toString()
  1192. : "0",
  1193. style: TextStyle(
  1194. color: Color(0xff333333),
  1195. fontSize: ScreenUtil().setSp(19),
  1196. fontWeight: FontWeight.w500),
  1197. textAlign: TextAlign.start,
  1198. ),
  1199. Text(
  1200. " 从业年数",
  1201. style: TextStyle(
  1202. color: Color(0xff666666),
  1203. fontSize: ScreenUtil().setSp(12),
  1204. fontWeight: FontWeight.w400),
  1205. textAlign: TextAlign.start,
  1206. ),
  1207. ])),
  1208. Container(
  1209. child: Row(
  1210. crossAxisAlignment: CrossAxisAlignment.center,
  1211. children: <Widget>[
  1212. Text(
  1213. detailObj.serviceCounts != null
  1214. ? detailObj.serviceCounts.toString()
  1215. : "0",
  1216. style: TextStyle(
  1217. color: Color(0xff333333),
  1218. fontSize: ScreenUtil().setSp(19),
  1219. fontWeight: FontWeight.w500),
  1220. textAlign: TextAlign.start,
  1221. ),
  1222. Text(
  1223. " 服务次数",
  1224. style: TextStyle(
  1225. color: Color(0xff666666),
  1226. fontSize: ScreenUtil().setSp(12),
  1227. fontWeight: FontWeight.w400),
  1228. textAlign: TextAlign.start,
  1229. ),
  1230. ])),
  1231. // Container(
  1232. // child:Column(
  1233. // crossAxisAlignment: CrossAxisAlignment.center,
  1234. // children:<Widget>[
  1235. // Text(
  1236. // "99.9",
  1237. // style: TextStyle(
  1238. // color:Colors.white,
  1239. // fontSize:ScreenUtil().setSp(16)
  1240. // ),
  1241. // textAlign:TextAlign.start,
  1242. // ),
  1243. // Text(
  1244. // "好评率(%)",
  1245. // style: TextStyle(
  1246. // color:Colors.white,
  1247. // fontSize:ScreenUtil().setSp(14)
  1248. // ),
  1249. // textAlign:TextAlign.start,
  1250. // ),
  1251. // ]
  1252. // )
  1253. // ),
  1254. Container(
  1255. child: Row(
  1256. crossAxisAlignment: CrossAxisAlignment.center,
  1257. children: <Widget>[
  1258. Text(
  1259. detailObj.adoptCounts != null
  1260. ? detailObj.adoptCounts.toString()
  1261. : "0",
  1262. style: TextStyle(
  1263. color: Color(0xff333333),
  1264. fontSize: ScreenUtil().setSp(19),
  1265. fontWeight: FontWeight.w500),
  1266. textAlign: TextAlign.start,
  1267. ),
  1268. Text(
  1269. " 采纳次数",
  1270. style: TextStyle(
  1271. color: Color(0xff666666),
  1272. fontSize: ScreenUtil().setSp(12),
  1273. fontWeight: FontWeight.w400),
  1274. textAlign: TextAlign.start,
  1275. ),
  1276. ])),
  1277. ])),
  1278. ],
  1279. )),
  1280. ],
  1281. );
  1282. }
  1283. @override
  1284. void dispose() {
  1285. super.dispose();
  1286. }
  1287. void setExpertName(String expertName) async {
  1288. SharedPreferences prefs = await SharedPreferences.getInstance();
  1289. prefs.setString("expertName", expertName);
  1290. }
  1291. void setExpertFee(double expertFee) async {
  1292. SharedPreferences prefs = await SharedPreferences.getInstance();
  1293. prefs.setDouble("expertFee", expertFee);
  1294. }
  1295. Future _onRefresh() async {
  1296. _page = 1;
  1297. await presenter.getExpertCommentList(_page, int.parse(widget.id),
  1298. getLength: (length) {
  1299. setState(() {
  1300. listLength = length;
  1301. });
  1302. });
  1303. }
  1304. Future _loadMore() async {
  1305. _page++;
  1306. await presenter.getExpertCommentList(_page, int.parse(widget.id),
  1307. getLength: (length) {});
  1308. }
  1309. @override
  1310. ExpertCommentListPresenter createPresenter() {
  1311. return ExpertCommentListPresenter();
  1312. }
  1313. }
  1314. class ChatBoxPainter extends CustomPainter {
  1315. ChatBoxPainter(
  1316. {@required this.width, @required this.height, @required this.color});
  1317. final double width;
  1318. final double height;
  1319. final Color color;
  1320. @override
  1321. void paint(Canvas canvas, Size size) {
  1322. Path path = Path()
  1323. ..moveTo(0, height / 2)
  1324. ..lineTo(width, height)
  1325. ..lineTo(width, 0)
  1326. ..lineTo(0, height / 2);
  1327. Paint paint = Paint()
  1328. ..style = PaintingStyle.fill
  1329. ..color = color;
  1330. canvas.drawPath(path, paint);
  1331. }
  1332. @override
  1333. bool shouldRepaint(ChatBoxPainter oldDelegate) => false;
  1334. @override
  1335. bool shouldRebuildSemantics(ChatBoxPainter oldDelegate) => false;
  1336. }