bbs_content.dart 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057
  1. import 'dart:io';
  2. import 'package:flutter/foundation.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/rendering.dart';
  5. import 'package:flutter_cupertino_date_picker/flutter_cupertino_date_picker.dart';
  6. import 'package:flutter_picker/flutter_picker.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:flutter_spinkit/flutter_spinkit.dart';
  9. import 'package:flutter_swiper/flutter_swiper.dart';
  10. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  11. import 'package:liftmanager/internal/bbs/model/banner_model.dart' as banner;
  12. import 'package:liftmanager/internal/bbs/model/mix_model.dart';
  13. import 'package:liftmanager/internal/bbs/model/search_model.dart';
  14. import 'package:liftmanager/internal/means/page/means_pdf.dart';
  15. import 'package:liftmanager/internal/news/model/news_comm_entity.dart';
  16. import 'package:liftmanager/internal/news/news_router.dart';
  17. import 'package:liftmanager/internal/work/work_router.dart';
  18. import 'package:liftmanager/res/iconfont.dart';
  19. import 'package:liftmanager/res/resources.dart';
  20. import 'package:liftmanager/routers/fluro_navigator.dart';
  21. import 'package:liftmanager/utils/image_utils.dart';
  22. import 'package:liftmanager/utils/theme_utils.dart';
  23. import 'package:liftmanager/utils/time_format.dart';
  24. import 'package:liftmanager/utils/toast.dart';
  25. import 'package:liftmanager/utils/utils.dart';
  26. import 'package:liftmanager/widgets/img_viewer.dart';
  27. import 'package:liftmanager/widgets/load_image.dart';
  28. import 'package:path_provider/path_provider.dart';
  29. class SwipeWidget extends StatelessWidget {
  30. const SwipeWidget({Key key, this.banners}) : super(key: key);
  31. final List<banner.Records> banners;
  32. // List<String> bannersLL = <String> [
  33. // 'tab_first/banner',
  34. // 'tab_first/banner',
  35. // 'tab_first/banner',
  36. // ];
  37. Future<File> createFileOfPdfUrl(url) async {
  38. final filename = url.substring(url.lastIndexOf("/") + 1);
  39. var request = await HttpClient().getUrl(Uri.parse(url));
  40. var response = await request.close();
  41. var bytes = await consolidateHttpClientResponseBytes(response);
  42. String dir = (await getApplicationDocumentsDirectory()).path;
  43. File file = new File('$dir/$filename');
  44. await file.writeAsBytes(bytes);
  45. return file;
  46. }
  47. @override
  48. Widget build(BuildContext context) {
  49. double width = MediaQuery.of(context).size.width;
  50. double height = 180;
  51. return Container(
  52. width: width,
  53. height: height,
  54. child: ClipRRect(
  55. borderRadius: BorderRadius.all(Radius.circular(10)),
  56. child: Swiper(
  57. index: 0,
  58. itemBuilder: (BuildContext swipercontext, index) {
  59. return GestureDetector(
  60. onTap: () {
  61. if (banners[index].jumpType == 2) {
  62. print('${banners[index].jumpType}');
  63. NavigatorUtils.push(
  64. context,
  65. "${WorkRouter.webview}?title=" +
  66. Uri.encodeComponent("详情") +
  67. "&url=" +
  68. Uri.encodeComponent(banners[index].url));
  69. } else if (banners[index].jumpType == 1) {
  70. print('777');
  71. // showLoading(context);
  72. createFileOfPdfUrl(banners[index].url).then((f) {
  73. // setState(() {
  74. // pathPDF = f.path;
  75. // pathPDF = f.path;
  76. // Navigator.push(
  77. // context,
  78. // MaterialPageRoute(
  79. // builder: (context) => PDFScreen(
  80. // f.path,
  81. // banners[index].url,
  82. // banners[index].id.toString()),
  83. // ));
  84. Navigator.push(
  85. context,
  86. MaterialPageRoute(
  87. builder: (context) =>
  88. PDFScreen(f.path, "null", "null")));
  89. // dismissLoading(context);
  90. });
  91. } else if (banners[index].jumpType == 3) {
  92. Navigator.push(
  93. context,
  94. MaterialPageRoute(
  95. builder: (context) => Imgviewer(
  96. url: banners[index].url,
  97. )));
  98. }
  99. },
  100. child: Container(
  101. width: width,
  102. height: height,
  103. key: UniqueKey(),
  104. // margin:EdgeInsets.only(left:15,right:15),
  105. child: LoadNetworkImage(
  106. banners[index].image,
  107. width: width,
  108. height: height,
  109. fit: BoxFit.fill,
  110. ),
  111. ),
  112. );
  113. },
  114. pagination: SwiperPagination(
  115. builder: RectSwiperPaginationBuilder(
  116. color: Colors.grey,
  117. activeColor: Colors.white,
  118. size: Size(12, 10),
  119. activeSize: Size(16, 10),
  120. ),
  121. ),
  122. itemCount: banners.length,
  123. scrollDirection: Axis.horizontal,
  124. autoplay: true,
  125. onTap: (index) {
  126. // print(index);
  127. },
  128. ),
  129. ));
  130. }
  131. }
  132. class Diagnosis extends StatelessWidget {
  133. Diagnosis({Key key, this.fun}) : super(key: key);
  134. List<dynamic> diagnosisObj = [
  135. {
  136. "title": "快速问诊",
  137. "img": "tab_first/Diagnosis_first",
  138. "desc": "搜电梯品牌 找专家咨询",
  139. },
  140. {
  141. "title": "出诊",
  142. "img": "tab_first/Diagnosis_second",
  143. "desc": "在线预约 上门服务",
  144. },
  145. ];
  146. Function fun;
  147. List<Widget> listWidget(context) => diagnosisObj.asMap().keys.map((i) {
  148. return GestureDetector(
  149. child: Container(
  150. color: ThemeUtils.getTabsBg(context),
  151. padding: EdgeInsets.only(
  152. left: 15,
  153. right: 15,
  154. // top: ScreenUtil().setHeight(15),
  155. bottom: 20),
  156. child: Row(
  157. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  158. children: <Widget>[
  159. Row(
  160. children: <Widget>[
  161. LoadAssetImage(
  162. // image: AssetImage(i['img']),
  163. diagnosisObj[i]["img"],
  164. width: 40,
  165. height: 40,
  166. // alignment: Alignment.centerLeft,
  167. ),
  168. SizedBox(width: 10),
  169. Container(
  170. child: Column(
  171. crossAxisAlignment: CrossAxisAlignment.start,
  172. children: <Widget>[
  173. Text(
  174. diagnosisObj[i]["title"],
  175. style: TextStyle(fontSize: 22),
  176. textAlign: TextAlign.start,
  177. ),
  178. Text(
  179. diagnosisObj[i]["desc"],
  180. style: TextStyle(
  181. color: Color(0xff999999), fontSize: 14),
  182. textAlign: TextAlign.start,
  183. ),
  184. ],
  185. ),
  186. ),
  187. ],
  188. ),
  189. Container(
  190. child: Icon(
  191. Icons.keyboard_arrow_right,
  192. color: Color(0xffcccccc),
  193. ),
  194. )
  195. ]),
  196. ),
  197. onTap: () {
  198. if (i == 0 &&
  199. !Utils.getAuthByRouter(context, 'quick_consultation')) {
  200. return false;
  201. }
  202. if (i == 1 && !Utils.getAuthByRouter(context, 'quich_visit')) {
  203. return false;
  204. }
  205. String index = i.toString();
  206. NavigatorUtils.push(context, "${BbsRouter.brandPage}?index=$index");
  207. },
  208. );
  209. }).toList();
  210. @override
  211. Widget build(BuildContext context) {
  212. return Card(
  213. margin: EdgeInsets.all(ScreenUtil().setWidth(10)),
  214. //设置圆角度,也可以不设置有默认值
  215. shape: RoundedRectangleBorder(
  216. //形状
  217. //修改圆角
  218. borderRadius: BorderRadius.all(Radius.circular(10)),
  219. ),
  220. //阴影颜色
  221. // color: Colors.orangeAccent,
  222. //阴影高度
  223. elevation: 1.0,
  224. child: ClipRRect(
  225. borderRadius: BorderRadius.all(Radius.circular(10)),
  226. child: Container(
  227. padding: EdgeInsets.only(top: 20),
  228. child: Column(children: listWidget(context)),
  229. ),
  230. ),
  231. );
  232. }
  233. }
  234. class QuestionCell extends StatelessWidget {
  235. QuestionCell({this.item});
  236. final dynamic item;
  237. @override
  238. Widget build(BuildContext context) {
  239. if (item is Records || item is InfoList) {
  240. } else {
  241. return Container();
  242. // data = NewsItems();
  243. }
  244. return GestureDetector(
  245. child: Container(
  246. padding: EdgeInsets.only(
  247. top: 10,
  248. bottom: 10,
  249. ),
  250. child: Column(
  251. crossAxisAlignment: CrossAxisAlignment.start,
  252. children: <Widget>[
  253. Text(
  254. "${item.title ?? ''}",
  255. textAlign: TextAlign.left,
  256. style: TextStyle(
  257. fontSize: 14,
  258. color: Color(0xff333333),
  259. ),
  260. maxLines: 1,
  261. overflow: TextOverflow.ellipsis,
  262. ),
  263. SizedBox(
  264. height: 5,
  265. ),
  266. Row(
  267. children: <Widget>[
  268. ClipRRect(
  269. borderRadius: BorderRadius.circular(15),
  270. child: Container(
  271. child: LoadNetworkImage(
  272. item?.avatarUrl,
  273. // fit: BoxFit.fitWidth,
  274. width: 31,
  275. height: 31,
  276. ),
  277. )),
  278. SizedBox(
  279. width: 5,
  280. ),
  281. Text(
  282. item.userName ?? '',
  283. style: TextStyle(
  284. fontSize: 14,
  285. fontWeight: FontWeight.w500,
  286. color: Color(0xff565A64),
  287. ),
  288. ),
  289. SizedBox(width: 5),
  290. _clipText(
  291. title: 'LV1',
  292. bgcolor: Color(0xffFD5E62),
  293. textcolor: Colors.white),
  294. ],
  295. ),
  296. SizedBox(
  297. height: 10,
  298. ),
  299. Text(
  300. item.expression ?? '',
  301. textAlign: TextAlign.left,
  302. style: TextStyle(
  303. color: Color(0xff999999),
  304. fontSize: 12,
  305. ),
  306. maxLines: 2,
  307. overflow: TextOverflow.ellipsis,
  308. ),
  309. Container(
  310. padding: EdgeInsets.only(
  311. top: ScreenUtil().setHeight(5),
  312. bottom: ScreenUtil().setHeight(5)),
  313. child: Row(
  314. mainAxisAlignment: MainAxisAlignment.start,
  315. children: item.imgs != null && item.imgs.isNotEmpty
  316. ? List<Widget>.from(
  317. item.imgs.split(",").asMap().keys.map((index) {
  318. // print(item);
  319. return index < 3
  320. ? Container(
  321. padding:
  322. index < item.imgs.split(",").length - 1
  323. ? EdgeInsets.only(right: 6)
  324. : EdgeInsets.only(right: 0),
  325. // color:Colors.red,
  326. // decoration: BoxDecoration(
  327. // borderRadius: BorderRadius.circular(20.0),
  328. // ),
  329. child: ClipRRect(
  330. borderRadius: BorderRadius.circular(10),
  331. child: LoadNetworkImage(
  332. item.imgs.split(",")[index],
  333. fit: BoxFit.fill,
  334. height: ScreenUtil().setWidth(80),
  335. width: ScreenUtil().setWidth(110),
  336. isWater: true,
  337. ),
  338. ),
  339. )
  340. : Container(child: null);
  341. }).toList())
  342. : <Widget>[]),
  343. ),
  344. Row(
  345. children: [
  346. _clipText(
  347. title: "${item.brandName ?? ''}",
  348. bgcolor: Color.fromRGBO(67, 141, 250, .16),
  349. textcolor: Color(0xFF5887FF)),
  350. Expanded(child: Container()),
  351. Text(
  352. "${item.browseNum ?? '0'}浏览·${item.likeNum ?? '0'}赞",
  353. textAlign: TextAlign.right,
  354. style: TextStyle(
  355. color: Color(0xFFCCCCCC),
  356. fontSize: 11,
  357. ),
  358. )
  359. ],
  360. ),
  361. SizedBox(
  362. height: 10,
  363. ),
  364. ]),
  365. ),
  366. onTap: () {
  367. NavigatorUtils.push(
  368. context, "${BbsRouter.questionDetail}?id=${item.id.toString()}");
  369. },
  370. );
  371. }
  372. _clipText({title, bgcolor, textcolor}) {
  373. return ClipRRect(
  374. borderRadius: BorderRadius.all(Radius.circular(3)),
  375. child: Container(
  376. color: bgcolor,
  377. padding: EdgeInsets.all(3),
  378. alignment: Alignment.center,
  379. child: Text(
  380. title,
  381. style: TextStyle(fontSize: 11, color: textcolor),
  382. ),
  383. ),
  384. );
  385. }
  386. }
  387. class HotQuestion extends StatelessWidget {
  388. const HotQuestion({Key key, this.initList}) : super(key: key);
  389. final List<dynamic> initList;
  390. @override
  391. Widget build(BuildContext context) {
  392. List<Widget> widgetList = [];
  393. for (int i = 0; i < initList.length; i++) {
  394. widgetList.add(Column(children: [
  395. QuestionCell(item: initList[i]),
  396. if (i != initList.length - 1) Divider(),
  397. ]));
  398. }
  399. return Container(
  400. color: Colors.white,
  401. padding: EdgeInsets.symmetric(horizontal: 10),
  402. child: Column(children: widgetList),
  403. );
  404. }
  405. }
  406. class HotClass {
  407. const HotClass({Key key, this.videoList});
  408. final List<dynamic> videoList;
  409. List<Widget> listWidget(context) => videoList.asMap().keys.map((i) {
  410. return GestureDetector(
  411. child: Container(
  412. child: Column(
  413. crossAxisAlignment: CrossAxisAlignment.start,
  414. children: <Widget>[
  415. Expanded(
  416. flex: 1,
  417. child: AspectRatio(
  418. aspectRatio: 177 / 113,
  419. child: Stack(
  420. alignment: Alignment.center,
  421. children: <Widget>[
  422. Container(
  423. // color: Colors.red,
  424. child: SizedBox.expand(
  425. child: ClipRRect(
  426. borderRadius: BorderRadius.circular(10),
  427. child: LoadNetworkImage(
  428. videoList[i].cover,
  429. isWater: true,
  430. ),
  431. )),
  432. ),
  433. Image.asset(ImageUtils.getImgPath('play_button')),
  434. ],
  435. ))),
  436. Container(
  437. padding: EdgeInsets.only(top: 5, left: 5),
  438. child: Column(
  439. crossAxisAlignment: CrossAxisAlignment.start,
  440. children: [
  441. Text(
  442. videoList[i].title ?? "",
  443. textAlign: TextAlign.left,
  444. style:
  445. TextStyle(fontSize: 14, color: Color(0xff565A64)),
  446. maxLines: 1,
  447. overflow: TextOverflow.ellipsis,
  448. ),
  449. Text(
  450. videoList[i].descr ?? "",
  451. textAlign: TextAlign.left,
  452. overflow: TextOverflow.ellipsis,
  453. maxLines: 1,
  454. style: TextStyle(
  455. fontSize: 12,
  456. color: Color(0xff9a9a9a),
  457. ),
  458. ),
  459. SizedBox(height: 10),
  460. Row(
  461. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  462. children: [
  463. Container(
  464. padding: EdgeInsets.all(3),
  465. decoration: BoxDecoration(
  466. color: Color(0x33448EFA),
  467. borderRadius: BorderRadius.circular(4),
  468. ),
  469. child: Text(
  470. videoList[i].brandName != null
  471. ? videoList[i].brandName.toString()
  472. : "",
  473. textAlign: TextAlign.left,
  474. overflow: TextOverflow.ellipsis,
  475. style: TextStyle(
  476. fontSize: 11,
  477. color: Color(0xff5888FF),
  478. ),
  479. )),
  480. Text(
  481. "${videoList[i].browseNum ?? '0'}浏览·${videoList[i].likeNum ?? '0'}赞",
  482. textAlign: TextAlign.left,
  483. maxLines: 1,
  484. overflow: TextOverflow.ellipsis,
  485. style: TextStyle(
  486. fontSize: 11,
  487. color: Color(0xffCCCCCC),
  488. ),
  489. ),
  490. ],
  491. ),
  492. ],
  493. ))
  494. ])),
  495. onTap: () {
  496. print(i);
  497. NavigatorUtils.push(context,
  498. "${BbsRouter.videoDetail}?id=${videoList[i].id.toString()}");
  499. },
  500. );
  501. }).toList();
  502. List<Widget> listVideo(context) => videoList.map((e) {
  503. return VideoCell(e);
  504. }).toList();
  505. }
  506. class VideoCell extends StatelessWidget {
  507. dynamic data;
  508. VideoCell(this.data);
  509. @override
  510. Widget build(Object context) {
  511. if (data is Records || data is InfoList) {
  512. } else {
  513. return Container();
  514. // data = NewsItems();
  515. }
  516. return GestureDetector(
  517. child: Container(
  518. height: 116,
  519. padding: EdgeInsets.symmetric(vertical: 10),
  520. decoration: BoxDecoration(
  521. border: Border(
  522. bottom: BorderSide(width: 0.5, color: Colours.line),
  523. ),
  524. ),
  525. child: LayoutBuilder(
  526. builder: (context, constraints) => Row(
  527. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  528. children: <Widget>[
  529. Container(
  530. // padding: EdgeInsets.only(top: 5, left: 5),
  531. width: constraints.maxWidth - 167,
  532. child: Column(
  533. crossAxisAlignment: CrossAxisAlignment.start,
  534. children: [
  535. Text(
  536. data.title ?? "",
  537. textAlign: TextAlign.left,
  538. style: TextStyle(
  539. fontSize: 14, color: Color(0xff565A64)),
  540. maxLines: 1,
  541. overflow: TextOverflow.ellipsis,
  542. ),
  543. Expanded(
  544. child: Text(
  545. data.descr ?? "",
  546. textAlign: TextAlign.left,
  547. overflow: TextOverflow.ellipsis,
  548. maxLines: 1,
  549. style: TextStyle(
  550. fontSize: 12,
  551. color: Color(0xff9a9a9a),
  552. ),
  553. )),
  554. Row(
  555. mainAxisAlignment:
  556. MainAxisAlignment.spaceBetween,
  557. children: [
  558. Container(
  559. padding: EdgeInsets.all(3),
  560. decoration: BoxDecoration(
  561. color: Color(0x33448EFA),
  562. ),
  563. child: Text(
  564. data.brandName != null
  565. ? data.brandName.toString()
  566. : "",
  567. textAlign: TextAlign.left,
  568. overflow: TextOverflow.ellipsis,
  569. style: TextStyle(
  570. fontSize: 11,
  571. color: Color(0xff5888FF),
  572. ),
  573. )),
  574. Text(
  575. "${data.browseNum ?? '0'}浏览·${data.likeNum ?? '0'}赞",
  576. textAlign: TextAlign.left,
  577. maxLines: 1,
  578. overflow: TextOverflow.ellipsis,
  579. style: TextStyle(
  580. fontSize: 11,
  581. color: Color(0xffCCCCCC),
  582. ),
  583. ),
  584. ],
  585. ),
  586. ],
  587. )),
  588. Stack(
  589. alignment: Alignment.center,
  590. children: <Widget>[
  591. SizedBox(
  592. width: 147,
  593. height: 96,
  594. child: ClipRRect(
  595. borderRadius: BorderRadius.circular(10),
  596. child: LoadNetworkImage(
  597. data.cover,
  598. isWater: true,
  599. ),
  600. )),
  601. Image.asset(ImageUtils.getImgPath('play_button')),
  602. ],
  603. ),
  604. ]))),
  605. onTap: () {
  606. NavigatorUtils.push(
  607. context, "${BbsRouter.videoDetail}?id=${data.id.toString()}");
  608. },
  609. );
  610. }
  611. }
  612. class HotProduct extends StatelessWidget {
  613. HotProduct({Key key, this.productList}) : super(key: key);
  614. final List<dynamic> productList;
  615. List<Widget> listWidget(context) => productList.map((i) {
  616. return ProductCell(i);
  617. }).toList();
  618. @override
  619. Widget build(BuildContext context) {
  620. return Container(
  621. color: Colors.white,
  622. child: Column(children: listWidget(context)),
  623. );
  624. }
  625. }
  626. class ProductCell extends StatelessWidget {
  627. final dynamic data;
  628. ProductCell(this.data);
  629. @override
  630. Widget build(Object context) {
  631. if (data is Records || data is InfoList) {
  632. } else {
  633. return Container();
  634. // data = NewsItems();
  635. }
  636. return InkWell(
  637. child: Container(
  638. height: 110,
  639. padding: EdgeInsets.only(left: 0, right: 0, top: 10, bottom: 10),
  640. decoration: BoxDecoration(
  641. border: Border(
  642. bottom: BorderSide(color: Color(0xffF9F9F9)),
  643. ),
  644. ),
  645. child: Row(
  646. crossAxisAlignment: CrossAxisAlignment.start,
  647. children: <Widget>[
  648. ClipRRect(
  649. borderRadius: BorderRadius.circular(10),
  650. child: LoadNetworkImage(
  651. (data?.imgs ?? '').split(",")[0],
  652. width: ScreenUtil().setWidth(90),
  653. height: ScreenUtil().setWidth(90),
  654. isWater: true,
  655. ),
  656. ),
  657. SizedBox(
  658. width: 10,
  659. ),
  660. Expanded(
  661. child: Column(
  662. crossAxisAlignment: CrossAxisAlignment.start,
  663. children: <Widget>[
  664. Container(
  665. child: Row(
  666. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  667. children: [
  668. Expanded(
  669. child: Text(
  670. data.name ?? "",
  671. textAlign: TextAlign.left,
  672. // overflow: TextOverflow.ellipsis,
  673. style: TextStyle(
  674. fontSize: 14,
  675. ),
  676. maxLines: 1,
  677. overflow: TextOverflow.ellipsis,
  678. ),
  679. ),
  680. if (data.discountPrice != null)
  681. Text(
  682. '¥${data.discountPrice.toInt()}',
  683. style: TextStyle(
  684. color: Color(0xffFF5C00),
  685. fontSize: 16,
  686. ),
  687. ),
  688. if (data.discountPrice == null)
  689. Text(
  690. '¥${data.price?.toInt() ?? '暂无'}',
  691. style: TextStyle(
  692. color: Color(0xffFF5C00),
  693. fontSize: 16,
  694. ),
  695. ),
  696. if (data.discountPrice != null)
  697. Text(
  698. '¥${data.price.toInt()}',
  699. style: TextStyle(
  700. color: Color(0xff999999),
  701. fontSize: 11,
  702. decoration: TextDecoration.lineThrough,
  703. ),
  704. ),
  705. ],
  706. )),
  707. if (data.brandName != null)
  708. Container(
  709. padding: EdgeInsets.all(3),
  710. decoration: BoxDecoration(
  711. borderRadius: BorderRadius.circular(3),
  712. color: Color(0x33448EFA),
  713. ),
  714. child: Text(
  715. data.brandName,
  716. textAlign: TextAlign.left,
  717. style: TextStyle(
  718. fontSize: 11,
  719. color: Color(0xff5887FF),
  720. ),
  721. maxLines: 1,
  722. overflow: TextOverflow.ellipsis,
  723. ),
  724. ),
  725. Spacer(),
  726. Container(
  727. child: Row(
  728. children: [
  729. Icon(Iconfont.shangjia, size: 15, color: Colors.orange),
  730. SizedBox(width: 5),
  731. Text(
  732. "${data.manufacturer}",
  733. textAlign: TextAlign.left,
  734. style: TextStyle(
  735. fontSize: 11,
  736. color: Color(0xff666666),
  737. ),
  738. maxLines: 1,
  739. overflow: TextOverflow.ellipsis,
  740. ),
  741. ],
  742. ),
  743. ),
  744. ],
  745. ),
  746. ),
  747. ],
  748. ),
  749. ),
  750. onTap: () {
  751. NavigatorUtils.push(
  752. context, "${BbsRouter.productDetail}?id=${data.id.toString()}");
  753. },
  754. );
  755. }
  756. }
  757. class HotNews extends StatelessWidget {
  758. HotNews({Key key, this.newsList}) : super(key: key);
  759. final List<dynamic> newsList;
  760. @override
  761. Widget build(BuildContext context) {
  762. return Container(
  763. color: Colors.white,
  764. child: Column(
  765. children: newsList.map((i) {
  766. return NewsCell(i);
  767. }).toList()),
  768. );
  769. }
  770. }
  771. class NewsCell extends StatelessWidget {
  772. final dynamic data;
  773. NewsCell(this.data);
  774. @override
  775. Widget build(BuildContext context) {
  776. double width = MediaQuery.of(context).size.width;
  777. if (data is NewsItems || data is InfoList) {
  778. } else {
  779. return Container();
  780. // data = NewsItems();
  781. }
  782. return InkWell(
  783. onTap: () {
  784. NavigatorUtils.push(context, "${NewsRouter.newsDetail}?id=${data.id}");
  785. },
  786. child: Container(
  787. width: width,
  788. padding: EdgeInsets.symmetric(vertical: 10),
  789. decoration: BoxDecoration(
  790. border: Border(
  791. bottom: BorderSide(width: 1, color: Colours.line),
  792. ),
  793. color: ThemeUtils.getTabsBg(context)),
  794. child: Column(
  795. crossAxisAlignment: CrossAxisAlignment.start,
  796. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  797. children: <Widget>[
  798. Text(
  799. data.title,
  800. style: TextStyle(fontSize: 15),
  801. // overflow: TextOverflow.ellipsis,
  802. ),
  803. Gaps.vGap12,
  804. Text(
  805. "${data?.releaseUser ?? ''}·阅读${data?.lookNum ?? 0}次·点赞${data?.likeNum ?? 0}",
  806. style: TextStyle(fontSize: 11, color: Colours.text_gray),
  807. ),
  808. ],
  809. ),
  810. ),
  811. );
  812. }
  813. }
  814. class HotPosition extends StatelessWidget {
  815. HotPosition({Key key, this.positionList}) : super(key: key);
  816. final List<dynamic> positionList;
  817. List<Widget> listWidget(context) => positionList.map((i) {
  818. return PositionCell(i);
  819. }).toList();
  820. @override
  821. Widget build(BuildContext context) {
  822. return Container(
  823. color: Colors.white,
  824. child: Column(children: listWidget(context)),
  825. );
  826. }
  827. }
  828. class PositionCell extends StatelessWidget {
  829. final dynamic data;
  830. PositionCell(this.data);
  831. @override
  832. Widget build(BuildContext context) {
  833. double width = MediaQuery.of(context).size.width;
  834. if (data is Records || data is InfoList) {
  835. } else {
  836. return Container();
  837. // data = NewsItems();
  838. }
  839. return InkWell(
  840. child: Container(
  841. child: Column(
  842. crossAxisAlignment: CrossAxisAlignment.start,
  843. children: <Widget>[
  844. Container(
  845. width: width,
  846. padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(5)),
  847. child: Row(
  848. children: <Widget>[
  849. if (data.hotFlag == 1) ...[
  850. Container(
  851. padding: EdgeInsets.all(2),
  852. decoration: BoxDecoration(
  853. color: Color(0xffFBC247),
  854. borderRadius: BorderRadius.only(
  855. topLeft: Radius.circular(5),
  856. bottomRight: Radius.circular(5),
  857. ),
  858. ),
  859. child: Text(
  860. '热招',
  861. style: TextStyle(
  862. color: Colors.white,
  863. fontSize: 11,
  864. ),
  865. ),
  866. ),
  867. SizedBox(
  868. width: 5,
  869. ),
  870. ],
  871. Container(
  872. child: Text(
  873. data.job ?? "",
  874. style: TextStyle(
  875. fontSize: 14,
  876. color: Color(0xff565A64),
  877. fontWeight: FontWeight.w600,
  878. ),
  879. overflow: TextOverflow.ellipsis,
  880. ),
  881. ),
  882. Spacer(),
  883. Container(
  884. width: width * 0.4,
  885. child: Text(
  886. '${data.lowerSalary?.toInt()}-${data.upperSalary?.toInt()}/月',
  887. textAlign: TextAlign.right,
  888. style: TextStyle(
  889. fontSize: 14,
  890. color: Color(0xffFF5C00),
  891. ),
  892. overflow: TextOverflow.ellipsis,
  893. ),
  894. )
  895. ],
  896. ),
  897. ),
  898. Row(
  899. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  900. children: <Widget>[
  901. Text(
  902. "${data.provinceName ?? ''}${data.cityName ?? ''}",
  903. textAlign: TextAlign.right,
  904. style: TextStyle(
  905. fontSize: 13,
  906. color: Color(0xff9A9A9A),
  907. ),
  908. overflow: TextOverflow.ellipsis,
  909. ),
  910. Text(
  911. DateUtils.instance.getFormartData(
  912. timeSamp: data.createTime, format: "yyyy-MM-dd"),
  913. textAlign: TextAlign.left,
  914. style: TextStyle(
  915. fontSize: 12,
  916. color: Color(0xff9A9A9A),
  917. ),
  918. ),
  919. ],
  920. ),
  921. Text(
  922. data.company?.name ?? "",
  923. textAlign: TextAlign.left,
  924. style: TextStyle(
  925. fontSize: 14,
  926. color: Color(0xff666666),
  927. ),
  928. overflow: TextOverflow.ellipsis,
  929. ),
  930. SizedBox(
  931. height: 10,
  932. ),
  933. Row(
  934. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  935. crossAxisAlignment: CrossAxisAlignment.center,
  936. children: [
  937. Text(
  938. '${data.company?.corporator ?? ""} ${data.company?.telephone ?? ""}',
  939. textAlign: TextAlign.left,
  940. style: TextStyle(
  941. fontSize: 13,
  942. color: Color(0xff565A64),
  943. ),
  944. overflow: TextOverflow.ellipsis,
  945. ),
  946. Spacer(),
  947. Container(
  948. alignment: Alignment.center,
  949. padding: EdgeInsets.symmetric(horizontal: 15),
  950. height: 25,
  951. decoration: BoxDecoration(
  952. color: Color.fromRGBO(67, 141, 250, .16),
  953. borderRadius: BorderRadius.circular(12),
  954. ),
  955. child: Text(
  956. '申请',
  957. style: TextStyle(color: Color(0xff5888FF), fontSize: 13),
  958. ),
  959. ),
  960. ],
  961. ),
  962. SizedBox(
  963. height: 10,
  964. ),
  965. Divider(thickness: 0.5, height: 0.5),
  966. SizedBox(
  967. height: 10,
  968. ),
  969. ]),
  970. ),
  971. onTap: () {
  972. NavigatorUtils.push(
  973. context, "${BbsRouter.positionDetail}?id=${data.id}");
  974. },
  975. );
  976. }
  977. }
  978. class LabelTitle extends StatelessWidget {
  979. LabelTitle(
  980. {Key key,
  981. this.title,
  982. this.userTap,
  983. this.isMore = true,
  984. this.hasArrow = false,
  985. this.titleStyle})
  986. : super(key: key);
  987. final String title;
  988. final Function userTap;
  989. final bool isMore;
  990. final bool hasArrow;
  991. TextStyle titleStyle;
  992. @override
  993. Widget build(BuildContext context) {
  994. return GestureDetector(
  995. onTap: () {
  996. userTap();
  997. },
  998. child: Container(
  999. height: ScreenUtil().setHeight(45),
  1000. padding: EdgeInsets.symmetric(horizontal: 10),
  1001. alignment: Alignment.centerLeft,
  1002. decoration: BoxDecoration(
  1003. color: ThemeUtils.getTabsBg(context),
  1004. border: Border(
  1005. bottom: BorderSide(
  1006. width: 0.5, color: ThemeUtils.getDialogTextFieldColor(context)),
  1007. ),
  1008. ),
  1009. child: Row(
  1010. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1011. children: <Widget>[
  1012. Row(
  1013. crossAxisAlignment: CrossAxisAlignment.center,
  1014. children: <Widget>[
  1015. Container(
  1016. decoration: BoxDecoration(
  1017. border: Border(
  1018. // left: BorderSide(width: 3, color: Colours.app_main),
  1019. )),
  1020. child: Text(
  1021. title,
  1022. style: titleStyle,
  1023. ),
  1024. ),
  1025. ],
  1026. ),
  1027. Container(
  1028. child: Row(children: <Widget>[
  1029. Text(
  1030. isMore == true ? "更多" : '',
  1031. style: TextStyle(
  1032. fontSize: ScreenUtil().setSp(12), color: Color(0xFF666666)),
  1033. ),
  1034. hasArrow
  1035. ? Container(
  1036. child: Images.arrowRight,
  1037. )
  1038. : Container(child: null)
  1039. ]))
  1040. ],
  1041. ),
  1042. ),
  1043. );
  1044. }
  1045. }
  1046. class CommonSectionHeader extends StatelessWidget {
  1047. final String title;
  1048. final double fontSize;
  1049. bool isMust;
  1050. CommonSectionHeader(
  1051. {this.title = '', this.fontSize = 15, this.isMust = false});
  1052. @override
  1053. Widget build(BuildContext context) {
  1054. return Container(
  1055. child: Row(
  1056. children: [
  1057. Container(
  1058. width: 2,
  1059. height: 15,
  1060. decoration: BoxDecoration(
  1061. border: Border(left: BorderSide(width: 2, color: Colors.blue)),
  1062. ),
  1063. ),
  1064. SizedBox(
  1065. width: 10,
  1066. ),
  1067. Text(
  1068. title,
  1069. style: TextStyle(
  1070. fontSize: fontSize,
  1071. color: Color(0xff333333),
  1072. ),
  1073. ),
  1074. isMust
  1075. ? Text(
  1076. '*',
  1077. style: TextStyle(
  1078. fontSize: fontSize,
  1079. color: Colors.red,
  1080. ),
  1081. )
  1082. : Container(),
  1083. ],
  1084. ));
  1085. }
  1086. }
  1087. class SectionHeader extends StatelessWidget {
  1088. final String title;
  1089. final Function onTap;
  1090. final bool showMore;
  1091. SectionHeader({this.title, this.onTap, this.showMore = false});
  1092. @override
  1093. Widget build(BuildContext context) {
  1094. return GestureDetector(
  1095. onTap: () {
  1096. if (onTap != null) {
  1097. onTap();
  1098. }
  1099. },
  1100. child: Container(
  1101. height: 40,
  1102. child: Row(
  1103. children: [
  1104. Container(
  1105. height: 13,
  1106. width: 0,
  1107. decoration: BoxDecoration(
  1108. border: Border(
  1109. left: BorderSide(
  1110. width: 2,
  1111. color: Color(0xff568AFF),
  1112. ),
  1113. ),
  1114. ),
  1115. ),
  1116. SizedBox(
  1117. width: 10,
  1118. ),
  1119. Expanded(
  1120. child: Text(
  1121. title,
  1122. style: TextStyle(color: Color(0xff343434), fontSize: 15),
  1123. ),
  1124. ),
  1125. if (showMore)
  1126. Text(
  1127. '更多',
  1128. style: TextStyle(color: Color(0xff999999), fontSize: 12),
  1129. ),
  1130. SizedBox(
  1131. width: 10,
  1132. ),
  1133. ],
  1134. )));
  1135. }
  1136. }
  1137. class FilterHeader extends StatelessWidget {
  1138. final List<String> filterNameList;
  1139. final Function(int index) onTap;
  1140. final int activeIndex;
  1141. FilterHeader({
  1142. @required this.filterNameList,
  1143. this.onTap,
  1144. this.activeIndex = 0,
  1145. });
  1146. @override
  1147. Widget build(BuildContext context) {
  1148. var widgetList = [
  1149. GestureDetector(
  1150. child: Container(
  1151. padding: EdgeInsets.symmetric(
  1152. vertical: 13,
  1153. // horizontal: 10,
  1154. ),
  1155. decoration: BoxDecoration(
  1156. border: activeIndex == 0
  1157. ? Border(
  1158. bottom: BorderSide(
  1159. width: 2,
  1160. color: Color(0xff568AFF),
  1161. ),
  1162. )
  1163. : null,
  1164. ),
  1165. child: Text(
  1166. '全部',
  1167. style: TextStyle(
  1168. color: Color(0xff343434),
  1169. fontSize: 14,
  1170. ),
  1171. ),
  1172. ),
  1173. onTap: () {
  1174. if (onTap != null) onTap(0);
  1175. },
  1176. ),
  1177. ];
  1178. if (filterNameList != null) {
  1179. widgetList.addAll(
  1180. filterNameList.map(
  1181. (e) => GestureDetector(
  1182. child: Container(
  1183. padding: EdgeInsets.symmetric(
  1184. vertical: 13,
  1185. // horizontal: 10,
  1186. ),
  1187. decoration: BoxDecoration(
  1188. border: activeIndex == (filterNameList.indexOf(e) + 1)
  1189. ? Border(
  1190. bottom: BorderSide(
  1191. width: 2,
  1192. color: Color(0xff568AFF),
  1193. ),
  1194. )
  1195. : null,
  1196. ),
  1197. child: Text(
  1198. e,
  1199. style: TextStyle(
  1200. color: Color(0xff343434),
  1201. fontSize: 14,
  1202. ),
  1203. ),
  1204. ),
  1205. onTap: () {
  1206. var index = filterNameList.indexOf(e) + 1;
  1207. if (onTap != null) onTap(index);
  1208. },
  1209. ),
  1210. ),
  1211. );
  1212. }
  1213. return Container(
  1214. height: 45,
  1215. child: Row(
  1216. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1217. children: widgetList,
  1218. ),
  1219. );
  1220. }
  1221. }
  1222. class CustomFilterHeader extends StatelessWidget {
  1223. final List<String> filterNameList;
  1224. final Function(int index) onTap;
  1225. final int activeIndex;
  1226. CustomFilterHeader({
  1227. @required this.filterNameList,
  1228. this.onTap,
  1229. this.activeIndex,
  1230. });
  1231. @override
  1232. Widget build(BuildContext context) {
  1233. var widgetList = [
  1234. LayoutId(
  1235. id: 0,
  1236. child: GestureDetector(
  1237. child: Container(
  1238. padding: EdgeInsets.symmetric(
  1239. vertical: 13,
  1240. // horizontal: 10,
  1241. ),
  1242. decoration: BoxDecoration(
  1243. border: activeIndex == 0
  1244. ? Border(
  1245. bottom: BorderSide(
  1246. width: 2,
  1247. color: Color(0xff568AFF),
  1248. ),
  1249. )
  1250. : null,
  1251. ),
  1252. child: Text(
  1253. '全部',
  1254. style: TextStyle(
  1255. color: Color(0xff343434),
  1256. fontSize: 14,
  1257. ),
  1258. ),
  1259. ),
  1260. onTap: () {
  1261. if (onTap != null) onTap(0);
  1262. },
  1263. ),
  1264. ),
  1265. ];
  1266. if (filterNameList != null) {
  1267. int loopCount = 0;
  1268. for (var name in filterNameList) {
  1269. var layoutId = ++loopCount;
  1270. widgetList.add(
  1271. LayoutId(
  1272. id: layoutId,
  1273. child: GestureDetector(
  1274. child: Container(
  1275. padding: EdgeInsets.symmetric(
  1276. vertical: 13,
  1277. // horizontal: 10,
  1278. ),
  1279. decoration: BoxDecoration(
  1280. border: activeIndex == layoutId
  1281. ? Border(
  1282. bottom: BorderSide(
  1283. width: 2,
  1284. color: Color(0xff568AFF),
  1285. ),
  1286. )
  1287. : null,
  1288. ),
  1289. child: Text(
  1290. name,
  1291. style: TextStyle(
  1292. color: Color(0xff343434),
  1293. fontSize: 14,
  1294. ),
  1295. ),
  1296. ),
  1297. onTap: () {
  1298. if (onTap != null) onTap(layoutId);
  1299. },
  1300. ),
  1301. ),
  1302. );
  1303. }
  1304. }
  1305. return Container(
  1306. height: 45,
  1307. child: CustomMultiChildLayout(
  1308. children: widgetList,
  1309. delegate: CustomFilterHeaderLayoutDelegate(
  1310. widgetList.map<int>((e) => e.id).toList(),
  1311. ),
  1312. ),
  1313. );
  1314. }
  1315. }
  1316. class CustomFilterHeaderLayoutDelegate extends MultiChildLayoutDelegate {
  1317. List<int> childIds;
  1318. CustomFilterHeaderLayoutDelegate(this.childIds);
  1319. @override
  1320. void performLayout(Size size) {
  1321. Size leaderSize = Size.zero;
  1322. if (hasChild(0)) {
  1323. leaderSize = layoutChild(0, BoxConstraints.loose(size));
  1324. positionChild(0, Offset.zero);
  1325. }
  1326. var subIds = childIds.sublist(1);
  1327. const spacing = 20;
  1328. const threshold = 0;
  1329. var offset = Offset.zero;
  1330. for (var id in subIds) {
  1331. if (hasChild(id)) {
  1332. offset = Offset(offset.dx + leaderSize.width + spacing, 0);
  1333. leaderSize = layoutChild(
  1334. id,
  1335. BoxConstraints.loose(size),
  1336. );
  1337. if (size.width - offset.dx - leaderSize.width > threshold) {
  1338. positionChild(id, offset);
  1339. } else {
  1340. positionChild(id, Offset.infinite);
  1341. }
  1342. }
  1343. }
  1344. }
  1345. @override
  1346. bool shouldRelayout(covariant MultiChildLayoutDelegate oldDelegate) {
  1347. return false;
  1348. }
  1349. }
  1350. class ChioseThis extends StatelessWidget {
  1351. ChioseThis(
  1352. {Key key,
  1353. this.list,
  1354. this.value,
  1355. this.label,
  1356. this.isMust: false,
  1357. this.fun,
  1358. this.labelText = '请选择'})
  1359. : super(key: key);
  1360. List<dynamic> list;
  1361. String value;
  1362. String label;
  1363. bool isMust;
  1364. Function fun;
  1365. String labelText;
  1366. @override
  1367. Widget build(BuildContext context) {
  1368. double width = MediaQuery.of(context).size.width;
  1369. return InkWell(
  1370. onTap: () {
  1371. showModalBottomSheet(
  1372. context: context,
  1373. builder: (context) {
  1374. return Container(
  1375. height: 80,
  1376. child: Column(
  1377. crossAxisAlignment: CrossAxisAlignment.start,
  1378. children: list.asMap().keys.map((index) {
  1379. return InkWell(
  1380. onTap: () {
  1381. fun(index);
  1382. },
  1383. child: Container(
  1384. width: width,
  1385. padding: EdgeInsets.only(
  1386. bottom: ScreenUtil().setWidth(10),
  1387. top: ScreenUtil().setWidth(5)),
  1388. decoration: BoxDecoration(
  1389. border: Border(
  1390. bottom: BorderSide(width: 0.5, color: Colours.line),
  1391. ),
  1392. ),
  1393. child: Text(
  1394. list[index],
  1395. style: TextStyle(
  1396. color: Color(0xff333333),
  1397. fontSize: ScreenUtil().setSp(16)),
  1398. textAlign: TextAlign.center,
  1399. ),
  1400. ),
  1401. );
  1402. }).toList(),
  1403. ),
  1404. );
  1405. });
  1406. },
  1407. child: Container(
  1408. padding: EdgeInsets.only(
  1409. top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15)),
  1410. margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)),
  1411. decoration: BoxDecoration(
  1412. border: Border(
  1413. bottom: BorderSide(width: 0.5, color: Colours.line),
  1414. ),
  1415. ),
  1416. child: Row(
  1417. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1418. children: <Widget>[
  1419. Text(
  1420. label,
  1421. style: TextStyle(
  1422. color: Color(0xff222222),
  1423. // fontSize: ScreenUtil().setSp(14)
  1424. ),
  1425. textAlign: TextAlign.start,
  1426. ),
  1427. Offstage(
  1428. offstage: !this.isMust,
  1429. child: Text(
  1430. " *",
  1431. style: TextStyle(color: Colors.red),
  1432. ),
  1433. ),
  1434. Expanded(flex: 1, child: Container()),
  1435. value.isEmpty
  1436. ? Container(
  1437. child: Row(children: <Widget>[
  1438. Text(
  1439. labelText,
  1440. style: TextStyle(
  1441. color: Color(0xffcccccc),
  1442. // fontSize: ScreenUtil().setSp(14)
  1443. ),
  1444. textAlign: TextAlign.start,
  1445. ),
  1446. Container(
  1447. padding: EdgeInsets.only(top: 3),
  1448. child: Icon(
  1449. Icons.keyboard_arrow_right,
  1450. size: 20.0,
  1451. color: Color(0xffcccccc),
  1452. ),
  1453. ),
  1454. SizedBox(width: 10)
  1455. ]),
  1456. )
  1457. : Container(
  1458. padding:
  1459. EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  1460. child: Row(children: <Widget>[
  1461. Text(
  1462. value,
  1463. style: TextStyle(
  1464. color: Color(0xff222222),
  1465. fontSize: ScreenUtil().setSp(14)),
  1466. textAlign: TextAlign.start,
  1467. ),
  1468. ]),
  1469. ),
  1470. ]),
  1471. ),
  1472. );
  1473. }
  1474. }
  1475. class DatePickerInputField extends StatelessWidget {
  1476. DatePickerInputField(
  1477. {Key key,
  1478. this.value = '',
  1479. this.label,
  1480. this.isMust: false,
  1481. this.onSelectionConfirmed,
  1482. this.labelText = '请选择'})
  1483. : super(key: key);
  1484. final String value;
  1485. final String label;
  1486. final bool isMust;
  1487. final Function(String birthday) onSelectionConfirmed;
  1488. final String labelText;
  1489. @override
  1490. Widget build(BuildContext context) {
  1491. return InkWell(
  1492. onTap: () {
  1493. DatePicker.showDatePicker(context,
  1494. // pickerMode: DateTimePickerMode.date,
  1495. dateFormat: 'yyyy-MM',
  1496. locale: DateTimePickerLocale.zh_cn,
  1497. // initialDateTime: DateTime.now(),
  1498. maxDateTime: DateTime.now(),
  1499. // onChange: (datetime, _){
  1500. //
  1501. // },
  1502. onConfirm: (datetime, _) {
  1503. this.onSelectionConfirmed(DateUtils()
  1504. .getFormattedDateTimeStr(datetime: datetime, format: 'yyyy-MM'));
  1505. });
  1506. },
  1507. child: Container(
  1508. padding: EdgeInsets.only(
  1509. top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15)),
  1510. margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)),
  1511. decoration: BoxDecoration(
  1512. border: Border(
  1513. bottom: BorderSide(width: 0.5, color: Colours.line),
  1514. ),
  1515. ),
  1516. child: Row(
  1517. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1518. children: <Widget>[
  1519. Text(
  1520. label,
  1521. style: TextStyle(
  1522. color: Color(0xff222222),
  1523. // fontSize: ScreenUtil().setSp(14)
  1524. ),
  1525. textAlign: TextAlign.start,
  1526. ),
  1527. Offstage(
  1528. offstage: !this.isMust,
  1529. child: Text(
  1530. "*",
  1531. style: TextStyle(color: Colors.red),
  1532. ),
  1533. ),
  1534. Expanded(flex: 1, child: Container()),
  1535. value.isEmpty
  1536. ? Container(
  1537. child: Row(children: <Widget>[
  1538. Text(
  1539. labelText,
  1540. style: TextStyle(
  1541. color: Color(0xffcccccc),
  1542. // fontSize: ScreenUtil().setSp(14)
  1543. ),
  1544. textAlign: TextAlign.start,
  1545. ),
  1546. Container(
  1547. padding: EdgeInsets.only(top: 3),
  1548. child: Icon(
  1549. Icons.keyboard_arrow_right,
  1550. size: 20.0,
  1551. color: Color(0xffcccccc),
  1552. ),
  1553. ),
  1554. SizedBox(width: 10)
  1555. ]),
  1556. )
  1557. : Container(
  1558. padding:
  1559. EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  1560. child: Row(children: <Widget>[
  1561. Text(
  1562. value,
  1563. style: TextStyle(
  1564. color: Color(0xff222222),
  1565. fontSize: ScreenUtil().setSp(14)),
  1566. textAlign: TextAlign.start,
  1567. ),
  1568. ]),
  1569. ),
  1570. ]),
  1571. ),
  1572. );
  1573. }
  1574. }
  1575. class IsvideoList extends StatelessWidget {
  1576. IsvideoList({Key key, this.list, this.fun}) : super(key: key);
  1577. List<dynamic> list;
  1578. Function fun;
  1579. List<Widget> listWidget(context) => list.asMap().keys.map((i) {
  1580. double width = MediaQuery.of(context).size.width;
  1581. return GestureDetector(
  1582. onTap: () {
  1583. fun();
  1584. },
  1585. child: Container(
  1586. padding: EdgeInsets.only(left: 10, right: 10, bottom: 5),
  1587. width: width / 2,
  1588. child: Column(
  1589. crossAxisAlignment: CrossAxisAlignment.start,
  1590. children: <Widget>[
  1591. Container(
  1592. child: Stack(
  1593. children: <Widget>[
  1594. ClipRRect(
  1595. borderRadius: BorderRadius.circular(5),
  1596. child: Container(
  1597. child: LoadAssetImage(
  1598. list[i]["image"],
  1599. width: 190,
  1600. height: 140,
  1601. ),
  1602. ),
  1603. ),
  1604. Positioned(
  1605. left: 77,
  1606. top: 57,
  1607. child: Icon(
  1608. IconData(0xe607, fontFamily: "Iconfont"),
  1609. size: 26.0,
  1610. color: Colors.white,
  1611. ),
  1612. )
  1613. ],
  1614. )),
  1615. Text(
  1616. list[i]["title"],
  1617. style: TextStyle(
  1618. color: Color(0xff222222),
  1619. fontSize: ScreenUtil().setSp(16)),
  1620. textAlign: TextAlign.start,
  1621. ),
  1622. Text(
  1623. list[i]["brand"],
  1624. style: TextStyle(
  1625. color: Color(0xff999999),
  1626. fontSize: ScreenUtil().setSp(14)),
  1627. textAlign: TextAlign.start,
  1628. ),
  1629. Text(
  1630. "${list[i]["num"]}人点赞",
  1631. style: TextStyle(
  1632. color: Color(0xff999999),
  1633. fontSize: ScreenUtil().setSp(14)),
  1634. textAlign: TextAlign.start,
  1635. ),
  1636. ])),
  1637. );
  1638. }).toList();
  1639. @override
  1640. Widget build(BuildContext context) {
  1641. return Container(
  1642. color: Colors.white,
  1643. child: Wrap(
  1644. // children:null
  1645. children: listWidget(context)),
  1646. );
  1647. }
  1648. }
  1649. class Heng extends StatelessWidget {
  1650. Heng({Key key, this.left, this.right, this.leftColor, this.rightColor})
  1651. : super(key: key);
  1652. String left;
  1653. String right;
  1654. int leftColor;
  1655. int rightColor;
  1656. @override
  1657. Widget build(BuildContext context) {
  1658. return Container(
  1659. padding: EdgeInsets.only(
  1660. left: ScreenUtil().setWidth(15),
  1661. right: ScreenUtil().setWidth(15),
  1662. top: ScreenUtil().setWidth(10),
  1663. bottom: ScreenUtil().setWidth(10)),
  1664. decoration: BoxDecoration(
  1665. border: Border(
  1666. bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
  1667. ),
  1668. ),
  1669. child: Row(
  1670. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1671. children: <Widget>[
  1672. Text(
  1673. left,
  1674. style: TextStyle(color: Color(leftColor), fontSize: 14),
  1675. textAlign: TextAlign.start,
  1676. ),
  1677. Text(
  1678. right,
  1679. style: TextStyle(color: Color(rightColor), fontSize: 14),
  1680. textAlign: TextAlign.start,
  1681. ),
  1682. ]),
  1683. );
  1684. }
  1685. }
  1686. // 选择下拉
  1687. class ChiosePicker extends StatefulWidget {
  1688. ChiosePicker({
  1689. Key key,
  1690. this.range,
  1691. this.value,
  1692. this.label,
  1693. this.isMust: false,
  1694. this.onConfirm,
  1695. this.placeholder = '请选择',
  1696. }) : super(key: key);
  1697. final List range;
  1698. String value;
  1699. final String label;
  1700. final bool isMust;
  1701. final String placeholder;
  1702. final Function(String, int) onConfirm;
  1703. @override
  1704. _ChiosePickerState createState() => _ChiosePickerState();
  1705. }
  1706. class _ChiosePickerState extends State<ChiosePicker> {
  1707. // String _value;
  1708. showPickerModal(BuildContext context) {
  1709. new Picker(
  1710. cancelText: "取消",
  1711. confirmText: "确认",
  1712. adapter: PickerDataAdapter<String>(
  1713. pickerdata: widget.range,
  1714. ),
  1715. changeToFirst: true,
  1716. hideHeader: false,
  1717. onConfirm: (Picker picker, List value) {
  1718. widget.value = picker.getSelectedValues()[0];
  1719. widget.onConfirm(picker.getSelectedValues()[0], value[0]);
  1720. setState(() {});
  1721. },
  1722. ).showModal(this.context);
  1723. }
  1724. @override
  1725. Widget build(BuildContext context) {
  1726. // _value = widget.value;
  1727. return InkWell(
  1728. onTap: () {
  1729. FocusScope.of(context).requestFocus(FocusNode());
  1730. showPickerModal(context);
  1731. },
  1732. child: Container(
  1733. padding: EdgeInsets.only(
  1734. top: ScreenUtil().setWidth(15),
  1735. bottom: ScreenUtil().setWidth(15),
  1736. ),
  1737. margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)),
  1738. decoration: BoxDecoration(
  1739. border: Border(
  1740. bottom: BorderSide(width: 0.5, color: Colours.line),
  1741. ),
  1742. ),
  1743. child: Row(
  1744. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1745. children: <Widget>[
  1746. Text(
  1747. widget.label,
  1748. style: TextStyle(
  1749. // fontSize: ScreenUtil().setSp(14)
  1750. ),
  1751. textAlign: TextAlign.start,
  1752. ),
  1753. Offstage(
  1754. offstage: !widget.isMust,
  1755. child: Text(
  1756. " *",
  1757. style: TextStyle(color: Colors.red),
  1758. ),
  1759. ),
  1760. Expanded(flex: 1, child: Container()),
  1761. widget.value == null || widget.value.isEmpty
  1762. ? Container(
  1763. child: Row(
  1764. children: <Widget>[
  1765. Text(
  1766. widget.placeholder,
  1767. style: TextStyle(
  1768. color: Color(0xffcccccc),
  1769. // fontSize: ScreenUtil().setSp(14)
  1770. ),
  1771. textAlign: TextAlign.start,
  1772. ),
  1773. Container(
  1774. padding: EdgeInsets.only(top: 3),
  1775. child: Icon(
  1776. Icons.keyboard_arrow_right,
  1777. size: 20.0,
  1778. color: Color(0xffcccccc),
  1779. ),
  1780. ),
  1781. SizedBox(width: 10)
  1782. ],
  1783. ),
  1784. )
  1785. : Container(
  1786. padding: EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  1787. child: Row(
  1788. children: <Widget>[
  1789. Text(
  1790. widget.value,
  1791. style: TextStyle(
  1792. color: Color(0xff222222),
  1793. fontSize: ScreenUtil().setSp(14)),
  1794. textAlign: TextAlign.start,
  1795. ),
  1796. ],
  1797. ),
  1798. ),
  1799. ],
  1800. ),
  1801. ),
  1802. );
  1803. }
  1804. }
  1805. class CommonActionBar extends StatelessWidget {
  1806. final isFavorited;
  1807. final Function onTapSharing;
  1808. final Function onTapFavoriting;
  1809. final Function onTapAction;
  1810. final String actionText;
  1811. final Widget actionWidget;
  1812. CommonActionBar(
  1813. {this.isFavorited = false,
  1814. this.actionText = '',
  1815. this.onTapSharing,
  1816. this.onTapFavoriting,
  1817. this.onTapAction,
  1818. this.actionWidget});
  1819. @override
  1820. Widget build(BuildContext context) {
  1821. double width = MediaQuery.of(context).size.width;
  1822. return Container(
  1823. width: width,
  1824. color: Colors.white,
  1825. padding: EdgeInsets.all(10),
  1826. child: Row(
  1827. crossAxisAlignment: CrossAxisAlignment.center,
  1828. children: <Widget>[
  1829. Expanded(
  1830. child: Row(
  1831. mainAxisAlignment: MainAxisAlignment.spaceAround,
  1832. children: [
  1833. GestureDetector(
  1834. onTap: () {
  1835. if (this.onTapSharing != null) this.onTapSharing();
  1836. },
  1837. child: Container(
  1838. // padding: EdgeInsets.only(left:25,right:30),
  1839. child: Column(children: <Widget>[
  1840. Icon(
  1841. const IconData(0xe693, fontFamily: "Iconfont"),
  1842. size: 20.0,
  1843. color: Color(0xff333333),
  1844. ),
  1845. Text(
  1846. "分享",
  1847. style: TextStyle(
  1848. color: Color(0xff555A64),
  1849. fontSize: 12,
  1850. ),
  1851. textAlign: TextAlign.start,
  1852. ),
  1853. ])),
  1854. ),
  1855. GestureDetector(
  1856. onTap: () {
  1857. if (this.onTapFavoriting != null) this.onTapFavoriting();
  1858. },
  1859. child: Container(
  1860. child: Column(children: <Widget>[
  1861. Icon(
  1862. isFavorited ? Iconfont.shoucang1 : Iconfont.shoucang,
  1863. size: 20.0,
  1864. color: Color(isFavorited ? 0xff5589FF : 0xff555A64),
  1865. ),
  1866. Text(
  1867. isFavorited ? "已收藏" : "收藏",
  1868. style: TextStyle(
  1869. color: Color(isFavorited ? 0xff5589FF : 0xff555A64),
  1870. fontSize: 12,
  1871. ),
  1872. textAlign: TextAlign.start,
  1873. ),
  1874. ])),
  1875. ),
  1876. ],
  1877. ),
  1878. ),
  1879. Container(
  1880. height: 45,
  1881. width: 240,
  1882. decoration: BoxDecoration(
  1883. color: Color(0xff5589FF),
  1884. borderRadius: BorderRadius.circular(30),
  1885. ),
  1886. child: FlatButton(
  1887. // padding: EdgeInsets.all(15.0),
  1888. child: actionWidget != null
  1889. ? actionWidget
  1890. : Text(
  1891. actionText,
  1892. style: TextStyle(
  1893. fontSize: 16,
  1894. ),
  1895. ),
  1896. textColor: Colors.white,
  1897. onPressed: () {
  1898. if (onTapAction != null) onTapAction();
  1899. },
  1900. ),
  1901. ),
  1902. ],
  1903. ),
  1904. );
  1905. }
  1906. }
  1907. class AlphabeticIndexBar extends StatelessWidget {
  1908. final Map<String, double> positionAnchors;
  1909. final ScrollController controller;
  1910. const AlphabeticIndexBar({Key key, this.positionAnchors, this.controller})
  1911. : super(key: key);
  1912. @override
  1913. Widget build(BuildContext context) {
  1914. var alphabetAnchors = positionAnchors.keys
  1915. .map(
  1916. (e) => GestureDetector(
  1917. child: Text(
  1918. e,
  1919. style: TextStyle(color: Color(0xff5589FF), fontSize: 15),
  1920. ),
  1921. onTap: () => controller.animateTo(positionAnchors[e],
  1922. duration: Duration(milliseconds: 500),
  1923. curve: Curves.decelerate),
  1924. ),
  1925. )
  1926. .toList();
  1927. return Column(
  1928. // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1929. // crossAxisAlignment: CrossA,
  1930. children: [
  1931. ...alphabetAnchors,
  1932. Text(
  1933. '#',
  1934. style: TextStyle(color: Color(0xff5589FF), fontSize: 15),
  1935. )
  1936. ],
  1937. );
  1938. }
  1939. @override
  1940. void debugFillProperties(DiagnosticPropertiesBuilder properties) {
  1941. super.debugFillProperties(properties);
  1942. properties
  1943. .add(DiagnosticsProperty<ScrollController>('controller', controller));
  1944. }
  1945. }
  1946. class CircularLoading extends StatelessWidget {
  1947. @override
  1948. Widget build(BuildContext context) {
  1949. return Container(
  1950. padding: EdgeInsets.only(top: 10, bottom: 10),
  1951. color: ThemeUtils.getTabsBg(context),
  1952. child: Center(
  1953. child: SpinKitFadingCircle(
  1954. color: Colors.blueAccent,
  1955. size: 30.0,
  1956. ),
  1957. ),
  1958. );
  1959. }
  1960. }