bbs_content.dart 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_swiper/flutter_swiper.dart';
  3. import 'package:liftmanager/widgets/load_image.dart';
  4. import 'package:liftmanager/res/resources.dart';
  5. import 'package:liftmanager/routers/fluro_navigator.dart';
  6. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'dart:convert';
  9. import 'package:liftmanager/utils/time_format.dart';
  10. import 'package:liftmanager/utils/url.dart';
  11. import 'package:liftmanager/utils/utils.dart';
  12. import 'package:flutter_picker/flutter_picker.dart';
  13. import 'package:liftmanager/internal/work/work_router.dart';
  14. import 'package:liftmanager/internal/bbs/model/banner_model.dart' as banner;
  15. import 'package:liftmanager/internal/means/page/means_pdf.dart';
  16. import 'dart:io';
  17. import 'package:flutter/foundation.dart';
  18. import 'package:path_provider/path_provider.dart';
  19. import 'package:flustars/flustars.dart' as FlutterStars;
  20. import 'package:liftmanager/common/common.dart';
  21. import 'package:liftmanager/internal/account/account_router.dart';
  22. import 'package:liftmanager/utils/toast.dart';
  23. import 'package:liftmanager/utils/theme_utils.dart';
  24. import 'package:liftmanager/internal/news/news_router.dart';
  25. class SwipeWidget extends StatelessWidget {
  26. const SwipeWidget({Key key, this.banners}) : super(key: key);
  27. final List<banner.Records> banners;
  28. // List<String> bannersLL = <String> [
  29. // 'tab_first/banner',
  30. // 'tab_first/banner',
  31. // 'tab_first/banner',
  32. // ];
  33. Future<File> createFileOfPdfUrl(url) async {
  34. final filename = url.substring(url.lastIndexOf("/") + 1);
  35. var request = await HttpClient().getUrl(Uri.parse(url));
  36. var response = await request.close();
  37. var bytes = await consolidateHttpClientResponseBytes(response);
  38. String dir = (await getApplicationDocumentsDirectory()).path;
  39. File file = new File('$dir/$filename');
  40. await file.writeAsBytes(bytes);
  41. return file;
  42. }
  43. @override
  44. Widget build(BuildContext context) {
  45. double width = MediaQuery.of(context).size.width;
  46. double height = ScreenUtil().setWidth(200);
  47. // double height = width * 540.0 / 1080.0;
  48. return Container(
  49. width: width,
  50. height: height,
  51. child: Swiper(
  52. index: 0,
  53. itemBuilder: (BuildContext context, index) {
  54. return
  55. GestureDetector(
  56. onTap: (){
  57. if(banners[index].jumpType == 2){
  58. NavigatorUtils.push(context, "${WorkRouter.webview}?title="+Uri.encodeComponent("详情")+"&url="+Uri.encodeComponent(banners[index].url));
  59. }else if (banners[index].jumpType == 1){
  60. createFileOfPdfUrl(banners[index].url).then((f) {
  61. // setState(() {
  62. // pathPDF = f.path;
  63. Navigator.push(
  64. context,
  65. MaterialPageRoute(
  66. builder: (context) => PDFScreen(f.path,"null","null")
  67. ));
  68. // });
  69. });
  70. }
  71. },
  72. child: Container(
  73. width: width,
  74. height: height,
  75. key: UniqueKey(),
  76. // margin:EdgeInsets.only(left:15,right:15),
  77. child:
  78. // Image.asset(
  79. // bannersLL[index],
  80. // width:width,
  81. // height:height,
  82. // fit:BoxFit.cover,
  83. // ),
  84. LoadNetworkImage(
  85. // imgFontUrl + bannerPic[index],
  86. banners[index].image,
  87. width: width,
  88. height: height,
  89. fit: BoxFit.fill,
  90. ),
  91. ),
  92. );
  93. },
  94. pagination: SwiperPagination(
  95. builder: DotSwiperPaginationBuilder(
  96. color: Colors.grey,
  97. activeColor: Colors.white,
  98. size: 6,
  99. activeSize: 6)),
  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: ScreenUtil().setWidth(25),
  131. right: ScreenUtil().setWidth(25),
  132. top: ScreenUtil().setHeight(25)),
  133. child: Row(
  134. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  135. children: <Widget>[
  136. Row(
  137. children: <Widget>[
  138. LoadAssetImage(
  139. // image: AssetImage(i['img']),
  140. diagnosisObj[i]["img"],
  141. width: ScreenUtil().setWidth(50),
  142. height: ScreenUtil().setWidth(50),
  143. // alignment: Alignment.centerLeft,
  144. ),
  145. Container(
  146. child: Column(
  147. crossAxisAlignment: CrossAxisAlignment.start,
  148. children: <Widget>[
  149. Text(
  150. diagnosisObj[i]["title"],
  151. style: TextStyle(
  152. fontSize: ScreenUtil().setSp(22)),
  153. textAlign: TextAlign.start,
  154. ),
  155. Text(
  156. diagnosisObj[i]["desc"],
  157. style: TextStyle(
  158. color: Color(0xff999999),
  159. fontSize: ScreenUtil().setSp(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 && !Utils.getAuthByRouter('quick_consultation')) {
  177. return false;
  178. }
  179. if (i == 1 && !Utils.getAuthByRouter('quich_visit')) {
  180. return false;
  181. }
  182. String index = i.toString();
  183. NavigatorUtils.push(context, "${BbsRouter.brandPage}?index=$index");
  184. },
  185. );
  186. }).toList();
  187. @override
  188. Widget build(BuildContext context) {
  189. return Container(
  190. padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(20)),
  191. color: ThemeUtils.getTabsBg(context),
  192. child: Column(children: listWidget(context)));
  193. }
  194. }
  195. class HotQuestion extends StatelessWidget {
  196. const HotQuestion({Key key, this.initList}) : super(key: key);
  197. final List<dynamic> initList;
  198. List<Widget> listWidget(context) => initList.map((item) {
  199. double width = MediaQuery.of(context).size.width;
  200. // print(JsonEncoder().convert(initList));
  201. // print(initList);
  202. // print(11111);
  203. return GestureDetector(
  204. child: Container(
  205. padding: EdgeInsets.only(
  206. left: ScreenUtil().setWidth(15),
  207. right: ScreenUtil().setWidth(10),
  208. top: ScreenUtil().setHeight(10),
  209. bottom: ScreenUtil().setHeight(10)),
  210. decoration: BoxDecoration(
  211. border: Border(
  212. bottom: BorderSide(width: 0.5, color: Colours.line),
  213. ),
  214. color: ThemeUtils.getTabsBg(context)
  215. ),
  216. child: Column(
  217. crossAxisAlignment: CrossAxisAlignment.start,
  218. children: <Widget>[
  219. Text(
  220. "[${item.brandName??''}]${item.title??''}",
  221. textAlign: TextAlign.left,
  222. style: TextStyle(fontSize: ScreenUtil().setSp(15)),
  223. maxLines: 1,
  224. overflow: TextOverflow.ellipsis,
  225. ),
  226. Container(
  227. padding: EdgeInsets.only(
  228. top: ScreenUtil().setHeight(10),
  229. bottom: ScreenUtil().setHeight(10)),
  230. child: Row(
  231. children: <Widget>[
  232. ClipRRect(
  233. borderRadius: BorderRadius.circular(
  234. ScreenUtil().setWidth(18)),
  235. child: Container(
  236. child: LoadNetworkImage(
  237. item.avatarUrl,
  238. // fit: BoxFit.fitWidth,
  239. width: ScreenUtil().setWidth(34),
  240. height: ScreenUtil().setWidth(34),
  241. ),
  242. )),
  243. Container(
  244. padding:
  245. EdgeInsets.only(left: ScreenUtil().setWidth(10)),
  246. child: Column(
  247. crossAxisAlignment: CrossAxisAlignment.start,
  248. children: <Widget>[
  249. Text(
  250. item.userName ?? null,
  251. style: TextStyle(
  252. fontSize: ScreenUtil().setSp(14),
  253. ),
  254. ),
  255. Text(
  256. DateUtils.instance.getFormartData(
  257. timeSamp: item.createTime,
  258. format: "yyyy-MM-dd"),
  259. style: TextStyle(
  260. fontSize: ScreenUtil().setSp(12),
  261. color: Color(0xffaaaaaa)),
  262. ),
  263. ],
  264. ),
  265. )
  266. ],
  267. ),
  268. ),
  269. Text(
  270. item.expression,
  271. textAlign: TextAlign.left,
  272. style: TextStyle(
  273. color: Color(0xff666666),
  274. fontSize: ScreenUtil().setSp(14),
  275. ),
  276. maxLines: 2,
  277. overflow: TextOverflow.ellipsis,
  278. ),
  279. Container(
  280. padding: EdgeInsets.only(
  281. top: ScreenUtil().setHeight(5),
  282. bottom: ScreenUtil().setHeight(5)),
  283. child: Row(
  284. mainAxisAlignment: MainAxisAlignment.start,
  285. children: item.imgs != null && item.imgs.isNotEmpty
  286. ? List<Widget>.from(
  287. item.imgs.split(",").asMap().keys.map((index) {
  288. // print(item);
  289. return index<3?Container(
  290. padding:
  291. index < item.imgs.split(",").length - 1
  292. ? EdgeInsets.only(right: 6)
  293. : EdgeInsets.only(right: 0),
  294. // color:Colors.red,
  295. // decoration: BoxDecoration(
  296. // borderRadius: BorderRadius.circular(20.0),
  297. // ),
  298. child: ClipRRect(
  299. borderRadius: BorderRadius.circular(10),
  300. child: LoadNetworkImage(
  301. item.imgs.split(",")[index],
  302. fit: BoxFit.fill,
  303. height: ScreenUtil().setWidth(80),
  304. width: ScreenUtil().setWidth(110),
  305. isWater: true,
  306. ),
  307. ),
  308. ):Container(child:null);
  309. }).toList())
  310. : <Widget>[]),
  311. ),
  312. Text(
  313. "${item.likeNum}人赞",
  314. textAlign: TextAlign.right,
  315. style: TextStyle(
  316. color: Color(0xff999999),
  317. fontSize: ScreenUtil().setSp(14),
  318. ),
  319. )
  320. ]),
  321. ),
  322. onTap: () {
  323. // print(item);
  324. NavigatorUtils.push(context,
  325. "${BbsRouter.questionDetail}?id=${item.id.toString()}");
  326. // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){
  327. // toasts("请登录");
  328. // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
  329. // }else {
  330. // NavigatorUtils.push(context,
  331. // "${BbsRouter.questionDetail}?id=${item.id.toString()}");
  332. // }
  333. },
  334. );
  335. }).toList();
  336. @override
  337. Widget build(BuildContext context) {
  338. return Container(
  339. color: Colors.white,
  340. child: Column(
  341. // children:null
  342. children: listWidget(context)),
  343. );
  344. }
  345. }
  346. class HotClass extends StatelessWidget {
  347. const HotClass({Key key, this.initList}) : super(key: key);
  348. final List<dynamic> initList;
  349. List<Widget> listWidget(context) => initList.asMap().keys.map((i) {
  350. double width = MediaQuery.of(context).size.width;
  351. return GestureDetector(
  352. child: Container(
  353. color: ThemeUtils.getTabsBg(context),
  354. child: Row(children: <Widget>[
  355. // i == 0? SizedBox(
  356. // width:ScreenUtil().setWidth(10)
  357. // ):Container(child:null),
  358. SizedBox(width: ScreenUtil().setWidth(10)),
  359. Column(
  360. crossAxisAlignment: CrossAxisAlignment.start,
  361. children: <Widget>[
  362. Stack(
  363. children: <Widget>[
  364. Container(
  365. child: Container(
  366. padding: EdgeInsets.only(
  367. top: ScreenUtil().setHeight(10),
  368. bottom: ScreenUtil().setHeight(10)),
  369. // padding: EdgeInsets.only(right:15),
  370. child: ClipRRect(
  371. borderRadius: BorderRadius.circular(10),
  372. child: LoadNetworkImage(
  373. initList[i].cover,
  374. // fit: BoxFit.cover,
  375. width: ScreenUtil().setWidth(140),
  376. height: ScreenUtil().setWidth(95),
  377. isWater: true,
  378. ),
  379. ),
  380. ),
  381. ),
  382. Positioned(
  383. left: ScreenUtil().setWidth(55),
  384. top: ScreenUtil().setWidth(43),
  385. child: Container(
  386. width: ScreenUtil().setWidth(20),
  387. height: ScreenUtil().setWidth(20),
  388. // color:Colors.red,
  389. child: Icon(
  390. IconData(0xe607, fontFamily: "myfont"),
  391. size: 30,
  392. color: Color(0xffdddddd),
  393. ),
  394. ))
  395. ],
  396. ),
  397. Container(
  398. width: ScreenUtil().setWidth(140),
  399. child:Text(
  400. initList[i].title??"",
  401. textAlign: TextAlign.left,
  402. style: TextStyle(
  403. fontSize: ScreenUtil().setSp(15),
  404. ),
  405. maxLines: 1,
  406. overflow: TextOverflow.ellipsis,
  407. ),
  408. ),
  409. Text(
  410. initList[i].brandName!=null?initList[i].brandName.toString():"",
  411. textAlign: TextAlign.left,
  412. overflow: TextOverflow.ellipsis,
  413. style: TextStyle(
  414. fontSize: ScreenUtil().setSp(14),
  415. color: Color(0xff999999),
  416. ),
  417. ),
  418. Text(
  419. "${initList[i].likeNum ?? '0'}人点赞",
  420. textAlign: TextAlign.left,
  421. style: TextStyle(
  422. fontSize: ScreenUtil().setSp(14),
  423. color: Color(0xff999999),
  424. ),
  425. ),
  426. // SizedBox(
  427. // height:10
  428. // )
  429. ]),
  430. i == initList.length - 1
  431. ? SizedBox(width: 10)
  432. : Container(child: null)
  433. ])),
  434. onTap: () {
  435. print(i);
  436. NavigatorUtils.push(context,
  437. "${BbsRouter.videoDetail}?id=${initList[i].id.toString()}");
  438. // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){
  439. // toasts("请登录");
  440. // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
  441. // }else {
  442. // NavigatorUtils.push(context,
  443. // "${BbsRouter.videoDetail}?id=${initList[i].id.toString()}");
  444. // }
  445. },
  446. );
  447. }).toList();
  448. @override
  449. Widget build(BuildContext context) {
  450. return ListView(
  451. scrollDirection: Axis.horizontal,
  452. padding: EdgeInsets.all(0),
  453. children: listWidget(context),
  454. );
  455. }
  456. }
  457. class HotProduct extends StatelessWidget {
  458. HotProduct({Key key, this.productList}) : super(key: key);
  459. List<dynamic> productList;
  460. List<Widget> listWidget(context) => productList.map((i) {
  461. double width = MediaQuery.of(context).size.width;
  462. return InkWell(
  463. child: Container(
  464. padding: EdgeInsets.only(
  465. left: ScreenUtil().setWidth(15),
  466. right: ScreenUtil().setWidth(15),
  467. top: ScreenUtil().setHeight(10),
  468. bottom: ScreenUtil().setHeight(10)),
  469. decoration: BoxDecoration(
  470. border: Border(
  471. bottom: BorderSide(width: 0.5, color: Colours.line),
  472. ),
  473. color: ThemeUtils.getTabsBg(context)
  474. ),
  475. child: Row(
  476. crossAxisAlignment: CrossAxisAlignment.start,
  477. children: <Widget>[
  478. ClipRRect(
  479. borderRadius: BorderRadius.circular(5),
  480. child: Container(
  481. padding:
  482. EdgeInsets.only(right: ScreenUtil().setWidth(10)),
  483. child: LoadNetworkImage(
  484. i.imgs.split(",")[0],
  485. // fit: BoxFit.cover,
  486. width: ScreenUtil().setWidth(90),
  487. height: ScreenUtil().setWidth(90),
  488. isWater: true,
  489. ),
  490. ),
  491. ),
  492. Column(
  493. crossAxisAlignment: CrossAxisAlignment.start,
  494. children: <Widget>[
  495. Container(
  496. width: width*0.62,
  497. child: Text(
  498. i.name ?? "",
  499. textAlign: TextAlign.left,
  500. style: TextStyle(
  501. fontSize: ScreenUtil().setSp(15),
  502. ),
  503. maxLines: 1,
  504. overflow: TextOverflow.ellipsis,
  505. ),
  506. ),
  507. Container(
  508. width: width*0.62,
  509. child: Text(
  510. i.brandName ?? "",
  511. textAlign: TextAlign.left,
  512. style: TextStyle(
  513. fontSize: ScreenUtil().setSp(14),
  514. color: Color(0xff666666),
  515. ),
  516. maxLines: 1,
  517. overflow: TextOverflow.ellipsis,
  518. ),
  519. ),
  520. Container(
  521. width: width*0.62,
  522. child: Text(
  523. "供应商:${i.manufacturer}",
  524. textAlign: TextAlign.left,
  525. style: TextStyle(
  526. fontSize: ScreenUtil().setSp(14),
  527. color: Color(0xff666666),
  528. ),
  529. maxLines: 1,
  530. overflow: TextOverflow.ellipsis,
  531. ),
  532. ),
  533. Container(
  534. width: width*0.62,
  535. child: Text(
  536. "Tel:${i.telephone}",
  537. textAlign: TextAlign.left,
  538. style: TextStyle(
  539. fontSize: ScreenUtil().setSp(14),
  540. color: Color(0xff666666),
  541. ),
  542. maxLines: 1,
  543. overflow: TextOverflow.ellipsis,
  544. ),
  545. )
  546. ],
  547. ),
  548. ]),
  549. ),
  550. onTap: () {
  551. print(i);
  552. NavigatorUtils.push(
  553. context, "${BbsRouter.productDetail}?id=${i.id.toString()}");
  554. // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){
  555. // toasts("请登录");
  556. // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
  557. // }else {
  558. // NavigatorUtils.push(
  559. // context, "${BbsRouter.productDetail}?id=${i.id.toString()}");
  560. // }
  561. },
  562. );
  563. }).toList();
  564. @override
  565. Widget build(BuildContext context) {
  566. return Container(
  567. color: Colors.white,
  568. child: Column(children: listWidget(context)),
  569. );
  570. }
  571. }
  572. class HotNews extends StatelessWidget{
  573. HotNews({Key key, this.newsList}) : super(key: key);
  574. List<dynamic> newsList;
  575. List<Widget> listWidget(context) => newsList.map((i) {
  576. double width = MediaQuery.of(context).size.width;
  577. return InkWell(
  578. onTap: () {
  579. print("点击了");
  580. NavigatorUtils.push(context,
  581. "${NewsRouter.newsDetail}?id=${i.id}");
  582. // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){
  583. // toasts("请登录");
  584. // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
  585. // }else {
  586. // NavigatorUtils.push(context,
  587. // "${BbsRouter.newsDetail}?id=${i.id}");
  588. // }
  589. },
  590. child: Container(
  591. width:width,
  592. padding: EdgeInsets.only(
  593. left: ScreenUtil().setWidth(15),
  594. right: ScreenUtil().setWidth(15),
  595. top: ScreenUtil().setHeight(10),
  596. bottom: ScreenUtil().setHeight(10)),
  597. decoration: BoxDecoration(
  598. border: Border(
  599. bottom: BorderSide(width: 0.5, color: Colours.line),
  600. ),
  601. color: ThemeUtils.getTabsBg(context)
  602. ),
  603. child: Column(
  604. crossAxisAlignment: CrossAxisAlignment.start,
  605. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  606. children: <Widget>[
  607. Text(
  608. i.title,
  609. style: TextStyle(fontSize: 15),
  610. // overflow: TextOverflow.ellipsis,
  611. ),
  612. Gaps.vGap12,
  613. Text(
  614. "${i.releaseUser}·阅读${i.lookNum}次·点赞${i.likeNum}",
  615. style: TextStyle(
  616. fontSize: 11, color: Colours.text_gray),
  617. )
  618. ],
  619. ),
  620. ),
  621. );
  622. }).toList();
  623. @override
  624. Widget build(BuildContext context) {
  625. return Container(
  626. color: Colors.white,
  627. child: Column(children: listWidget(context)),
  628. );
  629. }
  630. }
  631. class HotPosition extends StatelessWidget {
  632. HotPosition({Key key, this.positionList}) : super(key: key);
  633. List<dynamic> positionList;
  634. List<Widget> listWidget(context) => positionList.map((i) {
  635. double width = MediaQuery.of(context).size.width;
  636. return InkWell(
  637. child: Container(
  638. padding: EdgeInsets.only(
  639. left: ScreenUtil().setWidth(15),
  640. right: ScreenUtil().setWidth(15),
  641. top: ScreenUtil().setHeight(10),
  642. bottom: ScreenUtil().setHeight(10)),
  643. decoration: BoxDecoration(
  644. border: Border(
  645. bottom: BorderSide(width: 0.5, color: Colours.line),
  646. ),
  647. color: ThemeUtils.getTabsBg(context)
  648. ),
  649. child: Column(
  650. // crossAxisAlignment: CrossAxisAlignment.start,
  651. children: <Widget>[
  652. Container(
  653. width: width,
  654. padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(5)),
  655. child: Row(
  656. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  657. children: <Widget>[
  658. Container(
  659. width: width*0.4,
  660. child: Text(
  661. i.job ?? "",
  662. textAlign: TextAlign.left,
  663. style: TextStyle(
  664. fontSize: ScreenUtil().setSp(17),
  665. ),
  666. overflow: TextOverflow.ellipsis,
  667. ),
  668. ),
  669. Container(
  670. width: width*0.4,
  671. child:Text(
  672. "¥" +
  673. i.lowerSalary.toString() +
  674. "-" +
  675. i.upperSalary.toString(),
  676. textAlign: TextAlign.right,
  677. style: TextStyle(
  678. fontSize: ScreenUtil().setSp(17),
  679. color: Color(0xffff0000),
  680. ),
  681. overflow: TextOverflow.ellipsis,
  682. ),
  683. )
  684. ],
  685. ),
  686. ),
  687. Row(
  688. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  689. children: <Widget>[
  690. Container(
  691. width: width * 0.45,
  692. child: Text(
  693. i.company.name ?? "",
  694. textAlign: TextAlign.left,
  695. style: TextStyle(
  696. fontSize: ScreenUtil().setSp(14),
  697. color: Color(0xff999999),
  698. ),
  699. overflow: TextOverflow.ellipsis,
  700. ),
  701. ),
  702. Expanded(
  703. child:i.provinceName != null?Container(
  704. // width: width * 0.4,
  705. child: Text(
  706. (i.provinceName != null ? i.provinceName : '') +
  707. "-" +
  708. (i.cityName != null ? i.cityName : ''),
  709. textAlign: TextAlign.right,
  710. style: TextStyle(
  711. fontSize: ScreenUtil().setSp(14),
  712. color: Color(0xff999999),
  713. ),
  714. overflow: TextOverflow.ellipsis,
  715. ),
  716. ):Container(child:null),
  717. )
  718. ],
  719. ),
  720. Row(
  721. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  722. children: <Widget>[
  723. Container(
  724. width: width * 0.65,
  725. child: Text(
  726. i.info ?? "",
  727. textAlign: TextAlign.left,
  728. style: TextStyle(
  729. fontSize: ScreenUtil().setSp(14),
  730. color: Color(0xff999999),
  731. ),
  732. overflow: TextOverflow.ellipsis,
  733. ),
  734. ),
  735. Text(
  736. DateUtils.instance.getFormartData(
  737. timeSamp: i.createTime, format: "yyyy-MM-dd"),
  738. textAlign: TextAlign.left,
  739. style: TextStyle(
  740. fontSize: ScreenUtil().setSp(14),
  741. color: Color(0xff999999),
  742. ),
  743. ),
  744. ],
  745. ),
  746. ]),
  747. ),
  748. onTap: () {
  749. print(i);
  750. NavigatorUtils.push(
  751. context, "${BbsRouter.positionDetail}?id=${i.id}");
  752. // if(FlutterStars.SpUtil.getString(Constant.userId) == "-1"){
  753. // toasts("请登录");
  754. // NavigatorUtils.push(context, AccountRouter.loginPage, clearStack: true);
  755. // }else {
  756. // NavigatorUtils.push(
  757. // context, "${BbsRouter.positionDetail}?id=${i.id}");
  758. // }
  759. },
  760. );
  761. }).toList();
  762. @override
  763. Widget build(BuildContext context) {
  764. return Container(
  765. color: Colors.white,
  766. child: Column(children: listWidget(context)),
  767. );
  768. }
  769. }
  770. class LableTitle extends StatelessWidget {
  771. LableTitle(
  772. {Key key,
  773. this.title,
  774. this.userTap,
  775. this.isMore = true,
  776. this.hasArrow = false})
  777. : super(key: key);
  778. String title;
  779. Function userTap;
  780. bool isMore;
  781. bool hasArrow;
  782. @override
  783. Widget build(BuildContext context) {
  784. return GestureDetector(
  785. onTap: () {
  786. userTap();
  787. },
  788. child: Container(
  789. height: ScreenUtil().setHeight(45),
  790. padding: EdgeInsets.only(
  791. left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15)),
  792. alignment: Alignment.centerLeft,
  793. decoration: BoxDecoration(
  794. color: ThemeUtils.getTabsBg(context),
  795. border: Border(
  796. bottom: BorderSide(width: 0.5, color: ThemeUtils.getDialogTextFieldColor(context)),
  797. ),
  798. ),
  799. child: Row(
  800. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  801. children: <Widget>[
  802. Row(
  803. crossAxisAlignment: CrossAxisAlignment.center,
  804. children: <Widget>[
  805. Container(
  806. margin: EdgeInsets.only(top: ScreenUtil().setWidth(3)),
  807. height: ScreenUtil().setWidth(15),
  808. width: ScreenUtil().setWidth(3),
  809. decoration: BoxDecoration(
  810. gradient: const LinearGradient(
  811. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  812. ),
  813. ),
  814. Container(
  815. padding: EdgeInsets.only(left: ScreenUtil().setWidth(10)),
  816. decoration: BoxDecoration(
  817. border: Border(
  818. // left: BorderSide(width: 3, color: Colours.app_main),
  819. )),
  820. child: Text(
  821. title,
  822. style: TextStyle(
  823. fontSize: ScreenUtil().setSp(15),
  824. fontWeight: FontWeight.bold),
  825. ),
  826. ),
  827. ],
  828. ),
  829. Container(
  830. child: Row(children: <Widget>[
  831. Text(
  832. isMore == true ? "更多" : '',
  833. style: TextStyle(
  834. fontSize: ScreenUtil().setSp(13), color: Color(0xFF666666)),
  835. ),
  836. hasArrow
  837. ? Container(
  838. child: Images.arrowRight,
  839. )
  840. : Container(child: null)
  841. ]))
  842. ],
  843. ),
  844. ),
  845. );
  846. }
  847. }
  848. class ChioseThis extends StatelessWidget {
  849. ChioseThis(
  850. {Key key,
  851. this.list,
  852. this.value,
  853. this.label,
  854. this.isMust: false,
  855. this.fun,
  856. this.labelText = '请选择'})
  857. : super(key: key);
  858. List<dynamic> list;
  859. String value;
  860. String label;
  861. bool isMust;
  862. Function fun;
  863. String labelText;
  864. @override
  865. Widget build(BuildContext context) {
  866. double width = MediaQuery.of(context).size.width;
  867. return InkWell(
  868. onTap: () {
  869. showModalBottomSheet(
  870. context: context,
  871. builder: (context) {
  872. return Container(
  873. height: 80,
  874. child: Column(
  875. crossAxisAlignment: CrossAxisAlignment.start,
  876. children: list.asMap().keys.map((index) {
  877. return InkWell(
  878. onTap: () {
  879. fun(index);
  880. },
  881. child: Container(
  882. width: width,
  883. padding: EdgeInsets.only(
  884. bottom: ScreenUtil().setWidth(10),
  885. top: ScreenUtil().setWidth(5)),
  886. decoration: BoxDecoration(
  887. border: Border(
  888. bottom: BorderSide(width: 0.5, color: Colours.line),
  889. ),
  890. ),
  891. child: Text(
  892. list[index],
  893. style: TextStyle(
  894. color: Color(0xff333333),
  895. fontSize: ScreenUtil().setSp(16)),
  896. textAlign: TextAlign.center,
  897. ),
  898. ),
  899. );
  900. }).toList(),
  901. ),
  902. );
  903. });
  904. },
  905. child: Container(
  906. padding: EdgeInsets.only(
  907. top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15)),
  908. margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)),
  909. decoration: BoxDecoration(
  910. border: Border(
  911. bottom: BorderSide(width: 0.5, color: Colours.line),
  912. ),
  913. ),
  914. child: Row(
  915. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  916. children: <Widget>[
  917. Text(
  918. label,
  919. style: TextStyle(
  920. color: Color(0xff222222),
  921. // fontSize: ScreenUtil().setSp(14)
  922. ),
  923. textAlign: TextAlign.start,
  924. ),
  925. Offstage(
  926. offstage: !this.isMust,
  927. child: Text(
  928. "*",
  929. style: TextStyle(color: Colors.red),
  930. ),
  931. ),
  932. Expanded(flex: 1, child: Container()),
  933. value.isEmpty
  934. ? Container(
  935. child: Row(children: <Widget>[
  936. Text(
  937. labelText,
  938. style: TextStyle(
  939. color: Color(0xffcccccc),
  940. // fontSize: ScreenUtil().setSp(14)
  941. ),
  942. textAlign: TextAlign.start,
  943. ),
  944. Container(
  945. padding: EdgeInsets.only(top: 3),
  946. child: Icon(
  947. Icons.keyboard_arrow_right,
  948. size: 20.0,
  949. color: Color(0xffcccccc),
  950. ),
  951. ),
  952. SizedBox(width: 10)
  953. ]),
  954. )
  955. : Container(
  956. padding:
  957. EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  958. child: Row(children: <Widget>[
  959. Text(
  960. value,
  961. style: TextStyle(
  962. color: Color(0xff222222),
  963. fontSize: ScreenUtil().setSp(14)),
  964. textAlign: TextAlign.start,
  965. ),
  966. ]),
  967. ),
  968. ]),
  969. ),
  970. );
  971. }
  972. }
  973. class IsvideoList extends StatelessWidget {
  974. IsvideoList({Key key, this.list, this.fun}) : super(key: key);
  975. List<dynamic> list;
  976. Function fun;
  977. List<Widget> listWidget(context) => list.asMap().keys.map((i) {
  978. double width = MediaQuery.of(context).size.width;
  979. return GestureDetector(
  980. onTap: () {
  981. fun();
  982. },
  983. child: Container(
  984. padding: EdgeInsets.only(left: 10, right: 10, bottom: 5),
  985. width: width / 2,
  986. child: Column(
  987. crossAxisAlignment: CrossAxisAlignment.start,
  988. children: <Widget>[
  989. Container(
  990. child: Stack(
  991. children: <Widget>[
  992. ClipRRect(
  993. borderRadius: BorderRadius.circular(5),
  994. child: Container(
  995. child: LoadAssetImage(
  996. list[i]["image"],
  997. width: 190,
  998. height: 140,
  999. ),
  1000. ),
  1001. ),
  1002. Positioned(
  1003. left: 77,
  1004. top: 57,
  1005. child: Icon(
  1006. IconData(0xe607, fontFamily: "myfont"),
  1007. size: 26.0,
  1008. color: Colors.white,
  1009. ),
  1010. )
  1011. ],
  1012. )),
  1013. Text(
  1014. list[i]["title"],
  1015. style: TextStyle(
  1016. color: Color(0xff222222),
  1017. fontSize: ScreenUtil().setSp(16)),
  1018. textAlign: TextAlign.start,
  1019. ),
  1020. Text(
  1021. list[i]["brand"],
  1022. style: TextStyle(
  1023. color: Color(0xff999999),
  1024. fontSize: ScreenUtil().setSp(14)),
  1025. textAlign: TextAlign.start,
  1026. ),
  1027. Text(
  1028. "${list[i]["num"]}人点赞",
  1029. style: TextStyle(
  1030. color: Color(0xff999999),
  1031. fontSize: ScreenUtil().setSp(14)),
  1032. textAlign: TextAlign.start,
  1033. ),
  1034. ])),
  1035. );
  1036. }).toList();
  1037. @override
  1038. Widget build(BuildContext context) {
  1039. return Container(
  1040. color: Colors.white,
  1041. child: Wrap(
  1042. // children:null
  1043. children: listWidget(context)),
  1044. );
  1045. }
  1046. }
  1047. class Heng extends StatelessWidget {
  1048. Heng({Key key, this.left, this.right, this.leftColor, this.rightColor})
  1049. : super(key: key);
  1050. String left;
  1051. String right;
  1052. int leftColor;
  1053. int rightColor;
  1054. @override
  1055. Widget build(BuildContext context) {
  1056. return Container(
  1057. padding: EdgeInsets.only(
  1058. left: ScreenUtil().setWidth(15),
  1059. right: ScreenUtil().setWidth(15),
  1060. top: ScreenUtil().setWidth(10),
  1061. bottom: ScreenUtil().setWidth(10)),
  1062. decoration: BoxDecoration(
  1063. border: Border(
  1064. bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
  1065. ),
  1066. ),
  1067. child: Row(
  1068. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1069. children: <Widget>[
  1070. Text(
  1071. left,
  1072. style: TextStyle(
  1073. color: Color(leftColor),
  1074. // fontSize:ScreenUtil().setSp(14)
  1075. ),
  1076. textAlign: TextAlign.start,
  1077. ),
  1078. Text(
  1079. right,
  1080. style: TextStyle(
  1081. color: Color(rightColor),
  1082. // fontSize:ScreenUtil().setSp(14)
  1083. ),
  1084. textAlign: TextAlign.start,
  1085. ),
  1086. ]),
  1087. );
  1088. }
  1089. }
  1090. // 选择下拉
  1091. class ChiosePicker extends StatefulWidget {
  1092. ChiosePicker({
  1093. Key key,
  1094. this.range,
  1095. this.value,
  1096. this.label,
  1097. this.isMust: false,
  1098. this.onConfirm,
  1099. this.placeholder = '请选择',
  1100. }) : super(key: key);
  1101. final List range;
  1102. final String value;
  1103. final String label;
  1104. final bool isMust;
  1105. final String placeholder;
  1106. final Function(String, int) onConfirm;
  1107. @override
  1108. _ChiosePickerState createState() => _ChiosePickerState();
  1109. }
  1110. class _ChiosePickerState extends State<ChiosePicker> {
  1111. @override
  1112. initState() {
  1113. _vlaue = widget.value;
  1114. super.initState();
  1115. }
  1116. String _vlaue = '';
  1117. showPickerModal(BuildContext context) {
  1118. new Picker(
  1119. cancelText:"取消",
  1120. confirmText:"确认",
  1121. adapter: PickerDataAdapter<String>(
  1122. pickerdata: widget.range,
  1123. ),
  1124. changeToFirst: true,
  1125. hideHeader: false,
  1126. onConfirm: (Picker picker, List value) {
  1127. _vlaue = picker.getSelectedValues()[0];
  1128. widget.onConfirm(picker.getSelectedValues()[0], value[0]);
  1129. setState(() {});
  1130. },
  1131. ).showModal(this.context);
  1132. }
  1133. @override
  1134. Widget build(BuildContext context) {
  1135. double width = MediaQuery.of(context).size.width;
  1136. return InkWell(
  1137. onTap: () {
  1138. FocusScope.of(context).requestFocus(FocusNode());
  1139. showPickerModal(context);
  1140. },
  1141. child: Container(
  1142. padding: EdgeInsets.only(
  1143. top: ScreenUtil().setWidth(15),
  1144. bottom: ScreenUtil().setWidth(15),
  1145. ),
  1146. margin: EdgeInsets.only(left: ScreenUtil().setWidth(15)),
  1147. decoration: BoxDecoration(
  1148. border: Border(
  1149. bottom: BorderSide(width: 0.5, color: Colours.line),
  1150. ),
  1151. ),
  1152. child: Row(
  1153. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1154. children: <Widget>[
  1155. Text(
  1156. widget.label,
  1157. style: TextStyle(
  1158. // fontSize: ScreenUtil().setSp(14)
  1159. ),
  1160. textAlign: TextAlign.start,
  1161. ),
  1162. Offstage(
  1163. offstage: !widget.isMust,
  1164. child: Text(
  1165. "*",
  1166. style: TextStyle(color: Colors.red),
  1167. ),
  1168. ),
  1169. Expanded(flex: 1, child: Container()),
  1170. _vlaue==null || _vlaue.isEmpty
  1171. ? Container(
  1172. child: Row(
  1173. children: <Widget>[
  1174. Text(
  1175. widget.placeholder,
  1176. style: TextStyle(
  1177. color: Color(0xffcccccc),
  1178. // fontSize: ScreenUtil().setSp(14)
  1179. ),
  1180. textAlign: TextAlign.start,
  1181. ),
  1182. Container(
  1183. padding: EdgeInsets.only(top: 3),
  1184. child: Icon(
  1185. Icons.keyboard_arrow_right,
  1186. size: 20.0,
  1187. color: Color(0xffcccccc),
  1188. ),
  1189. ),
  1190. SizedBox(width: 10)
  1191. ],
  1192. ),
  1193. )
  1194. : Container(
  1195. padding: EdgeInsets.only(right: ScreenUtil().setWidth(15)),
  1196. child: Row(
  1197. children: <Widget>[
  1198. Text(
  1199. _vlaue,
  1200. style: TextStyle(
  1201. color: Color(0xff222222),
  1202. fontSize: ScreenUtil().setSp(14)),
  1203. textAlign: TextAlign.start,
  1204. ),
  1205. ],
  1206. ),
  1207. ),
  1208. ],
  1209. ),
  1210. ),
  1211. );
  1212. }
  1213. }