bbs_content.dart 65 KB

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