YSTravelling.dart 45 KB

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