expert_detail.dart 51 KB

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