bbs_content.dart 65 KB

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