YSHome.dart 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. import 'dart:io';
  2. import 'package:dio/dio.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:jpush_flutter/jpush_flutter.dart';
  6. import 'package:open_file/open_file.dart';
  7. import 'package:package_info/package_info.dart';
  8. import 'package:path_provider/path_provider.dart';
  9. import 'package:permission_handler/permission_handler.dart';
  10. import 'package:shared_preferences/shared_preferences.dart';
  11. import 'package:ysairplane2/code/YSCity.dart';
  12. import 'package:ysairplane2/code/YSContractPlaneDetail.dart';
  13. import 'package:ysairplane2/code/YSDoctorPlane.dart';
  14. import 'package:ysairplane2/code/YSHelpPlane.dart';
  15. import 'package:ysairplane2/code/YSHomeMsg.dart';
  16. import 'package:ysairplane2/code/YSMarryPlane.dart';
  17. import 'package:ysairplane2/code/YSSearch.dart';
  18. import 'package:ysairplane2/code/YSShortDetail.dart';
  19. import 'package:ysairplane2/code/YSShortGoods.dart';
  20. import 'package:ysairplane2/code/YSShortPlane.dart';
  21. import 'package:ysairplane2/code/YSTravelling.dart';
  22. import 'package:ysairplane2/tools/YSNetWorking.dart';
  23. import 'package:flutter_swiper/flutter_swiper.dart';
  24. import 'package:ysairplane2/code/YSNews.dart';
  25. import 'package:ysairplane2/tools/YSTools.dart';
  26. import 'YSContractPlane.dart';
  27. import 'YSSightseeingPlane.dart';
  28. class YSHome extends StatefulWidget {
  29. @override
  30. _YSHomeState createState() => _YSHomeState();
  31. }
  32. class _YSHomeState extends State<YSHome> with AutomaticKeepAliveClientMixin{
  33. List _banners = [];
  34. List _products = [];
  35. Map _advertising;
  36. String _city = '';
  37. List _dataArray = [];
  38. SwiperController _swiperController = SwiperController();
  39. bool _isLocation = false;
  40. @override
  41. bool get wantKeepAlive => true;
  42. @override
  43. void initState() {
  44. Future.delayed(Duration(seconds: 0)).then((value){
  45. _getFeatureDisplayShowData();
  46. _getPrivacyAgreement();
  47. });
  48. super.initState();
  49. }
  50. _getPrivacyAgreement() async{
  51. if(Platform.isAndroid==true){
  52. _getPermission();
  53. }else{
  54. Future.delayed(Duration(seconds: 1)).then((value){
  55. setState(() {
  56. _isLocation = true;
  57. });
  58. });
  59. }
  60. // SharedPreferences prefer = await SharedPreferences.getInstance();
  61. // if(prefer.getBool('isRead')==true){
  62. // _getPermission();
  63. // }else{
  64. // var dict = await ysRequestHttp(context, type: requestType.get, api: '/app/applets/dic/dtDic/getPrivacyAgreement', parameter: {},isLoading: false);
  65. // if(dict!=null){
  66. // showAgreeAlert(context,title: '用户协议与隐私政策',content: dict['data']['value'],agree: (value){
  67. // if(value==false){
  68. // Navigator.pop(context);
  69. // }else{
  70. // Navigator.pop(context);
  71. // if(Platform.isAndroid){
  72. // _getPermission();
  73. // }else{
  74. // setState(() {
  75. // _isLocation = true;
  76. // });
  77. // }
  78. // }
  79. // });
  80. // }
  81. // }
  82. }
  83. @override
  84. void dispose() {
  85. _swiperController.dispose();
  86. super.dispose();
  87. }
  88. @override
  89. Widget build(BuildContext context) {
  90. super.build(context);
  91. return Scaffold(
  92. backgroundColor: Colors.white,
  93. appBar: CupertinoNavigationBar(
  94. leading: GestureDetector(
  95. onTap: (){
  96. Navigator.of(context,rootNavigator: true).push(
  97. CupertinoPageRoute(
  98. builder: (context){
  99. return YSCity(isHome: true);
  100. }
  101. )
  102. ).then((value) async{
  103. if(value!=null){
  104. _city = value['name'];
  105. SharedPreferences preferences = await SharedPreferences.getInstance();
  106. preferences.setString('location', _city);
  107. _getFeatureDisplayListData(_city);
  108. }
  109. });
  110. },
  111. child: Row(
  112. mainAxisSize: MainAxisSize.min,
  113. children: [
  114. Container(
  115. width: hsp(35*(_city.length>5?5:_city.length)),
  116. child: Text(_city,style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93)),overflow: TextOverflow.ellipsis,),
  117. ),
  118. Icon(Icons.keyboard_arrow_down,size: zsp(30),color: Color(0xFF8E8E93),)
  119. ],
  120. ),
  121. ),
  122. middle: GestureDetector(
  123. onTap: (){
  124. Navigator.of(context,rootNavigator: true).push(
  125. CupertinoPageRoute(
  126. builder: (context){
  127. return YSSearch();
  128. }
  129. )
  130. );
  131. },
  132. child: Container(
  133. height: hsp(66),
  134. padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
  135. decoration: BoxDecoration(
  136. color: Color(0xFFF0F0F1),
  137. borderRadius: BorderRadius.all(Radius.circular(5))
  138. ),
  139. child: Row(
  140. children: [
  141. Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
  142. Text(' 目的地·酒店·关键词',style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93),fontWeight: FontWeight.normal),)
  143. ],
  144. ),
  145. ),
  146. ),
  147. trailing: GestureDetector(
  148. onTap: (){
  149. Navigator.of(context,rootNavigator: true).push(
  150. CupertinoPageRoute(
  151. builder: (context){
  152. return YSHomeMsg();
  153. }
  154. )
  155. );
  156. },
  157. child: Container(
  158. height: hsp(40),
  159. width: wsp(40),
  160. child: Image.asset('lib/images/homeMsg.png'),
  161. ),
  162. ),
  163. border: Border.all(width: 0.5,color: Colors.white),
  164. ),
  165. body: Container(
  166. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-94,
  167. child: RefreshIndicator(
  168. onRefresh: _getFeatureDisplayShowData,
  169. child: SingleChildScrollView(
  170. padding: EdgeInsets.all(0),
  171. child: Column(
  172. children: [
  173. if(_isLocation==true)Container(
  174. height: 1,
  175. width: 1,
  176. child: platformView(
  177. platforms: (value) {
  178. value.setMethodCallHandler((call) {
  179. if(call.method == "city"){
  180. print('==================>>${call.arguments}');
  181. SharedPreferences.getInstance().then((value2){
  182. // if(value2.getString('cityHistory')!=null){
  183. // String historyStr = value2.getString('cityHistory');
  184. // List historyList = jsonDecode(historyStr);
  185. // _city = '${historyList[0]['name']}';
  186. // }else{
  187. // _city = call.arguments;
  188. // _city = _city.replaceAll('市', '');
  189. // }
  190. _city = call.arguments;
  191. _city = _city.replaceAll('市', '');
  192. value2.setString('location', _city);
  193. _getFeatureDisplayListData(_city);
  194. });
  195. }
  196. return;
  197. });
  198. },
  199. message: {'type':1}
  200. )
  201. ),
  202. if(_banners.length>0)banner(context, _banners),
  203. if(_products.length>0)products(context, _products),
  204. if(_advertising!=null)Container(
  205. margin: EdgeInsets.only(left: hsp(24),right: hsp(24),bottom: hsp(24)),
  206. child: ysImageLoad(
  207. imageUrl: '${_advertising['url']}',
  208. fit: BoxFit.fill,
  209. height: wsp(136),
  210. width: MediaQuery.of(context).size.width-hsp(48)
  211. ),
  212. ),
  213. Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),),
  214. ListView.separated(
  215. itemBuilder: (context,index){
  216. return _dataArray[index]['displayType']=='1'?Column(
  217. children: [
  218. Container(
  219. height: hsp(100),
  220. padding: EdgeInsets.only(left: hsp(24),right: hsp(24)),
  221. child: Row(
  222. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  223. children: [
  224. Row(
  225. children: [
  226. Container(
  227. height: hsp(36),
  228. width: wsp(5),
  229. color: Color(0xFF3676EC),
  230. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  231. ),
  232. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  233. ],
  234. ),
  235. GestureDetector(
  236. onTap: (){
  237. Navigator.of(context,rootNavigator: true).push(
  238. CupertinoPageRoute(
  239. builder: (context){
  240. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
  241. _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
  242. _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
  243. }
  244. )
  245. );
  246. },
  247. child: Row(
  248. children: [
  249. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  250. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  251. ],
  252. ),
  253. )
  254. ],
  255. ),
  256. ),
  257. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  258. Container(
  259. height: hsp(387),
  260. margin: EdgeInsets.all(hsp(24)),
  261. child: Row(
  262. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  263. children: [
  264. if(_dataArray[index]['dtAirTours'].length>0)GestureDetector(
  265. child: Stack(
  266. children: [
  267. Container(
  268. height: hsp(387),
  269. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  270. decoration: BoxDecoration(
  271. borderRadius: BorderRadius.all(Radius.circular(5))
  272. ),
  273. child: ClipRRect(
  274. child: ysImageLoad(
  275. imageUrl: '${_dataArray[index]['dtAirTours'][0]['cover']}',
  276. fit: BoxFit.fill,
  277. height: hsp(387),
  278. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  279. ),
  280. borderRadius: BorderRadius.all(Radius.circular(5)),
  281. )
  282. ),
  283. Container(
  284. height: hsp(40),
  285. alignment: Alignment.centerLeft,
  286. child: Text('${_dataArray[index]['dtAirTours'][0]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  287. decoration: BoxDecoration(
  288. color: Colors.black26,
  289. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  290. ),
  291. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  292. )
  293. ],
  294. ),
  295. onTap: (){
  296. Navigator.of(context,rootNavigator: true).push(
  297. CupertinoPageRoute(
  298. builder: (context){
  299. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
  300. YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
  301. [0]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][0]['id'],):
  302. _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][0]['id'],):_dataArray[index]['target']=='7'?
  303. YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][0]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
  304. marryId: _dataArray[index]['dtAirTours'][0]['id'],):YSNews();
  305. }
  306. )
  307. );
  308. },
  309. ),
  310. Column(
  311. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  312. children: [
  313. if(_dataArray[index]['dtAirTours'].length>1)GestureDetector(
  314. child: Stack(
  315. children: [
  316. Container(
  317. height: hsp(387)/2-wsp(6),
  318. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  319. decoration: BoxDecoration(
  320. borderRadius: BorderRadius.all(Radius.circular(5))
  321. ),
  322. child: ClipRRect(
  323. child: ysImageLoad(
  324. imageUrl: '${_dataArray[index]['dtAirTours'][1]['cover']}',
  325. fit: BoxFit.fill,
  326. height: hsp(387)/2-wsp(6),
  327. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  328. ),
  329. borderRadius: BorderRadius.all(Radius.circular(5)),
  330. )
  331. ),
  332. Container(
  333. height: hsp(40),
  334. alignment: Alignment.centerLeft,
  335. child: Text('${_dataArray[index]['dtAirTours'][1]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  336. decoration: BoxDecoration(
  337. color: Color(0xFFEC6163),
  338. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  339. ),
  340. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  341. )
  342. ],
  343. ),
  344. onTap: (){
  345. Navigator.of(context,rootNavigator: true).push(
  346. CupertinoPageRoute(
  347. builder: (context){
  348. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
  349. YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
  350. [1]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][1]['id'],):
  351. _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][1]['id'],):_dataArray[index]['target']=='7'?
  352. YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][1]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
  353. marryId: _dataArray[index]['dtAirTours'][1]['id'],):YSNews();
  354. }
  355. )
  356. );
  357. }
  358. ),
  359. if(_dataArray[index]['dtAirTours'].length>2)GestureDetector(
  360. child: Stack(
  361. children: [
  362. Container(
  363. height: hsp(387)/2-wsp(6),
  364. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  365. decoration: BoxDecoration(
  366. borderRadius: BorderRadius.all(Radius.circular(5))
  367. ),
  368. child: ClipRRect(
  369. child: ysImageLoad(
  370. imageUrl: '${_dataArray[index]['dtAirTours'][2]['cover']}',
  371. fit: BoxFit.fill,
  372. height: hsp(387)/2-wsp(6),
  373. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  374. ),
  375. borderRadius: BorderRadius.all(Radius.circular(5)),
  376. )
  377. ),
  378. Container(
  379. height: hsp(40),
  380. alignment: Alignment.centerLeft,
  381. child: Text('${_dataArray[index]['dtAirTours'][2]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  382. decoration: BoxDecoration(
  383. color: Color(0xFFFB882E),
  384. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  385. ),
  386. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  387. )
  388. ],
  389. ),
  390. onTap: (){
  391. Navigator.of(context,rootNavigator: true).push(
  392. CupertinoPageRoute(
  393. builder: (context){
  394. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
  395. YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
  396. [2]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type:_dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][2]['id'],):
  397. _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][2]['id'],):_dataArray[index]['target']=='7'?
  398. YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][2]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
  399. marryId: _dataArray[index]['dtAirTours'][2]['id'],):YSNews();
  400. }
  401. )
  402. );
  403. }
  404. ),
  405. ],
  406. )
  407. ],
  408. ),
  409. ),
  410. ],
  411. ):_dataArray[index]['displayType']=='2'?Column(
  412. children: [
  413. if((_dataArray[index]['dtAirTours']).length>0)Container(
  414. height: hsp(100),
  415. color: Colors.white,
  416. padding: EdgeInsets.only(left: hsp(24),right: hsp(24)),
  417. child: Row(
  418. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  419. children: [
  420. Row(
  421. children: [
  422. Container(
  423. height: hsp(36),
  424. width: wsp(5),
  425. color: Color(0xFF3676EC),
  426. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  427. ),
  428. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  429. ],
  430. ),
  431. GestureDetector(
  432. onTap: (){
  433. Navigator.of(context,rootNavigator: true).push(
  434. CupertinoPageRoute(
  435. builder: (context){
  436. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
  437. _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
  438. _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
  439. }
  440. )
  441. );
  442. },
  443. child: Row(
  444. children: [
  445. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  446. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  447. ],
  448. ),
  449. )
  450. ],
  451. ),
  452. ),
  453. if((_dataArray[index]['dtAirTours']).length>0)Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  454. if((_dataArray[index]['dtAirTours']).length>0)Container(
  455. height: hsp(420),
  456. margin: EdgeInsets.only(top: hsp(24),bottom: hsp(24),left: wsp(40),right: wsp(24)),
  457. child: Swiper(
  458. itemBuilder: (BuildContext context, int indexSub) {
  459. return GestureDetector(
  460. onTap: (){
  461. Navigator.of(context,rootNavigator: true).push(
  462. CupertinoPageRoute(
  463. builder: (context){
  464. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
  465. YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
  466. [indexSub]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):
  467. _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='7'?
  468. YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
  469. marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):YSNews();
  470. }
  471. )
  472. );
  473. },
  474. child: Container(
  475. width: wsp(350),
  476. margin: EdgeInsets.only(bottom: hsp(20),top: hsp(10)),
  477. decoration: BoxDecoration(
  478. color: Colors.white,
  479. boxShadow: [
  480. BoxShadow(
  481. color: Color(0x1A000000),
  482. blurRadius: wsp(20),
  483. offset: Offset(1, 1),
  484. )
  485. ]
  486. ),
  487. child: Column(
  488. children: [
  489. Stack(
  490. children: [
  491. Container(
  492. height: hsp(200),
  493. width: wsp(350),
  494. decoration: BoxDecoration(
  495. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  496. ),
  497. child: ClipRRect(
  498. child: ysImageLoad(
  499. imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
  500. fit: BoxFit.fill,
  501. height: hsp(200),
  502. width: wsp(350),
  503. ),
  504. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  505. )
  506. ),
  507. // Row(
  508. // children: [
  509. // Container(
  510. // height: hsp(32),
  511. // alignment: Alignment.centerLeft,
  512. // child: Text('西安',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  513. // decoration: BoxDecoration(
  514. // color: Color(0xFFE9C68E),
  515. // borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  516. // ),
  517. // padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  518. // )
  519. // ],
  520. // )
  521. ],
  522. ),
  523. Container(
  524. decoration: BoxDecoration(
  525. borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
  526. ),
  527. child: Column(
  528. children: [
  529. Container(
  530. width: wsp(350),
  531. child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',
  532. style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Color(0xFF181818)),
  533. overflow: TextOverflow.ellipsis,maxLines: 2,),
  534. margin: EdgeInsets.only(top: hsp(20),bottom: hsp(15)),
  535. ),
  536. SingleChildScrollView(
  537. scrollDirection: Axis.horizontal,
  538. child: Row(
  539. children: [
  540. Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  541. Text('${_dataArray[index]['dtAirTours'][indexSub]['price']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  542. Text(' 元起',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  543. Text(' ${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}人体验',style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal),),
  544. ],
  545. ),
  546. )
  547. ],
  548. crossAxisAlignment: CrossAxisAlignment.start,
  549. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  550. ),
  551. padding: EdgeInsets.all(hsp(10)),
  552. )
  553. ],
  554. ),
  555. ),
  556. );
  557. },
  558. itemCount: (_dataArray[index]['dtAirTours']).length,
  559. scrollDirection: Axis.horizontal,
  560. loop: true,
  561. viewportFraction: 0.5,
  562. scale: 0.8,
  563. onTap: (index) {
  564. debugPrint("点击了第:$index个");
  565. },
  566. ),
  567. ),
  568. ],
  569. ):Column(
  570. children: [
  571. if((_dataArray[index]['dtAirTours']).length>0)Container(
  572. height: hsp(100),
  573. color: Colors.white,
  574. padding: EdgeInsets.only(left: hsp(24),right: hsp(24)),
  575. child: Row(
  576. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  577. children: [
  578. Row(
  579. children: [
  580. Container(
  581. height: hsp(36),
  582. width: wsp(5),
  583. color: Color(0xFF3676EC),
  584. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  585. ),
  586. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  587. ],
  588. ),
  589. GestureDetector(
  590. onTap: (){
  591. Navigator.of(context,rootNavigator: true).push(
  592. CupertinoPageRoute(
  593. builder: (context){
  594. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
  595. _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
  596. _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
  597. }
  598. )
  599. );
  600. },
  601. child: Row(
  602. children: [
  603. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  604. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  605. ],
  606. ),
  607. )
  608. ],
  609. ),
  610. ),
  611. if((_dataArray[index]['dtAirTours']).length>0)Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  612. if((_dataArray[index]['dtAirTours']).length>0)Container(
  613. height: hsp(430),
  614. margin: EdgeInsets.all(hsp(24)),
  615. child: ListView.separated(
  616. scrollDirection: Axis.horizontal,
  617. itemBuilder: (context,indexSub){
  618. return GestureDetector(
  619. onTap: (){
  620. Navigator.of(context,rootNavigator: true).push(
  621. CupertinoPageRoute(
  622. builder: (context){
  623. return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
  624. YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
  625. [indexSub]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):
  626. _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='7'?
  627. YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
  628. marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):YSNews();
  629. }
  630. )
  631. );
  632. },
  633. child: Container(
  634. height: hsp(410),
  635. width: wsp(350),
  636. decoration: BoxDecoration(
  637. color: Colors.white,
  638. boxShadow: [
  639. BoxShadow(
  640. color: Color(0x1A000000),
  641. blurRadius: wsp(20),
  642. offset: Offset(1, 1),
  643. )
  644. ]
  645. ),
  646. child: Column(
  647. children: [
  648. Stack(
  649. children: [
  650. Container(
  651. height: hsp(210),
  652. width: wsp(330),
  653. decoration: BoxDecoration(
  654. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  655. ),
  656. child: ClipRRect(
  657. child: ysImageLoad(
  658. imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
  659. fit: BoxFit.fill,
  660. height: hsp(210),
  661. width: wsp(330),
  662. ),
  663. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  664. )
  665. ),
  666. Row(
  667. children: [
  668. if(_dataArray[index]['dtAirTours'][indexSub]['isVip']==1)Container(
  669. height: hsp(32),
  670. width: wsp(59),
  671. decoration: BoxDecoration(
  672. color: Color(0xFFE9C68E),
  673. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  674. ),
  675. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  676. child: Image.asset('lib/images/vip.png'),
  677. )
  678. ],
  679. )
  680. ],
  681. ),
  682. Container(
  683. height: hsp(200),
  684. decoration: BoxDecoration(
  685. borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
  686. ),
  687. child: Column(
  688. children: [
  689. Container(
  690. width: wsp(330),
  691. child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',style: TextStyle(fontSize: zsp(32),fontWeight: FontWeight.bold,color: Color(0xFF181818)),overflow: TextOverflow.ellipsis,),
  692. ),
  693. Row(
  694. children: [
  695. Container(
  696. height: hsp(30),
  697. child: Row(
  698. children: [
  699. Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  700. Text(' ${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  701. ],
  702. ),
  703. color: Color(0xFF000000),
  704. padding: EdgeInsets.only(left: wsp(7),right: wsp(7)),
  705. ),
  706. Container(
  707. height: hsp(30),
  708. decoration: BoxDecoration(
  709. border: Border.all(color: Color(0xFF000000),width: 0.1)
  710. ),
  711. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  712. child: Text('座位${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFF565656)),),
  713. alignment: Alignment.center,
  714. )
  715. ],
  716. ),
  717. //Text('${_dataArray[index]['dtAirTours'][indexSub]['flightTime']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFFA2A2A2)),),
  718. SingleChildScrollView(
  719. scrollDirection: Axis.horizontal,
  720. child: Row(
  721. children: [
  722. Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  723. Text('${_dataArray[index]['dtAirTours'][indexSub]['discountPrice']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  724. Text(' 元起/座 ',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  725. Text('¥${_dataArray[index]['dtAirTours'][indexSub]['price']}元起/座',
  726. style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal,decoration: TextDecoration.lineThrough),),
  727. ],
  728. ),
  729. )
  730. ],
  731. crossAxisAlignment: CrossAxisAlignment.start,
  732. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  733. ),
  734. padding: EdgeInsets.all(hsp(20)),
  735. )
  736. ],
  737. ),
  738. ),
  739. );
  740. },
  741. separatorBuilder: (context,index){
  742. return Container(
  743. color: Colors.white,
  744. width: wsp(14),
  745. );
  746. },
  747. itemCount: (_dataArray[index]['dtAirTours']).length,
  748. padding: EdgeInsets.only(bottom: hsp(20)),
  749. ),
  750. ),
  751. ],
  752. );
  753. },
  754. separatorBuilder: (context,index){
  755. return Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),);
  756. },
  757. itemCount: _dataArray.length,
  758. padding: EdgeInsets.all(0),
  759. shrinkWrap: true,
  760. physics: NeverScrollableScrollPhysics(),
  761. ),
  762. Container(
  763. height: 30,
  764. color: Color(0xFFF5F6F8),
  765. )
  766. ],
  767. ),
  768. ),
  769. ),
  770. ),
  771. );
  772. }
  773. Future<void> _getFeatureDisplayShowData() async{
  774. SharedPreferences prefer = await SharedPreferences.getInstance();
  775. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/featureDisplay/show',parameter: {},isLoading: false,isToken: false);
  776. if(dict!=null){
  777. String phoneStr = prefer.getString('phone');
  778. final JPush jpush = new JPush();
  779. if(phoneStr!=null)jpush.setAlias(phoneStr);
  780. _banners = dict['data']['banner'];
  781. _products = dict['data']['product'];
  782. _advertising = dict['data']['advertising'];
  783. _getFeatureDisplayListData(_city);
  784. }
  785. }
  786. _getPermission() async{
  787. if (await Permission.locationAlways.request().isGranted || await Permission.locationWhenInUse.request().isGranted) {
  788. _isLocation = true;
  789. }else{
  790. Map<Permission, PermissionStatus> statuses = await [
  791. Permission.location,
  792. Permission.locationAlways,
  793. ].request();
  794. if(statuses[Permission.location].isGranted||statuses[Permission.locationAlways].isGranted){
  795. _isLocation = true;
  796. }
  797. print('==============C ${statuses[Permission.location]}');
  798. }
  799. if(_isLocation){
  800. setState(() {});
  801. }
  802. }
  803. _getFeatureDisplayListData(String city) async {
  804. Map dict = await ysRequestHttp(context, type: requestType.get,api: '/app/applets/featureDisplay/list',parameter: {'city':city},isLoading: false,isToken: false);
  805. if (dict != null) {
  806. setState(() {
  807. _dataArray = dict['data'];
  808. });
  809. _getVersionData();
  810. }
  811. }
  812. _getVersionData() async {
  813. SharedPreferences prefer = await SharedPreferences.getInstance();
  814. if(prefer.getBool('isRead')==false)return;
  815. Map dict = await ysRequestHttp(context, type: requestType.get,api: '/app/applets/version/info',parameter: {},isLoading: false,isToken: false);
  816. if (dict != null) {
  817. if(dict['data']==null)return;
  818. PackageInfo packageInfo = await PackageInfo.fromPlatform();
  819. int version1 = int.parse(packageInfo.version.split('.').join(''));
  820. int version2 = int.parse('${dict['data']['versionNo']}'.split('.').join(''));
  821. if(version1<version2){
  822. var status = await Permission.storage.status;
  823. if (status.isGranted==false) {
  824. Map<Permission, PermissionStatus> statuses = await [Permission.storage].request();
  825. if(statuses[Permission.storage].isGranted==false){
  826. return;
  827. }
  828. }
  829. double progress = -1;
  830. showGeneralDialog(
  831. context: context,
  832. barrierDismissible:false,
  833. barrierLabel: '',
  834. transitionDuration: Duration(milliseconds: 200),
  835. pageBuilder: (BuildContext context, Animation<double> animation,
  836. Animation<double> secondaryAnimation) {
  837. return Center(
  838. child: StatefulBuilder(
  839. builder: (context,updateSet){
  840. return Container(
  841. height: hsp(800),
  842. width: MediaQuery.of(context).size.width-hsp(200),
  843. child: Column(
  844. children: [
  845. Stack(
  846. children: [
  847. Container(
  848. height: hsp(700),
  849. decoration: BoxDecoration(
  850. borderRadius: BorderRadius.all(Radius.circular(5)),
  851. image: DecorationImage(image: AssetImage('lib/images/组796.png'),fit: BoxFit.fill,)
  852. ),
  853. ),
  854. Container(
  855. margin: EdgeInsets.only(top: hsp(80),left: hsp(40)),
  856. child: Text('发现新版本',style: TextStyle(fontSize: zsp(40),color: Color(0xFFFEFDFD),decoration: TextDecoration.none)),
  857. ),
  858. Container(
  859. margin: EdgeInsets.only(top: hsp(145),left: hsp(40)),
  860. child: Text('${dict['data']['versionNo']}',style: TextStyle(fontSize: zsp(27),color: Color(0xFFFEFDFD),decoration: TextDecoration.none)),
  861. ),
  862. progress==-1?Column(
  863. children: [
  864. Container(
  865. margin: EdgeInsets.only(top: hsp(300)),
  866. height: hsp(250),
  867. width: MediaQuery.of(context).size.width,
  868. padding: EdgeInsets.only(left: hsp(50),right: hsp(50),top: hsp(30)),
  869. child: SingleChildScrollView(
  870. padding: EdgeInsets.all(0),
  871. child: Text('${dict['data']['content']}',style: TextStyle(fontSize: zsp(26),
  872. color: Color(0xFF555555),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
  873. ),
  874. ),
  875. GestureDetector(
  876. onTap: () async{
  877. PackageInfo app;
  878. PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
  879. app = packageInfo;
  880. });
  881. /// 创建存储文件
  882. Directory storageDir = await getExternalStorageDirectory();
  883. String storagePath = storageDir.path;
  884. File file = new File('$storagePath/${app.appName}v${dict['data']['versionNo']}.apk');
  885. if (!file.existsSync()) {
  886. file.createSync();
  887. }
  888. try {
  889. /// 发起下载请求
  890. Response response = await Dio().get('${dict['data']['address']}',options: Options(responseType: ResponseType.bytes,),
  891. onReceiveProgress: (count,total){
  892. if (total != -1) {
  893. progress = double.parse('${(count / total).toStringAsFixed(2)}');
  894. if(progress==1){
  895. String _apkFilePath = file.path;
  896. if (_apkFilePath.isEmpty) {
  897. print('make sure the apk file is set');
  898. return;
  899. }
  900. OpenFile.open(_apkFilePath);
  901. // InstallPlugin.installApk(_apkFilePath, app.packageName).then((result) {
  902. // print('install apk $result');
  903. // }).catchError((error) {
  904. // print('install apk error: $error');
  905. // });
  906. }
  907. updateSet(() {});
  908. }
  909. });
  910. file.writeAsBytesSync(response.data);
  911. } catch (e) {
  912. print(e);
  913. }
  914. // updateSet(() {
  915. // isUpdate = true;
  916. // });
  917. },
  918. child: Container(
  919. margin: EdgeInsets.only(top: hsp(50),left: hsp(20)),
  920. width: MediaQuery.of(context).size.width-hsp(340),
  921. height: hsp(70),
  922. decoration: BoxDecoration(
  923. color: Color(0xFF5792FF),
  924. borderRadius: BorderRadius.all(Radius.circular(50))
  925. ),
  926. alignment: Alignment.center,
  927. child: Text('立即更新',style: TextStyle(fontSize: zsp(33),color: Color(0xFFFEFDFD),decoration: TextDecoration.none),),
  928. ),
  929. )
  930. ],
  931. ):Column(
  932. children: [
  933. Container(
  934. margin: EdgeInsets.only(top: hsp(350),bottom: hsp(20)),
  935. height: hsp(250),
  936. width: MediaQuery.of(context).size.width,
  937. alignment: Alignment.center,
  938. child: Stack(
  939. children: [
  940. Container(
  941. height: hsp(170),
  942. width: hsp(170),
  943. child: CircularProgressIndicator(
  944. value: progress,
  945. backgroundColor: Color(0xFFF5F5F5),
  946. valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF4587FF)),
  947. strokeWidth: hsp(20),
  948. ),
  949. ),
  950. Container(
  951. height: hsp(170),
  952. width: hsp(170),
  953. alignment: Alignment.center,
  954. child: Text('${(progress*100).toStringAsFixed(1)}%',style: TextStyle(fontSize: zsp(30),color: Color(0xFF4587FF),
  955. decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
  956. ),
  957. ],
  958. ),
  959. ),
  960. Text('新版本正在努力的更新中,请稍等',style: TextStyle(fontSize: zsp(26),
  961. color: Color(0xFF999999),decoration: TextDecoration.none,fontWeight: FontWeight.normal),)
  962. ],
  963. ),
  964. ],
  965. ),
  966. if(progress==-1)GestureDetector(
  967. onTap: (){Navigator.pop(context);},
  968. child: Container(
  969. height: hsp(50),
  970. width: hsp(50),
  971. child: Image.asset('lib/images/关闭.png'),
  972. margin: EdgeInsets.only(top: hsp(50)),
  973. ),
  974. )
  975. ],
  976. ),
  977. );
  978. },
  979. ),
  980. );
  981. }
  982. );
  983. }
  984. }
  985. }
  986. }
  987. banner(BuildContext context, List array) {
  988. SwiperController _swiperController = SwiperController();
  989. Future<List> _future = Future.value(array);
  990. return ysFutureWidge(
  991. net: _future,
  992. data: (value){
  993. return Container(
  994. height: hsp(292),
  995. margin: EdgeInsets.all(hsp(24)),
  996. child: Swiper(
  997. itemBuilder: (BuildContext context, int index) {
  998. return ysImageLoad(
  999. imageUrl: '${value.data[index]['url']}',
  1000. fit: BoxFit.fill,
  1001. height: hsp(292),
  1002. width: MediaQuery.of(context).size.width-hsp(48)
  1003. );
  1004. },
  1005. itemCount: value.data.length,
  1006. scrollDirection: Axis.horizontal,
  1007. loop: true,
  1008. duration: 300,
  1009. autoplay: true,
  1010. onTap: (index) {
  1011. Navigator.of(context,rootNavigator: true).push(
  1012. CupertinoPageRoute(
  1013. builder: (context){
  1014. return value.data[index]['target']==1?YSDoctorPlane():value.data[index]['target']==2?YSHelpPlane():value.data[index]['target']==3?
  1015. YSShortGoods():value.data[index]['target']==4?YSMarryPlane(type: value.data[index]['target'],marryId: value.data[index]['targerId'],):value.data[index]['target']==5?
  1016. YSMarryPlane(type: value.data[index]['target'],marryId: value.data[index]['targerId'],):
  1017. value.data[index]['target']==6?YSShortDetail(shortId: value.data[index]['targerId'],):value.data[index]['target']==7?
  1018. YSTravelling():value.data[index]['target']==8?YSContractPlaneDetail(contractId: value.data[index]['targerId'],):value.data[index]['target']==9?YSMarryPlane(type: value.data[index]['target'],
  1019. marryId: value.data[index]['targerId'],):YSNews();
  1020. }
  1021. )
  1022. );
  1023. },
  1024. pagination: SwiperPagination(
  1025. alignment: Alignment.bottomCenter,
  1026. builder: DotSwiperPaginationBuilder(
  1027. color: Colors.white,
  1028. activeColor: Colors.white,
  1029. size: 5.0,
  1030. activeSize: 10.0
  1031. ),
  1032. ),
  1033. autoplayDisableOnInteraction : true,
  1034. controller: _swiperController,
  1035. ),
  1036. );
  1037. }
  1038. );
  1039. }
  1040. products(BuildContext context, List array) {
  1041. Future<List> _future = Future.value(array);
  1042. return ysFutureWidge(
  1043. net: _future,
  1044. data: (value){
  1045. return Container(
  1046. margin: EdgeInsets.only(left: hsp(24),right: hsp(24),top: hsp(15),bottom: hsp(30)),
  1047. child: GridView.builder(
  1048. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  1049. crossAxisCount: 5,
  1050. crossAxisSpacing: wsp(51),
  1051. mainAxisSpacing: hsp(36),
  1052. childAspectRatio: 0.75
  1053. ),
  1054. itemBuilder: (context,index){
  1055. return GestureDetector(
  1056. onTap: (){
  1057. Navigator.of(context,rootNavigator: true).push(
  1058. CupertinoPageRoute(
  1059. builder: (context){
  1060. return value.data[index]['target']==1?YSDoctorPlane():value.data[index]['target']==2?YSHelpPlane():value.data[index]['target']==3?YSShortGoods():
  1061. value.data[index]['target']==4?YSSightseeingPlane(type: planeType.marry,):value.data[index]['target']==5?YSSightseeingPlane(type: planeType.sport,):value.data[index]['target']==6?YSShortPlane():
  1062. value.data[index]['target']==7?YSTravelling():value.data[index]['target']==8?YSContractPlane():value.data[index]['target']==9?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
  1063. }
  1064. )
  1065. );
  1066. },
  1067. child: Container(
  1068. child: Column(
  1069. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1070. children: [
  1071. ysImageLoad(
  1072. width: 40,
  1073. height: 40,
  1074. imageUrl: '${value.data[index]['url']}',
  1075. fit: BoxFit.fill
  1076. ),
  1077. Text('${value.data[index]['name']}',style: TextStyle(fontSize: zsp(23),color: Color(0xFF34373A)),)
  1078. ],
  1079. ),
  1080. ),
  1081. );
  1082. },
  1083. itemCount: value.data.length,
  1084. padding: EdgeInsets.all(0),
  1085. physics: NeverScrollableScrollPhysics(),
  1086. shrinkWrap: true,
  1087. ),
  1088. );
  1089. }
  1090. );
  1091. }