YSDoctorPlane.dart 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:url_launcher/url_launcher.dart';
  4. import 'package:ysairplane/tools/YSNetWorking.dart';
  5. import 'package:ysairplane/tools/YSTools.dart';
  6. import 'YSCity.dart';
  7. import 'YSPay.dart';
  8. class YSDoctorPlane extends StatefulWidget {
  9. @override
  10. _YSDoctorPlaneState createState() => _YSDoctorPlaneState();
  11. }
  12. class _YSDoctorPlaneState extends State<YSDoctorPlane> {
  13. bool _isDetail = false;
  14. bool _isOrder = false;
  15. bool _isShow = false;
  16. List _chooses = [];
  17. Map _msgDict,_startCity,_endCity;
  18. String _timeStr,_numStr;
  19. List _packList = [];
  20. List _priceList = [];
  21. int _index = 0;
  22. @override
  23. void initState() {
  24. Future.delayed(Duration(seconds: 0)).then((value){
  25. _getBackImages();
  26. });
  27. super.initState();
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return Scaffold(
  32. backgroundColor: Color(0xFFF1F2F4),
  33. body: SingleChildScrollView(
  34. child: Stack(
  35. children: [
  36. Container(
  37. height: MediaQuery.of(context).padding.top+hsp(380),
  38. width: MediaQuery.of(context).size.width,
  39. child: Image(
  40. image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['background']}'),
  41. fit: BoxFit.fill,
  42. ),
  43. ),
  44. if(_msgDict!=null)Container(
  45. margin: EdgeInsets.only(left: wsp(50),top: MediaQuery.of(context).padding.top+hsp(200)),
  46. child: RichText(
  47. text: TextSpan(
  48. text: '${_msgDict['name']} ',
  49. style: TextStyle(fontSize: zsp(50),color: Colors.white,fontWeight: FontWeight.bold),
  50. children: [
  51. TextSpan(
  52. text: '${_msgDict['subtitle']}',
  53. style: TextStyle(fontWeight: FontWeight.normal,fontSize: zsp(28),color: Colors.white.withOpacity(0.5))
  54. )
  55. ]
  56. ),
  57. ),
  58. ),
  59. GestureDetector(
  60. onTap: (){Navigator.pop(context);},
  61. child: Container(
  62. margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(30)),
  63. child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Colors.white,),
  64. ),
  65. ),
  66. Container(
  67. width: MediaQuery.of(context).size.width-wsp(60),
  68. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(300),left: wsp(30),bottom: hsp(40)),
  69. decoration: BoxDecoration(
  70. borderRadius: BorderRadius.all(Radius.circular(10)),
  71. color: Colors.white,
  72. ),
  73. child: Column(
  74. children: [
  75. ListView.separated(
  76. shrinkWrap: true,
  77. itemBuilder: (context,index){
  78. return Container(
  79. child: Column(
  80. children: [
  81. Container(
  82. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(50),bottom: hsp(20)),
  83. child: Column(
  84. children: [
  85. Row(
  86. children: [
  87. GestureDetector(
  88. onTap: (){
  89. Navigator.of(context,rootNavigator: true).push(
  90. CupertinoPageRoute(
  91. builder: (context){
  92. return YSCity();
  93. }
  94. )
  95. ).then((value){
  96. if(value!=null){
  97. setState(() {
  98. _startCity = value;
  99. });
  100. // _getFeatureDisplayListData();
  101. }
  102. });
  103. },
  104. child: Text(_startCity==null?'请选择出发地':'${_startCity['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  105. ),
  106. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  107. GestureDetector(
  108. onTap: (){
  109. Navigator.of(context,rootNavigator: true).push(
  110. CupertinoPageRoute(
  111. builder: (context){
  112. return YSCity();
  113. }
  114. )
  115. ).then((value){
  116. if(value!=null){
  117. setState(() {
  118. _endCity = value;
  119. });
  120. // _getFeatureDisplayListData();
  121. }
  122. });
  123. },
  124. child: Text(_endCity==null?'请选择目的地':'${_endCity['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  125. )
  126. ],
  127. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  128. ),
  129. Row(
  130. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  131. children: [
  132. Text(_startCity==null?'':'${_startCity['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  133. Text(_endCity==null?'':'${_endCity['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  134. ],
  135. )
  136. ],
  137. ),
  138. ),
  139. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  140. GestureDetector(
  141. child: Container(
  142. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  143. child: Row(
  144. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  145. children: [
  146. Column(
  147. children: [
  148. Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),),
  149. RichText(
  150. text: TextSpan(
  151. text: _timeStr==null?'请选择出发时间':_timeStr,
  152. style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold,color: Colors.black),
  153. children: [
  154. // TextSpan(
  155. // text: '今天',
  156. // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal),
  157. // )
  158. ]
  159. ),
  160. )
  161. ],
  162. crossAxisAlignment: CrossAxisAlignment.start,
  163. ),
  164. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  165. ],
  166. ),
  167. ),
  168. onTap: (){
  169. showModalBottomSheet(
  170. context: context,
  171. builder: (context){
  172. return YSDatePicker(
  173. choose: (value){
  174. setState(() {
  175. _timeStr = value;
  176. });
  177. },
  178. );
  179. }
  180. );
  181. },
  182. behavior: HitTestBehavior.opaque,
  183. ),
  184. ],
  185. ),
  186. );
  187. },
  188. separatorBuilder: (context,index){
  189. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),);
  190. },
  191. itemCount: 1,
  192. padding: EdgeInsets.all(0),
  193. physics: NeverScrollableScrollPhysics(),
  194. ),
  195. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  196. GestureDetector(
  197. onTap: (){
  198. showModalBottomSheet(
  199. context: context,
  200. builder: (context){
  201. return YSPicker(
  202. dataArray: [for(int i=0;i<30;i++){'title':'${i+1}'}],
  203. title: 'title',
  204. choose: (value){
  205. setState(() {
  206. _numStr = value['title'];
  207. });
  208. },
  209. );
  210. }
  211. );
  212. },
  213. behavior: HitTestBehavior.opaque,
  214. child: Container(
  215. padding: EdgeInsets.all(wsp(32)),
  216. child: Row(
  217. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  218. children: [
  219. Text(_numStr==null?'请选择出行人数':'$_numStr人出行',style: TextStyle(fontSize: zsp(36),color: Colors.black,fontWeight: FontWeight.bold),),
  220. Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),)
  221. ],
  222. ),
  223. ),
  224. ),
  225. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),),
  226. GestureDetector(
  227. onTap: (){},
  228. child: GestureDetector(
  229. onTap: (){
  230. _getPackData();
  231. },
  232. child: Container(
  233. width: MediaQuery.of(context).size.width-wsp(64)-hsp(64),
  234. margin: EdgeInsets.all(hsp(32)),
  235. height: hsp(100),
  236. decoration: BoxDecoration(
  237. color: Color(0xFFF15204),
  238. borderRadius: BorderRadius.all(Radius.circular(3))
  239. ),
  240. alignment: Alignment.center,
  241. child: Text('一键召唤公务机',style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontSize: zsp(36)),),
  242. ),
  243. ),
  244. ),
  245. GestureDetector(
  246. onTap: (){
  247. if(_msgDict==null){
  248. ysFlutterToast(context, '呼叫信息获取失败');
  249. return;
  250. }
  251. showDialog(
  252. context: context,
  253. builder: (context){
  254. return CupertinoAlertDialog(
  255. title: Text('提示\n'),
  256. content: Text('是否拨打${_msgDict['emergencyCall']}'),
  257. actions: [
  258. CupertinoButton(
  259. child: Container(
  260. child: Text('取消',style: TextStyle(fontSize: 16,color: Color(0xFF292929),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
  261. height: 40,
  262. alignment: Alignment.center,
  263. ),
  264. padding: EdgeInsets.all(0),
  265. onPressed: (){
  266. Navigator.pop(context);
  267. },
  268. ),
  269. CupertinoButton(
  270. child: Container(
  271. child: Text('确定',style: TextStyle(fontSize: 16,color: Color(0xFF292929),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
  272. height: 40,
  273. alignment: Alignment.center,
  274. ),
  275. padding: EdgeInsets.all(0),
  276. onPressed: (){
  277. Navigator.pop(context);
  278. launch('tel:${_msgDict['emergencyCall']}');
  279. },
  280. )
  281. ],
  282. );
  283. }
  284. );
  285. },
  286. child: Container(
  287. width: MediaQuery.of(context).size.width-wsp(64)-hsp(64),
  288. margin: EdgeInsets.only(left: hsp(32),right: hsp(32),bottom: hsp(40)),
  289. height: hsp(100),
  290. decoration: BoxDecoration(
  291. color: Colors.white,
  292. border: Border.all(color: Color(0xFF00B600),width: 1),
  293. borderRadius: BorderRadius.all(Radius.circular(3))
  294. ),
  295. alignment: Alignment.center,
  296. child: Text('SOS紧急呼叫',style: TextStyle(fontWeight: FontWeight.bold,color: Color(0xFF00B600),fontSize: zsp(36)),),
  297. ),
  298. ),
  299. ],
  300. ),
  301. ),
  302. if(_isOrder==true)GestureDetector(
  303. onTap: (){
  304. setState(() {
  305. _isOrder = false;
  306. });
  307. },
  308. child: Container(
  309. height: MediaQuery.of(context).size.height,
  310. width: MediaQuery.of(context).size.width,
  311. color: Colors.black54,
  312. child: GestureDetector(
  313. onTap: (){},
  314. child: Column(
  315. children: [
  316. Container(
  317. height: MediaQuery.of(context).size.height*0.8-hsp(120),
  318. width: MediaQuery.of(context).size.width,
  319. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2),
  320. decoration: BoxDecoration(
  321. color: Color(0xFFF1F2F3),
  322. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  323. ),
  324. child: Column(
  325. crossAxisAlignment: CrossAxisAlignment.start,
  326. children: [
  327. Container(
  328. height: hsp(100),
  329. decoration: BoxDecoration(
  330. color: Colors.white,
  331. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  332. ),
  333. padding: EdgeInsets.only(left: 15,right: 15),
  334. child: Row(
  335. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  336. children: [
  337. Container(width: wsp(50),),
  338. Text('订单确认',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  339. GestureDetector(
  340. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  341. onTap: (){
  342. setState(() {
  343. _isOrder = false;
  344. });
  345. },
  346. ),
  347. ],
  348. ),
  349. ),
  350. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
  351. Container(
  352. height: MediaQuery.of(context).size.height*0.8-hsp(220)-0.5,
  353. child: SingleChildScrollView(
  354. padding: EdgeInsets.all(0),
  355. child: Column(
  356. children: [
  357. Container(
  358. padding: EdgeInsets.all(hsp(30)),
  359. color: Colors.white,
  360. width: MediaQuery.of(context).size.width,
  361. child: Column(
  362. crossAxisAlignment: CrossAxisAlignment.start,
  363. children: [
  364. Text('使用日期',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  365. Container(
  366. margin: EdgeInsets.only(top: hsp(20)),
  367. child: Row(
  368. children: [
  369. Container(
  370. height: hsp(120),
  371. width: MediaQuery.of(context).size.width-hsp(200),
  372. child: ListView.separated(
  373. itemBuilder: (context,index){
  374. return GestureDetector(
  375. behavior: HitTestBehavior.opaque,
  376. onTap: (){
  377. _timeStr = _priceList[index]['time'];
  378. setState(() {
  379. _index = index;
  380. });
  381. },
  382. child: Stack(
  383. children: [
  384. Container(
  385. height: hsp(120),
  386. width: (MediaQuery.of(context).size.width-hsp(230))/3,
  387. decoration: BoxDecoration(
  388. color: index==_index?Color(0xFF007EFF):Color(0xFFF0EEEE),
  389. borderRadius: BorderRadius.all(Radius.circular(5))
  390. ),
  391. alignment: Alignment.center,
  392. child: Text('${_priceList[index]['time']} \n¥${_priceList[index]['price']}',
  393. style: TextStyle(fontSize: zsp(20),color: index==_index?Colors.white:Color(0xFF8B8B8B)),textAlign: TextAlign.center,),
  394. ),
  395. if(_index==index)Container(
  396. child: Text(timeTag('${_priceList[index]['time']}'),style: TextStyle(fontSize: zsp(16),color: Color(0xFF007EFF)),),
  397. height: hsp(30),
  398. padding: EdgeInsets.only(left: wsp(3),right: wsp(3)),
  399. decoration: BoxDecoration(
  400. color: Color(0xFFF7F7F7),
  401. borderRadius: BorderRadius.only(topLeft: Radius.circular(3),bottomRight: Radius.circular(5))
  402. ),
  403. alignment: Alignment.center,
  404. ),
  405. ],
  406. ),
  407. );
  408. },
  409. separatorBuilder: (context,index){
  410. return Container(width: hsp(15),color: Colors.white,);
  411. },
  412. itemCount: _priceList.length,
  413. padding: EdgeInsets.all(0),
  414. scrollDirection: Axis.horizontal,
  415. ),
  416. ),
  417. GestureDetector(
  418. onTap: (){
  419. showModalBottomSheet(
  420. context: context,
  421. builder: (context){
  422. return YSDatePicker(
  423. choose: (value){
  424. Map time = {'time':value.split(' ')[0],'price':_priceList[0]['price']};
  425. int index;
  426. for(int i=0;i<_priceList.length;i++){
  427. if(_priceList[i]['time']==time['time']){
  428. index = i;
  429. }
  430. }
  431. if(index!=null){
  432. _priceList.removeAt(index);
  433. }
  434. setState(() {
  435. _priceList.insert(0, time);
  436. });
  437. },
  438. );
  439. }
  440. );
  441. },
  442. behavior: HitTestBehavior.opaque,
  443. child: Container(
  444. height: hsp(120),
  445. width: hsp(140),
  446. alignment: Alignment.center,
  447. child: Text('更多\n日期',style: TextStyle(fontSize: zsp(26),color: Color(0xFF007EFF)),),
  448. ),
  449. )
  450. ],
  451. ),
  452. ),
  453. ],
  454. ),
  455. ),
  456. Container(
  457. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)),
  458. color: Colors.white,
  459. child: Column(
  460. children: [
  461. Row(
  462. children: [
  463. GestureDetector(
  464. child: Text('${_startCity['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  465. ),
  466. Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
  467. Text('${_endCity['display']}',style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
  468. ],
  469. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  470. ),
  471. Row(
  472. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  473. children: [
  474. Text('${_startCity['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  475. Text('${_endCity['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  476. ],
  477. )
  478. ],
  479. ),
  480. ),
  481. Container(
  482. child: Row(
  483. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  484. children: [
  485. RichText(
  486. text: TextSpan(
  487. text: '出行人数',
  488. style: TextStyle(fontSize: zsp(34),color: Color(0xFF9A9A9A)),
  489. children: [
  490. TextSpan(
  491. text: ' $_numStr ',
  492. style: TextStyle(color: Color(0xFF348AE1))
  493. ),
  494. TextSpan(
  495. text: '人'
  496. )
  497. ]
  498. ),
  499. ),
  500. GestureDetector(
  501. onTap: (){
  502. showModalBottomSheet(
  503. isScrollControlled: true,
  504. context: context,
  505. backgroundColor: Colors.transparent,
  506. builder: (context){
  507. return Container(
  508. height: MediaQuery.of(context).size.height*0.85,
  509. decoration: BoxDecoration(
  510. color: Colors.white,
  511. borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  512. ),
  513. child: Column(
  514. children: [
  515. Container(
  516. height: hsp(100),
  517. padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
  518. child: Row(
  519. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  520. children: [
  521. Container(width: wsp(50),),
  522. Text('预订须知',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  523. GestureDetector(
  524. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  525. onTap: (){
  526. Navigator.pop(context);
  527. },
  528. ),
  529. ],
  530. ),
  531. ),
  532. Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),),
  533. Container(
  534. height: MediaQuery.of(context).size.height*0.85-0.5-hsp(100),
  535. color: Colors.white,
  536. ),
  537. ],
  538. ),
  539. );
  540. }
  541. );
  542. },
  543. child: RichText(
  544. text: TextSpan(
  545. text: '预订须知',
  546. style: TextStyle(fontSize: zsp(28),color: Color(0xFF348AE1)),
  547. children: [
  548. TextSpan(
  549. text: ' >',
  550. style: TextStyle(color: Color(0xFF000000))
  551. ),
  552. ]
  553. ),
  554. ),
  555. ),
  556. ],
  557. ),
  558. padding: EdgeInsets.only(left: wsp(40),right: wsp(40)),
  559. margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
  560. height: hsp(100),
  561. width: MediaQuery.of(context).size.width,
  562. alignment: Alignment.centerLeft,
  563. color: Colors.white,
  564. ),
  565. GestureDetector(
  566. onTap: (){
  567. setState(() {
  568. _isShow = !_isShow;
  569. });
  570. },
  571. behavior: HitTestBehavior.opaque,
  572. child: Container(
  573. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(20),bottom: hsp(20)),
  574. color: Colors.white,
  575. child: Row(
  576. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  577. children: [
  578. Text('更多服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),),
  579. Icon(Icons.keyboard_arrow_down,size: hsp(50),color: Color(0xFFC1C1C1),)
  580. ],
  581. )
  582. ),
  583. ),
  584. if(_isShow==true)Container(
  585. padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(10)),
  586. decoration: BoxDecoration(
  587. color: Color(0xFFFAFAFA),
  588. borderRadius: BorderRadius.only(bottomRight: Radius.circular(10),bottomLeft: Radius.circular(10))
  589. ),
  590. child: ListView.builder(
  591. shrinkWrap: true,
  592. itemBuilder: (context,index){
  593. return Container(
  594. padding: EdgeInsets.only(bottom: wsp(20)),
  595. child: Row(
  596. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  597. children: [
  598. Row(
  599. children: [
  600. Text('${_packList[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),),
  601. Container(
  602. width: wsp(50),
  603. child: GestureDetector(
  604. child: Icon(Icons.error_outline,size: hsp(40),color: Color(0xFF999999)),
  605. ),
  606. ),
  607. Text('${_packList[index]['price']}元',style: TextStyle(fontSize: zsp(28),color: Colors.black),),
  608. ],
  609. ),
  610. GestureDetector(
  611. child: Container(
  612. height: hsp(60),
  613. width: hsp(100),
  614. child: Image.asset(_chooses.contains(_packList[index])==true?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'),
  615. ),
  616. onTap: (){
  617. setState(() {
  618. if(_chooses.contains(_packList[index])==true){
  619. _chooses.remove(_packList[index]);
  620. }else{
  621. _chooses.add(_packList[index]);
  622. }
  623. });
  624. },
  625. )
  626. ],
  627. ),
  628. );
  629. },
  630. itemCount: _packList.length,
  631. padding: EdgeInsets.all(0),
  632. physics: NeverScrollableScrollPhysics(),
  633. ),
  634. )
  635. ],
  636. ),
  637. ),
  638. ),
  639. ],
  640. ),
  641. ),
  642. Container(
  643. height: hsp(120),
  644. width: MediaQuery.of(context).size.width,
  645. color: Colors.white,
  646. padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
  647. child: Row(
  648. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  649. children: [
  650. RichText(
  651. text: TextSpan(
  652. text: '参考价(¥)',
  653. style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),
  654. children: [
  655. TextSpan(
  656. text: ' ${_getPrice()}',
  657. style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)),
  658. )
  659. ]
  660. ),
  661. ),
  662. GestureDetector(
  663. child: Row(
  664. children: [
  665. Text('明细',style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),),
  666. Icon(Icons.keyboard_arrow_up,size: hsp(30),color: Color(0xFF007EFF),),
  667. ],
  668. ),
  669. onTap: (){
  670. setState(() {
  671. _isDetail = !_isDetail;
  672. });
  673. },
  674. ),
  675. GestureDetector(
  676. onTap: (){
  677. _postPlaneOrderData();
  678. },
  679. child: Container(
  680. height: hsp(70),
  681. padding: EdgeInsets.only(left: wsp(50),right: wsp(50)),
  682. decoration: BoxDecoration(
  683. color: Color(0xFF007EFF),
  684. borderRadius: BorderRadius.all(Radius.circular(50))
  685. ),
  686. alignment: Alignment.center,
  687. child: Text('立即预约',style: TextStyle(fontSize: zsp(30),color: Colors.white,fontWeight: FontWeight.bold),),
  688. ),
  689. )
  690. ],
  691. ),
  692. )
  693. ],
  694. ),
  695. ),
  696. ),
  697. ),
  698. if(_isDetail==true)GestureDetector(
  699. onTap: (){
  700. setState(() {
  701. _isDetail = false;
  702. });
  703. },
  704. child: Container(
  705. height: MediaQuery.of(context).size.height-hsp(120),
  706. color: Colors.black45,
  707. child: Container(
  708. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(120)-hsp(370)),
  709. height: hsp(370),
  710. decoration: BoxDecoration(
  711. color: Colors.white,
  712. borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10))
  713. ),
  714. child: GestureDetector(
  715. onTap: (){},
  716. behavior: HitTestBehavior.opaque,
  717. child: Column(
  718. children: [
  719. Container(
  720. height: hsp(100),
  721. padding: EdgeInsets.only(left: 15,right: 15),
  722. child: Row(
  723. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  724. children: [
  725. GestureDetector(
  726. child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
  727. onTap: (){
  728. setState(() {
  729. _isDetail = false;
  730. });
  731. },
  732. ),
  733. Text('明细',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  734. Container(width: wsp(50),),
  735. ],
  736. ),
  737. ),
  738. Container(
  739. height: hsp(100),
  740. color: Color(0xFFF7F8F9),
  741. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(20),top: hsp(20)),
  742. child: Row(
  743. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  744. children: [
  745. Text('座位',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),),
  746. Text('¥ ${_priceList[_index]['price']}x $_numStr人',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),),
  747. ],
  748. ),
  749. ),
  750. Container(
  751. color: Color(0xFFF7F8F9),
  752. height: hsp(170),
  753. child: ListView.builder(
  754. padding: EdgeInsets.all(0),
  755. itemBuilder: (context,index){
  756. return Container(
  757. padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(10)),
  758. child: Row(
  759. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  760. children: [
  761. Text('${_chooses[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
  762. Text('¥ ${_chooses[index]['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),),
  763. ],
  764. ),
  765. );
  766. },
  767. itemCount: _chooses.length,
  768. ),
  769. )
  770. ],
  771. ),
  772. ),
  773. ),
  774. ),
  775. )
  776. ],
  777. ),
  778. ),
  779. );
  780. }
  781. _getBackImages() async{
  782. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/wallconfigure/get',parameter: {'type':1},isLoading: true,isToken: false);
  783. if(dict!=null){
  784. setState(() {
  785. _msgDict = dict['data'];
  786. });
  787. }
  788. }
  789. _getPackData() async{
  790. if(_startCity==null){
  791. ysFlutterToast(context,'请选择出发地');
  792. return;
  793. }
  794. if(_endCity==null){
  795. ysFlutterToast(context,'请选择目的地');
  796. return;
  797. }
  798. if(_timeStr==null){
  799. ysFlutterToast(context,'请选择出发时间');
  800. return;
  801. }
  802. if(_numStr==null){
  803. ysFlutterToast(context,'请选择出行人数');
  804. return;
  805. }
  806. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':1},isLoading: true,isToken: false);
  807. if(dict!=null){
  808. _isOrder = true;
  809. _packList = dict['data'];
  810. _getPriceData();
  811. }
  812. }
  813. _getPriceData() async{
  814. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime',parameter: {'time':_timeStr,'type':1},isLoading: true,isToken: true);
  815. if(dict!=null){
  816. setState(() {
  817. _priceList = dict['data'];
  818. });
  819. }
  820. }
  821. _getPrice(){
  822. double price = double.parse('${_priceList[_index]['price']}')*int.parse('$_numStr');
  823. _chooses.forEach((element) {
  824. price+=double.parse('${element['price']}');
  825. });
  826. return price;
  827. }
  828. _postPlaneOrderData() async{
  829. if(_startCity==null){
  830. ysFlutterToast(context,'请选择出发地');
  831. return;
  832. }
  833. if(_endCity==null){
  834. ysFlutterToast(context,'请选择目的地');
  835. return;
  836. }
  837. if(_timeStr==null){
  838. ysFlutterToast(context,'请选择出发时间');
  839. return;
  840. }
  841. if(_numStr==null){
  842. ysFlutterToast(context,'请选择出行人数');
  843. return;
  844. }
  845. isLogin(context,login: (){});
  846. Map requestDict = {};
  847. requestDict['flightTime'] = _timeStr;
  848. requestDict['type'] = 1;
  849. requestDict['travelersNumber'] = _numStr;
  850. requestDict['citySetout'] = _startCity['display'];
  851. requestDict['airportSetout'] = _startCity['airplanename'];
  852. requestDict['cityArrive'] = _endCity['display'];
  853. requestDict['airportArrive'] = _endCity['airplanename'];
  854. requestDict['price'] = '${_getPrice()}';
  855. List array = [];
  856. _chooses.forEach((element) {
  857. array.add(element['id']);
  858. });
  859. requestDict['serviceIds'] = array.join(',');
  860. Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/airplaneorder/createOrder',parameter: requestDict,isLoading: true,isToken: true);
  861. if(dict!=null){
  862. Navigator.of(context).push(
  863. CupertinoPageRoute(
  864. builder: (context){
  865. return YSPay(orderDict: dict['data'],type: payType.doctor,);
  866. }
  867. )
  868. );
  869. }
  870. }
  871. }