YSHome.dart 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. import 'dart:convert';
  2. import 'package:cached_network_image/cached_network_image.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:shared_preferences/shared_preferences.dart';
  6. import 'package:ysairplane/code/YSCity.dart';
  7. import 'package:ysairplane/code/YSDoctorPlane.dart';
  8. import 'package:ysairplane/code/YSHelpPlane.dart';
  9. import 'package:ysairplane/code/YSHomeMsg.dart';
  10. import 'package:ysairplane/code/YSSearch.dart';
  11. import 'package:ysairplane/code/YSShortGoods.dart';
  12. import 'package:ysairplane/code/YSShortPlane.dart';
  13. import 'package:ysairplane/code/YSTravelling.dart';
  14. import 'package:ysairplane/tools/YSNetWorking.dart';
  15. import 'package:flutter_swiper/flutter_swiper.dart';
  16. import 'package:ysairplane/code/YSNews.dart';
  17. import 'package:ysairplane/tools/YSTools.dart';
  18. import 'YSContractPlane.dart';
  19. import 'YSSightseeingPlane.dart';
  20. class YSHome extends StatefulWidget {
  21. @override
  22. _YSHomeState createState() => _YSHomeState();
  23. }
  24. class _YSHomeState extends State<YSHome> with AutomaticKeepAliveClientMixin{
  25. @override
  26. bool get wantKeepAlive => true;
  27. List _banners = List();
  28. List _products = List();
  29. Map _advertising;
  30. String _city = '';
  31. List _dataArray = [];
  32. @override
  33. void initState() {
  34. Future.delayed(Duration(seconds: 0)).then((value){
  35. _getFeatureDisplayShowData();
  36. });
  37. super.initState();
  38. }
  39. @override
  40. Widget build(BuildContext context) {
  41. super.build(context);
  42. return Scaffold(
  43. backgroundColor: Colors.white,
  44. appBar: CupertinoNavigationBar(
  45. leading: GestureDetector(
  46. onTap: (){
  47. Navigator.of(context,rootNavigator: true).push(
  48. CupertinoPageRoute(
  49. builder: (context){
  50. return YSCity();
  51. }
  52. )
  53. ).then((value){
  54. if(value!=null){
  55. _city = value['display'];
  56. _getFeatureDisplayListData(_city);
  57. // _getFeatureDisplayListData();
  58. }
  59. });
  60. },
  61. child: Row(
  62. mainAxisSize: MainAxisSize.min,
  63. children: [
  64. Container(
  65. width: hsp(35*(_city.length>5?5:_city.length)),
  66. child: Text(_city,style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93)),overflow: TextOverflow.ellipsis,),
  67. ),
  68. Icon(Icons.keyboard_arrow_down,size: zsp(30),color: Color(0xFF8E8E93),)
  69. ],
  70. ),
  71. ),
  72. middle: GestureDetector(
  73. onTap: (){
  74. Navigator.of(context,rootNavigator: true).push(
  75. CupertinoPageRoute(
  76. builder: (context){
  77. return YSSearch();
  78. }
  79. )
  80. );
  81. },
  82. child: Container(
  83. height: hsp(66),
  84. padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
  85. decoration: BoxDecoration(
  86. color: Color(0xFFF0F0F1),
  87. borderRadius: BorderRadius.all(Radius.circular(5))
  88. ),
  89. child: Row(
  90. children: [
  91. Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
  92. Text(' 目的地·酒店·关键词',style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93),fontWeight: FontWeight.normal),)
  93. ],
  94. ),
  95. ),
  96. ),
  97. trailing: GestureDetector(
  98. onTap: (){
  99. Navigator.of(context,rootNavigator: true).push(
  100. CupertinoPageRoute(
  101. builder: (context){
  102. return YSHomeMsg();
  103. }
  104. )
  105. );
  106. },
  107. child: Container(
  108. height: hsp(45),
  109. width: wsp(45),
  110. child: Image.asset('lib/images/homeMsg.png'),
  111. ),
  112. ),
  113. border: Border.all(width: 0.5,color: Colors.white),
  114. ),
  115. body: Container(
  116. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-94,
  117. child: SingleChildScrollView(
  118. padding: EdgeInsets.all(0),
  119. child: Column(
  120. children: [
  121. Container(
  122. height: hsp(292),
  123. margin: EdgeInsets.all(hsp(24)),
  124. child: _banners.length>0?Swiper(
  125. itemBuilder: (BuildContext context, int index) {
  126. return CachedNetworkImage(
  127. imageUrl: '${_banners[index]['url']}',
  128. fit: BoxFit.fill,
  129. );
  130. },
  131. itemCount: _banners.length,
  132. scrollDirection: Axis.horizontal,
  133. loop: true,
  134. duration: 300,
  135. autoplay: true,
  136. onTap: (index) {
  137. debugPrint("点击了第:$index个");
  138. },
  139. pagination: SwiperPagination(
  140. alignment: Alignment.bottomCenter,
  141. builder: DotSwiperPaginationBuilder(
  142. color: Colors.white,
  143. activeColor: Colors.white,
  144. size: 5.0,
  145. activeSize: 10.0
  146. ),
  147. ),
  148. autoplayDisableOnInteraction : true,
  149. ):Container(),
  150. ),
  151. Container(
  152. margin: EdgeInsets.only(left: hsp(24),right: hsp(24),top: hsp(15),bottom: hsp(34)),
  153. height: hsp(350),
  154. child: GridView.builder(
  155. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  156. crossAxisCount: 5,
  157. crossAxisSpacing: wsp(51),
  158. mainAxisSpacing: hsp(36),
  159. childAspectRatio: 0.8
  160. ),
  161. itemBuilder: (context,index){
  162. return GestureDetector(
  163. onTap: (){
  164. Navigator.of(context,rootNavigator: true).push(
  165. CupertinoPageRoute(
  166. builder: (context){
  167. return _products[index]['target']==1?YSDoctorPlane():_products[index]['target']==2?YSHelpPlane():_products[index]['target']==3?YSShortGoods():
  168. _products[index]['target']==4?YSSightseeingPlane(type: planeType.marry,):_products[index]['target']==5?YSSightseeingPlane(type: planeType.sport,):_products[index]['target']==6?YSShortPlane():
  169. _products[index]['target']==7?YSTravelling():_products[index]['target']==8?YSContractPlane():_products[index]['target']==9?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
  170. }
  171. )
  172. );
  173. },
  174. child: Container(
  175. child: Column(
  176. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  177. children: [
  178. CachedNetworkImage(
  179. width: 40,
  180. height: 40,
  181. imageUrl: '${_products[index]['url']}',
  182. fit: BoxFit.fill
  183. ),
  184. Text('${_products[index]['name']}',style: TextStyle(fontSize: zsp(23),color: Color(0xFF34373A)),)
  185. ],
  186. ),
  187. ),
  188. );
  189. },
  190. itemCount: _products.length,
  191. padding: EdgeInsets.all(0),
  192. physics: NeverScrollableScrollPhysics(),
  193. ),
  194. ),
  195. if(_advertising!=null)Container(
  196. margin: EdgeInsets.only(left: hsp(24),right: hsp(24),bottom: hsp(24)),
  197. height: wsp(136),
  198. decoration: BoxDecoration(
  199. image: DecorationImage(
  200. image: NetworkImage('${_advertising['url']}'),
  201. fit: BoxFit.fill
  202. )
  203. ),
  204. ),
  205. Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),),
  206. ListView.separated(
  207. itemBuilder: (context,index){
  208. return _dataArray[index]['displayType']=='1'?Column(
  209. children: [
  210. Container(
  211. height: hsp(100),
  212. padding: EdgeInsets.all(hsp(24)),
  213. child: Row(
  214. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  215. children: [
  216. Row(
  217. children: [
  218. Container(
  219. height: hsp(36),
  220. width: wsp(5),
  221. color: Color(0xFF3676EC),
  222. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  223. ),
  224. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  225. ],
  226. ),
  227. Row(
  228. children: [
  229. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  230. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  231. ],
  232. )
  233. ],
  234. ),
  235. ),
  236. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  237. Container(
  238. height: hsp(387),
  239. margin: EdgeInsets.all(hsp(24)),
  240. child: Row(
  241. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  242. children: [
  243. Stack(
  244. children: [
  245. Container(
  246. height: hsp(387),
  247. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  248. decoration: BoxDecoration(
  249. borderRadius: BorderRadius.all(Radius.circular(5))
  250. ),
  251. child: ClipRRect(
  252. child: CachedNetworkImage(
  253. imageUrl: '${_dataArray[index]['dtAirTours'][0]['cover']}',
  254. fit: BoxFit.fill,
  255. ),
  256. borderRadius: BorderRadius.all(Radius.circular(5)),
  257. )
  258. ),
  259. Container(
  260. height: hsp(40),
  261. alignment: Alignment.centerLeft,
  262. child: Text('${_dataArray[index]['dtAirTours'][0]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  263. decoration: BoxDecoration(
  264. color: Colors.black26,
  265. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  266. ),
  267. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  268. )
  269. ],
  270. ),
  271. Column(
  272. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  273. children: [
  274. Stack(
  275. children: [
  276. Container(
  277. height: hsp(387)/2-wsp(6),
  278. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  279. decoration: BoxDecoration(
  280. borderRadius: BorderRadius.all(Radius.circular(5))
  281. ),
  282. child: ClipRRect(
  283. child: CachedNetworkImage(
  284. imageUrl: '${_dataArray[index]['dtAirTours'][1]['cover']}',
  285. fit: BoxFit.fill,
  286. ),
  287. borderRadius: BorderRadius.all(Radius.circular(5)),
  288. )
  289. ),
  290. Container(
  291. height: hsp(40),
  292. alignment: Alignment.centerLeft,
  293. child: Text('${_dataArray[index]['dtAirTours'][1]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  294. decoration: BoxDecoration(
  295. color: Color(0xFFEC6163),
  296. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  297. ),
  298. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  299. )
  300. ],
  301. ),
  302. Stack(
  303. children: [
  304. Container(
  305. height: hsp(387)/2-wsp(6),
  306. width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
  307. decoration: BoxDecoration(
  308. borderRadius: BorderRadius.all(Radius.circular(5))
  309. ),
  310. child: ClipRRect(
  311. child: CachedNetworkImage(
  312. imageUrl: '${_dataArray[index]['dtAirTours'][2]['cover']}',
  313. fit: BoxFit.fill,
  314. ),
  315. borderRadius: BorderRadius.all(Radius.circular(5)),
  316. )
  317. ),
  318. Container(
  319. height: hsp(40),
  320. alignment: Alignment.centerLeft,
  321. child: Text('${_dataArray[index]['dtAirTours'][2]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  322. decoration: BoxDecoration(
  323. color: Color(0xFFFB882E),
  324. borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
  325. ),
  326. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  327. )
  328. ],
  329. ),
  330. ],
  331. )
  332. ],
  333. ),
  334. ),
  335. ],
  336. ):_dataArray[index]['displayType']=='2'?Column(
  337. children: [
  338. Container(
  339. height: hsp(100),
  340. color: Colors.white,
  341. padding: EdgeInsets.all(hsp(24)),
  342. child: Row(
  343. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  344. children: [
  345. Row(
  346. children: [
  347. Container(
  348. height: hsp(36),
  349. width: wsp(5),
  350. color: Color(0xFF3676EC),
  351. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  352. ),
  353. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  354. ],
  355. ),
  356. Row(
  357. children: [
  358. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  359. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  360. ],
  361. )
  362. ],
  363. ),
  364. ),
  365. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  366. Container(
  367. height: hsp(420),
  368. margin: EdgeInsets.only(top: hsp(24),bottom: hsp(24),left: wsp(40),right: wsp(24)),
  369. child: Swiper(
  370. itemBuilder: (BuildContext context, int indexSub) {
  371. return Container(
  372. width: wsp(350),
  373. margin: EdgeInsets.only(bottom: hsp(20),top: hsp(10)),
  374. decoration: BoxDecoration(
  375. color: Colors.white,
  376. boxShadow: [
  377. BoxShadow(
  378. color: Color(0x1A000000),
  379. blurRadius: wsp(20),
  380. offset: Offset(1, 1),
  381. )
  382. ]
  383. ),
  384. child: Column(
  385. children: [
  386. Stack(
  387. children: [
  388. Container(
  389. height: hsp(200),
  390. width: wsp(350),
  391. decoration: BoxDecoration(
  392. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  393. ),
  394. child: ClipRRect(
  395. child: CachedNetworkImage(
  396. imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
  397. fit: BoxFit.fill,
  398. ),
  399. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  400. )
  401. ),
  402. Row(
  403. children: [
  404. Container(
  405. height: hsp(32),
  406. alignment: Alignment.centerLeft,
  407. child: Text('西安',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  408. decoration: BoxDecoration(
  409. color: Color(0xFFE9C68E),
  410. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  411. ),
  412. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  413. )
  414. ],
  415. )
  416. ],
  417. ),
  418. Container(
  419. decoration: BoxDecoration(
  420. borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
  421. ),
  422. child: Column(
  423. children: [
  424. Container(
  425. width: wsp(350),
  426. child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',
  427. style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Color(0xFF181818)),overflow: TextOverflow.ellipsis,maxLines: 2,),
  428. margin: EdgeInsets.only(top: hsp(20),bottom: hsp(15)),
  429. ),
  430. SingleChildScrollView(
  431. scrollDirection: Axis.horizontal,
  432. child: Row(
  433. children: [
  434. Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  435. Text('${_dataArray[index]['dtAirTours'][indexSub]['price']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  436. Text(' 元起',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  437. Text('${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}人体验',style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal),),
  438. ],
  439. ),
  440. )
  441. ],
  442. crossAxisAlignment: CrossAxisAlignment.start,
  443. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  444. ),
  445. padding: EdgeInsets.all(hsp(20)),
  446. )
  447. ],
  448. ),
  449. );
  450. },
  451. itemCount: (_dataArray[index]['dtAirTours']).length,
  452. scrollDirection: Axis.horizontal,
  453. loop: true,
  454. viewportFraction: 0.5,
  455. scale: 0.8,
  456. onTap: (index) {
  457. debugPrint("点击了第:$index个");
  458. },
  459. ),
  460. ),
  461. ],
  462. ):Column(
  463. children: [
  464. Container(
  465. height: hsp(100),
  466. color: Colors.white,
  467. padding: EdgeInsets.all(hsp(24)),
  468. child: Row(
  469. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  470. children: [
  471. Row(
  472. children: [
  473. Container(
  474. height: hsp(36),
  475. width: wsp(5),
  476. color: Color(0xFF3676EC),
  477. margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
  478. ),
  479. Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
  480. ],
  481. ),
  482. Row(
  483. children: [
  484. Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  485. Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
  486. ],
  487. )
  488. ],
  489. ),
  490. ),
  491. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
  492. Container(
  493. height: hsp(470),
  494. margin: EdgeInsets.all(hsp(24)),
  495. child: ListView.separated(
  496. scrollDirection: Axis.horizontal,
  497. itemBuilder: (context,indexSub){
  498. return Container(
  499. height: hsp(450),
  500. width: wsp(350),
  501. decoration: BoxDecoration(
  502. color: Colors.white,
  503. boxShadow: [
  504. BoxShadow(
  505. color: Color(0x1A000000),
  506. blurRadius: wsp(20),
  507. offset: Offset(1, 1),
  508. )
  509. ]
  510. ),
  511. child: Column(
  512. children: [
  513. Stack(
  514. children: [
  515. Container(
  516. height: hsp(210),
  517. width: wsp(330),
  518. decoration: BoxDecoration(
  519. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  520. ),
  521. child: ClipRRect(
  522. child: CachedNetworkImage(
  523. imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
  524. fit: BoxFit.fill,
  525. ),
  526. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
  527. )
  528. ),
  529. Row(
  530. children: [
  531. if(_dataArray[index]['dtAirTours'][indexSub]['isVip']==1)Container(
  532. height: hsp(32),
  533. width: wsp(59),
  534. decoration: BoxDecoration(
  535. color: Color(0xFFE9C68E),
  536. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  537. ),
  538. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  539. child: Image.asset('lib/images/vip.png'),
  540. )
  541. ],
  542. )
  543. ],
  544. ),
  545. Container(
  546. height: hsp(240),
  547. decoration: BoxDecoration(
  548. borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
  549. ),
  550. child: Column(
  551. children: [
  552. Container(
  553. width: wsp(330),
  554. child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',style: TextStyle(fontSize: zsp(32),fontWeight: FontWeight.bold,color: Color(0xFF181818)),overflow: TextOverflow.ellipsis,),
  555. ),
  556. Row(
  557. children: [
  558. Container(
  559. height: hsp(30),
  560. child: Row(
  561. children: [
  562. Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  563. Text(' ${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  564. ],
  565. ),
  566. color: Color(0xFF000000),
  567. padding: EdgeInsets.only(left: wsp(7),right: wsp(7)),
  568. ),
  569. Container(
  570. height: hsp(30),
  571. decoration: BoxDecoration(
  572. border: Border.all(color: Color(0xFF000000),width: 0.1)
  573. ),
  574. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  575. child: Text('座位${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFF565656)),),
  576. alignment: Alignment.center,
  577. )
  578. ],
  579. ),
  580. Text('${_dataArray[index]['dtAirTours'][indexSub]['flightTime']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFFA2A2A2)),),
  581. SingleChildScrollView(
  582. scrollDirection: Axis.horizontal,
  583. child: Row(
  584. children: [
  585. Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  586. Text('${_dataArray[index]['dtAirTours'][indexSub]['discountPrice']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  587. Text(' 元起/座',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
  588. Text(' ¥${_dataArray[index]['dtAirTours'][indexSub]['price']}元起/座',style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal),),
  589. ],
  590. ),
  591. )
  592. ],
  593. crossAxisAlignment: CrossAxisAlignment.start,
  594. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  595. ),
  596. padding: EdgeInsets.all(hsp(20)),
  597. )
  598. ],
  599. ),
  600. );
  601. },
  602. separatorBuilder: (context,index){
  603. return Container(
  604. color: Colors.white,
  605. width: wsp(14),
  606. );
  607. },
  608. itemCount: (_dataArray[index]['dtAirTours']).length,
  609. padding: EdgeInsets.only(bottom: hsp(20)),
  610. ),
  611. ),
  612. ],
  613. );
  614. },
  615. separatorBuilder: (context,index){
  616. return Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),);
  617. },
  618. itemCount: _dataArray.length,
  619. padding: EdgeInsets.all(0),
  620. shrinkWrap: true,
  621. physics: NeverScrollableScrollPhysics(),
  622. ),
  623. Container(
  624. height: 30,
  625. color: Color(0xFFF5F6F8),
  626. )
  627. ],
  628. ),
  629. ),
  630. ),
  631. );
  632. }
  633. _getFeatureDisplayShowData() async{
  634. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/featureDisplay/show',parameter: {},isLoading: false,isToken: false);
  635. if(dict!=null){
  636. _banners = dict['data']['banner'];
  637. _products = dict['data']['product'];
  638. _advertising = dict['data']['advertising'];
  639. SharedPreferences prefer = await SharedPreferences.getInstance();
  640. if(prefer.getString('cityHistory')!=null){
  641. String historyStr = prefer.getString('cityHistory');
  642. List historyList = jsonDecode(historyStr);
  643. _city = '${historyList[0]['display']}';
  644. }else{
  645. _city = '';
  646. }
  647. setState(() {
  648. });
  649. _getFeatureDisplayListData(_city);
  650. }
  651. }
  652. _getFeatureDisplayListData(String city) async {
  653. Map dict = await ysRequestHttp(context, type: requestType.get,api: '/app/applets/featureDisplay/list',parameter: {'city':city},isLoading: true,isToken: false);
  654. if (dict != null) {
  655. setState(() {
  656. _dataArray = dict['data'];
  657. });
  658. }
  659. }
  660. }