bbs_content.dart 64 KB

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