YSTravelling.dart 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane/code/YSChooseLocation.dart';
  4. import 'package:ysairplane/code/YSChoosePlane.dart';
  5. import 'package:ysairplane/code/YSOrderOne.dart';
  6. import 'package:ysairplane/code/YSOrderTwo.dart';
  7. import 'package:ysairplane/code/YSPay.dart';
  8. import 'package:ysairplane/tools/YSNetWorking.dart';
  9. import 'package:ysairplane/tools/YSTools.dart';
  10. import 'YSCity.dart';
  11. class YSTravelling extends StatefulWidget {
  12. @override
  13. _YSTravellingState createState() => _YSTravellingState();
  14. }
  15. class _YSTravellingState extends State<YSTravelling> {
  16. int _type = 1;
  17. int _typeSub = 1;
  18. Map _msgDict;
  19. List _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  20. List _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  21. List _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  22. String _numStr;
  23. Map _planeType;
  24. @override
  25. void initState() {
  26. Future.delayed(Duration(seconds: 0)).then((value){
  27. _getBackImageData();
  28. });
  29. super.initState();
  30. }
  31. @override
  32. Widget build(BuildContext context) {
  33. return Scaffold(
  34. backgroundColor: Color(0xFFF1F2F4),
  35. body: SingleChildScrollView(
  36. child: Stack(
  37. children: [
  38. Container(
  39. height: MediaQuery.of(context).padding.top+hsp(380),
  40. width: MediaQuery.of(context).size.width,
  41. child: Image(
  42. image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['background']}'),
  43. fit: BoxFit.fill,
  44. ),
  45. ),
  46. GestureDetector(
  47. onTap: (){Navigator.pop(context);},
  48. child: Container(
  49. margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(30)),
  50. child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Colors.white,),
  51. ),
  52. ),
  53. if(_msgDict!=null)Container(
  54. margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(130),right: wsp(32)),
  55. width: MediaQuery.of(context).size.width-wsp(64),
  56. alignment: Alignment.center,
  57. child: Text('${_msgDict['name']}',style: TextStyle(fontSize: zsp(40),color: Colors.white,fontWeight: FontWeight.bold),)
  58. ),
  59. if(_msgDict!=null)Container(
  60. margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(200),right: wsp(32)),
  61. width: MediaQuery.of(context).size.width-wsp(64),
  62. alignment: Alignment.center,
  63. child: Text('${_msgDict['subtitle']}',style: TextStyle(fontSize: zsp(28),color: Colors.white.withOpacity(0.6)),)
  64. ),
  65. Container(
  66. width: MediaQuery.of(context).size.width-wsp(60),
  67. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(300),left: wsp(30),bottom: hsp(40)),
  68. decoration: BoxDecoration(
  69. borderRadius: BorderRadius.all(Radius.circular(10)),
  70. color: Colors.white,
  71. ),
  72. child: Column(
  73. children: [
  74. Row(
  75. children: [
  76. GestureDetector(
  77. onTap: (){
  78. _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  79. _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  80. _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  81. setState(() {
  82. _type = 1;
  83. });
  84. },
  85. child: Container(
  86. height: hsp(100),
  87. width: (MediaQuery.of(context).size.width-wsp(64))/2,
  88. padding: EdgeInsets.only(top: hsp(30)),
  89. decoration: BoxDecoration(
  90. color: _type==1?Colors.white:Color(0xFFF1F2F3),
  91. borderRadius: BorderRadius.only(topLeft: Radius.circular(10))
  92. ),
  93. child: Column(
  94. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  95. children: [
  96. Text('商旅机',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),),
  97. Container(
  98. height: hsp(6),
  99. width: wsp(66),
  100. color: _type==1?Color(0xFF007EFF):Colors.transparent,
  101. )
  102. ],
  103. ),
  104. ),
  105. ),
  106. GestureDetector(
  107. onTap: (){
  108. _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  109. _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  110. _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}];
  111. setState(() {
  112. _type = 2;
  113. });
  114. },
  115. child: Container(
  116. height: hsp(100),
  117. width: (MediaQuery.of(context).size.width-wsp(64))/2,
  118. padding: EdgeInsets.only(top: hsp(30)),
  119. decoration: BoxDecoration(
  120. color: _type==2?Colors.white:Color(0xFFF1F2F3),
  121. borderRadius: BorderRadius.only(topRight: Radius.circular(10))
  122. ),
  123. child: Column(
  124. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  125. children: [
  126. Text('直升机',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),),
  127. Container(
  128. height: hsp(6),
  129. width: wsp(66),
  130. color: _type==2?Color(0xFF007EFF):Colors.transparent,
  131. )
  132. ],
  133. ),
  134. ),
  135. )
  136. ],
  137. ),
  138. Container(
  139. margin: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(40),bottom: hsp(10)),
  140. padding: EdgeInsets.only(left: wsp(2),right: wsp(2)),
  141. height: hsp(80),
  142. decoration: BoxDecoration(
  143. color: Color(0xFFF1F2F3),
  144. borderRadius: BorderRadius.all(Radius.circular(5))
  145. ),
  146. child: Row(
  147. children: [
  148. GestureDetector(
  149. onTap: (){
  150. setState(() {
  151. _typeSub = 1;
  152. });
  153. },
  154. child: Container(
  155. height: hsp(74),
  156. width: (MediaQuery.of(context).size.width-wsp(144))/3,
  157. decoration: BoxDecoration(
  158. color: _typeSub==1?Colors.white:Colors.transparent,
  159. borderRadius: BorderRadius.all(Radius.circular(5))
  160. ),
  161. alignment: Alignment.center,
  162. child: Text('单程',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==1?FontWeight.bold:FontWeight.normal,color: Colors.black),),
  163. ),
  164. ),
  165. GestureDetector(
  166. onTap: (){
  167. setState(() {
  168. _typeSub = 2;
  169. });
  170. },
  171. child: Container(
  172. height: hsp(74),
  173. width: (MediaQuery.of(context).size.width-wsp(144))/3,
  174. decoration: BoxDecoration(
  175. color: _typeSub==2?Colors.white:Colors.transparent,
  176. borderRadius: BorderRadius.all(Radius.circular(5))
  177. ),
  178. alignment: Alignment.center,
  179. child: Text('往返',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==2?FontWeight.bold:FontWeight.normal,color: Colors.black),),
  180. ),
  181. ),
  182. GestureDetector(
  183. onTap: (){
  184. setState(() {
  185. _typeSub = 3;
  186. });
  187. },
  188. child: Container(
  189. height: hsp(74),
  190. width: (MediaQuery.of(context).size.width-wsp(144))/3,
  191. decoration: BoxDecoration(
  192. color: _typeSub==3?Colors.white:Colors.transparent,
  193. borderRadius: BorderRadius.all(Radius.circular(5))
  194. ),
  195. alignment: Alignment.center,
  196. child: Text('多程',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==3?FontWeight.bold:FontWeight.normal,color: Colors.black),),
  197. ),
  198. ),
  199. ],
  200. ),
  201. ),
  202. ListView.separated(
  203. shrinkWrap: true,
  204. itemBuilder: (context,index){
  205. return Container(
  206. child: Column(
  207. children: [
  208. if(_typeSub==3)Container(
  209. padding: EdgeInsets.only(right: wsp(32),top: wsp(30),bottom: wsp(10)),
  210. child: Row(
  211. children: [
  212. Container(
  213. height: hsp(40),
  214. alignment: Alignment.center,
  215. child: Text('${index+1}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  216. padding: EdgeInsets.only(left: wsp(20),right: wsp(20)),
  217. margin: EdgeInsets.only(right: wsp(30)),
  218. decoration: BoxDecoration(
  219. color: Color(0xFF007EFF),
  220. borderRadius: BorderRadius.only(topRight: Radius.circular(3),bottomRight: Radius.circular(8))
  221. ),
  222. ),
  223. ],
  224. ),
  225. ),
  226. Container(
  227. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  228. child: _type==1?Column(
  229. children: [
  230. Row(
  231. children: [
  232. GestureDetector(
  233. child: Container(
  234. child: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isNotEmpty?
  235. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['display']:'请选择出发地'}',
  236. style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  237. width: (MediaQuery.of(context).size.width-hsp(210))/2,
  238. alignment: Alignment.centerLeft,
  239. ),
  240. onTap: (){
  241. Navigator.of(context,rootNavigator: true).push(
  242. CupertinoPageRoute(
  243. builder: (context){
  244. return _type==1?YSCity():YSChooseLocation();
  245. }
  246. )
  247. ).then((value){
  248. if(value!=null){
  249. setState(() {
  250. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'] = value;
  251. });
  252. // _getFeatureDisplayListData();
  253. }
  254. });
  255. },
  256. ),
  257. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  258. GestureDetector(
  259. child: Container(
  260. child: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isNotEmpty?
  261. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['display']:'请选择目的地'}',
  262. style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  263. width: (MediaQuery.of(context).size.width-hsp(210))/2,
  264. alignment: Alignment.centerRight,
  265. ),
  266. onTap: (){
  267. Navigator.of(context,rootNavigator: true).push(
  268. CupertinoPageRoute(
  269. builder: (context){
  270. return YSCity();
  271. }
  272. )
  273. ).then((value){
  274. if(value!=null){
  275. setState(() {
  276. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'] = value;
  277. });
  278. // _getFeatureDisplayListData();
  279. }
  280. });
  281. },
  282. ),
  283. ],
  284. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  285. ),
  286. Row(
  287. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  288. children: [
  289. Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isNotEmpty?
  290. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['airplanename']:''}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  291. Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isNotEmpty?
  292. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['airplanename']:''}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  293. ],
  294. )
  295. ],
  296. ): Container(
  297. width: MediaQuery.of(context).size.width-hsp(100),
  298. child: ListView.builder(
  299. itemBuilder: (context,indexSub){
  300. return GestureDetector(
  301. onTap: (){
  302. Navigator.of(context,rootNavigator: true).push(
  303. CupertinoPageRoute(
  304. builder: (context){
  305. return YSChooseLocation();
  306. }
  307. )
  308. ).then((value){
  309. if(value!=null){
  310. print(value);
  311. setState(() {
  312. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity'] = value;
  313. });
  314. // _getFeatureDisplayListData();
  315. }
  316. });
  317. },
  318. child: Row(
  319. crossAxisAlignment: CrossAxisAlignment.start,
  320. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  321. children: [
  322. Row(
  323. crossAxisAlignment: CrossAxisAlignment.start,
  324. children: [
  325. Column(
  326. children: [
  327. Container(
  328. height: hsp(30),
  329. width: hsp(30),
  330. decoration: BoxDecoration(
  331. color: Colors.white,
  332. borderRadius: BorderRadius.all(Radius.circular(50)),
  333. border: Border.all(color: indexSub%2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
  334. ),
  335. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(7)),
  336. ),
  337. if(indexSub<1)Container(
  338. height: hsp(30),
  339. width: hsp(5),
  340. color: Color(0xFFCACAD4),
  341. )
  342. ],
  343. ),
  344. Container(
  345. child: RichText(
  346. text: TextSpan(
  347. text: '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity'].isNotEmpty?
  348. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity']['display']:'${indexSub==0?'请选择出发地':'请选择目的地'}'}',
  349. style: TextStyle(color: Color(0xFF000000),fontSize: hsp(30),fontWeight: FontWeight.bold),
  350. children: [
  351. ]
  352. ),
  353. ),
  354. margin: EdgeInsets.only(left: wsp(10),top: hsp(5)),
  355. )
  356. ],
  357. ),
  358. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  359. ],
  360. ),
  361. );
  362. },
  363. itemCount: 2,
  364. shrinkWrap: true,
  365. physics: NeverScrollableScrollPhysics(),
  366. padding: EdgeInsets.all(0),
  367. ),
  368. ),
  369. ),
  370. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  371. Container(
  372. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  373. child: Row(
  374. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  375. children: [
  376. Column(
  377. children: [
  378. Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  379. GestureDetector(
  380. onTap: (){
  381. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isEmpty){
  382. ysFlutterToast(context, '请选择出发地');
  383. return;
  384. }
  385. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isEmpty){
  386. ysFlutterToast(context, '请选择目的地');
  387. return;
  388. }
  389. showModalBottomSheet(
  390. context: context,
  391. builder: (context){
  392. return YSDatePicker(
  393. choose: (value){
  394. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'] = value;
  395. _getDate(index);
  396. },
  397. );
  398. }
  399. );
  400. },
  401. behavior: HitTestBehavior.opaque,
  402. child: RichText(
  403. text: TextSpan(
  404. text: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'].isNotEmpty?
  405. '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime']}':'请选择出发时间',
  406. style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Colors.black),
  407. children: [
  408. // TextSpan(
  409. // text: '今天',
  410. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  411. // )
  412. ]
  413. ),
  414. ),
  415. )
  416. ],
  417. crossAxisAlignment: CrossAxisAlignment.start,
  418. ),
  419. Column(
  420. children: [
  421. Text((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'].isNotEmpty?'到达':'',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  422. RichText(
  423. text: TextSpan(
  424. text: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'].isNotEmpty?
  425. '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime']}':'',
  426. style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Colors.black),
  427. children: [
  428. // TextSpan(
  429. // text: '今天',
  430. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  431. // )
  432. ]
  433. ),
  434. )
  435. ],
  436. crossAxisAlignment: CrossAxisAlignment.start,
  437. ),
  438. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  439. ],
  440. ),
  441. ),
  442. ],
  443. ),
  444. );
  445. },
  446. separatorBuilder: (context,index){
  447. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),);
  448. },
  449. itemCount: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length,
  450. padding: EdgeInsets.all(0),
  451. physics: NeverScrollableScrollPhysics(),
  452. ),
  453. if(_typeSub==3)Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  454. if(_typeSub==3)GestureDetector(
  455. onTap: (){
  456. for(int i = 0;i<(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length;i++){
  457. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startCity'].length==0){
  458. ysFlutterToast(context, '请完善出发地');
  459. return;
  460. }
  461. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endCity'].length==0){
  462. ysFlutterToast(context, '请完善目的地');
  463. return;
  464. }
  465. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startTime'].length==0){
  466. ysFlutterToast(context, '请完善出发时间');
  467. return;
  468. }
  469. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endTime'].length==0){
  470. ysFlutterToast(context, '请完善到达时间');
  471. return;
  472. }
  473. }
  474. setState(() {
  475. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)
  476. .add({'startCity':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length-1]['endCity'],'endCity':{},'startTime':'','endTime':''});
  477. });
  478. },
  479. behavior: HitTestBehavior.opaque,
  480. child: Container(
  481. padding: EdgeInsets.only(right: wsp(32),top: wsp(32),bottom: wsp(32)),
  482. child: Row(
  483. children: [
  484. Container(
  485. height: hsp(40),
  486. alignment: Alignment.center,
  487. child: Text('添加',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
  488. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  489. margin: EdgeInsets.only(right: wsp(30)),
  490. decoration: BoxDecoration(
  491. color: Color(0xFF007EFF),
  492. borderRadius: BorderRadius.only(topRight: Radius.circular(3),bottomRight: Radius.circular(8))
  493. ),
  494. ),
  495. Text('增加行程',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),),
  496. ],
  497. ),
  498. ),
  499. ),
  500. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  501. GestureDetector(
  502. onTap: (){
  503. showModalBottomSheet(
  504. context: context,
  505. builder: (context){
  506. return YSPicker(
  507. dataArray: [for(int i=0;i<30;i++){'title':'${i+1}'}],
  508. title: 'title',
  509. choose: (value){
  510. setState(() {
  511. _numStr = value['title'];
  512. });
  513. },
  514. );
  515. }
  516. );
  517. },
  518. behavior: HitTestBehavior.opaque,
  519. child: Container(
  520. padding: EdgeInsets.all(wsp(32)),
  521. child: Row(
  522. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  523. children: [
  524. Text(_numStr==null?'请选择出行人数':'$_numStr人出行',style: TextStyle(fontSize: zsp(36),color: Colors.black),),
  525. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  526. ],
  527. ),
  528. ),
  529. ),
  530. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  531. GestureDetector(
  532. onTap: (){
  533. Navigator.of(context).push(
  534. CupertinoPageRoute(
  535. builder: (context){
  536. return YSChoosePlane(type: _type,);
  537. }
  538. )
  539. ).then((value){
  540. if(value!=null){
  541. setState(() {
  542. _planeType = value;
  543. });
  544. }
  545. });
  546. },
  547. behavior: HitTestBehavior.opaque,
  548. child: Container(
  549. padding: EdgeInsets.all(wsp(32)),
  550. child: Row(
  551. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  552. children: [
  553. Text(_planeType==null?'飞机类型':'${_planeType['partnerName']}',style: TextStyle(fontSize: zsp(36),color: Colors.black),),
  554. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  555. ],
  556. ),
  557. ),
  558. ),
  559. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  560. GestureDetector(
  561. onTap: (){
  562. if(_planeType==null){
  563. ysFlutterToast(context, '请选择飞机类型');
  564. return;
  565. }
  566. if(_numStr==null){
  567. ysFlutterToast(context, '请选择出行人数');
  568. return;
  569. }
  570. for(int i = 0;i<(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length;i++){
  571. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startCity'].length==0){
  572. ysFlutterToast(context, '请完善出发地');
  573. return;
  574. }
  575. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endCity'].length==0){
  576. ysFlutterToast(context, '请完善目的地');
  577. return;
  578. }
  579. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startTime'].length==0){
  580. ysFlutterToast(context, '请完善出发时间');
  581. return;
  582. }
  583. if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endTime'].length==0){
  584. ysFlutterToast(context, '请完善到达时间');
  585. return;
  586. }
  587. }
  588. _postPlaneOrderData();
  589. },
  590. child: Container(
  591. width: MediaQuery.of(context).size.width-wsp(64)-hsp(64),
  592. margin: EdgeInsets.all(hsp(32)),
  593. height: hsp(100),
  594. decoration: BoxDecoration(
  595. color: Color(0xFF007EFF),
  596. borderRadius: BorderRadius.all(Radius.circular(5))
  597. ),
  598. alignment: Alignment.center,
  599. child: Text('一键召唤公务机',style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontSize: zsp(36)),),
  600. ),
  601. )
  602. ],
  603. ),
  604. )
  605. ],
  606. ),
  607. ),
  608. );
  609. }
  610. _getBackImageData() async{
  611. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/wallconfigure/get',parameter: {'type':7},isLoading: false,isToken: false);
  612. if(dict!=null){
  613. setState(() {
  614. _msgDict = dict['data'];
  615. });
  616. }
  617. }
  618. _getDate(int index) async{
  619. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/preferential/caculationHour',parameter: {'timeSetout':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'],
  620. 'airportidSetout':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['id'],
  621. 'airportidArrive':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['id']},isLoading: false,isToken: false);
  622. if(dict!=null){
  623. setState(() {
  624. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'] = dict['data'];
  625. });
  626. }
  627. }
  628. _postPlaneOrderData() async{
  629. print((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3));
  630. Map requestDict = {};
  631. requestDict['type'] = 7;
  632. requestDict['airplaneid'] = _planeType['id'];
  633. requestDict['Itinerary'] = _typeSub;
  634. requestDict['travelersNumber'] = _numStr;
  635. requestDict['charterType'] = _type;
  636. List array = [];
  637. int i = 0;
  638. (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).forEach((element) {
  639. i++;
  640. Map itineraries = {};
  641. if(_type==1){
  642. itineraries['airportidSetout'] = element['startCity']['id'];
  643. itineraries['airportidArrive'] = element['endCity']['id'];
  644. }else{
  645. itineraries['locationSetout'] = element['startCity']['location'];
  646. itineraries['locationArrive'] = element['endCity']['location'];
  647. itineraries['setout'] = element['startCity']['display'];
  648. itineraries['arrive'] = element['endCity']['display'];
  649. }
  650. itineraries['timeSetout'] = '${element['startTime']}:00';
  651. itineraries['timeArrive'] = '${element['endTime']}:00';
  652. itineraries['queue'] = i;
  653. array.add(itineraries);
  654. });
  655. requestDict['itineraries'] = array;
  656. Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/preferential/Grayson',parameter: requestDict,isLoading: true,isToken: true);
  657. if(dict!=null){
  658. Navigator.of(context).push(
  659. CupertinoPageRoute(
  660. builder: (context){
  661. return YSOrderOne(msgDict: _msgDict,orderDict: requestDict,confirmDict: dict['data']);
  662. }
  663. )
  664. );
  665. }
  666. }
  667. }