import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ysairplane2/code/YSChooseLocation.dart'; import 'package:ysairplane2/code/YSChoosePlane.dart'; import 'package:ysairplane2/code/YSOrderOne.dart'; import 'package:ysairplane2/code/YSOrderTwo.dart'; import 'package:ysairplane2/code/YSPay.dart'; import 'package:ysairplane2/tools/YSNetWorking.dart'; import 'package:ysairplane2/tools/YSTools.dart'; import 'YSCity.dart'; class YSTravelling extends StatefulWidget { @override _YSTravellingState createState() => _YSTravellingState(); } class _YSTravellingState extends State { int _type = 1; int _typeSub = 1; Map _msgDict; List _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; List _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; List _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; String _numStr1; Map _planeType1; String _numStr2; Map _planeType2; @override void initState() { Future.delayed(Duration(seconds: 0)).then((value){ _getBackImageData(); }); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFF1F2F4), body: SingleChildScrollView( child: Stack( children: [ if(_type==2)Container( height:0.5, width: 0.5, color: Color(0xFFF1F2F3), child: platformView( platforms: (value){ value.setMethodCallHandler((call) { if(call.method == "address"){ print('-------------------->${call.arguments}'); Map point = call.arguments; setState(() { (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[0]['startCity'] = point; }); } return; }); } ) ), Container( height: MediaQuery.of(context).padding.top+hsp(380), width: MediaQuery.of(context).size.width, child: Image( image: _msgDict==null?AssetImage('lib/images/home3.png'):NetworkImage('${_msgDict['background']}'), fit: BoxFit.fill, ), ), GestureDetector( onTap: (){Navigator.pop(context);}, child: Container( margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(30)), child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Colors.white,), ), ), if(_msgDict!=null)Container( margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(130),right: wsp(32)), width: MediaQuery.of(context).size.width-wsp(64), alignment: Alignment.center, child: Text('${_msgDict['name']}',style: TextStyle(fontSize: zsp(40),color: Colors.white,fontWeight: FontWeight.bold),) ), if(_msgDict!=null)Container( margin: EdgeInsets.only(left: wsp(32),top: MediaQuery.of(context).padding.top+hsp(200),right: wsp(32)), width: MediaQuery.of(context).size.width-wsp(64), alignment: Alignment.center, child: Text('${_msgDict['subtitle']}',style: TextStyle(fontSize: zsp(28),color: Colors.white.withOpacity(0.6)),) ), Container( width: MediaQuery.of(context).size.width-wsp(60), margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(300),left: wsp(30),bottom: hsp(40)), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10)), color: Colors.white, ), child: Column( children: [ Row( children: [ GestureDetector( onTap: (){ _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; setState(() { _type = 1; }); }, child: Container( height: hsp(100), width: (MediaQuery.of(context).size.width-wsp(64))/2, padding: EdgeInsets.only(top: hsp(30)), decoration: BoxDecoration( color: _type==1?Colors.white:Color(0xFFF1F2F3), borderRadius: BorderRadius.only(topLeft: Radius.circular(10)) ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('商旅机',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),), Container( height: hsp(6), width: wsp(66), color: _type==1?Color(0xFF007EFF):Colors.transparent, ) ], ), ), ), GestureDetector( onTap: (){ _travellings1 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; _travellings2 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; _travellings3 = [{'startCity':{},'endCity':{},'startTime':'','endTime':''}]; setState(() { _type = 2; }); }, child: Container( height: hsp(100), width: (MediaQuery.of(context).size.width-wsp(64))/2, padding: EdgeInsets.only(top: hsp(30)), decoration: BoxDecoration( color: _type==2?Colors.white:Color(0xFFF1F2F3), borderRadius: BorderRadius.only(topRight: Radius.circular(10)) ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('直升机',style: TextStyle(fontSize: zsp(34),color: Colors.black,fontWeight: FontWeight.bold),), Container( height: hsp(6), width: wsp(66), color: _type==2?Color(0xFF007EFF):Colors.transparent, ) ], ), ), ) ], ), Container( margin: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(40),bottom: hsp(10)), padding: EdgeInsets.only(left: wsp(2),right: wsp(2)), height: hsp(80), decoration: BoxDecoration( color: Color(0xFFF1F2F3), borderRadius: BorderRadius.all(Radius.circular(5)) ), child: Row( children: [ GestureDetector( onTap: (){ setState(() { _typeSub = 1; }); }, child: Container( height: hsp(74), width: (MediaQuery.of(context).size.width-wsp(144))/3, decoration: BoxDecoration( color: _typeSub==1?Colors.white:Colors.transparent, borderRadius: BorderRadius.all(Radius.circular(5)) ), alignment: Alignment.center, child: Text('单程',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==1?FontWeight.bold:FontWeight.normal,color: Colors.black),), ), ), GestureDetector( onTap: (){ setState(() { _typeSub = 2; }); }, child: Container( height: hsp(74), width: (MediaQuery.of(context).size.width-wsp(144))/3, decoration: BoxDecoration( color: _typeSub==2?Colors.white:Colors.transparent, borderRadius: BorderRadius.all(Radius.circular(5)) ), alignment: Alignment.center, child: Text('往返',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==2?FontWeight.bold:FontWeight.normal,color: Colors.black),), ), ), GestureDetector( onTap: (){ setState(() { _typeSub = 3; }); }, child: Container( height: hsp(74), width: (MediaQuery.of(context).size.width-wsp(144))/3, decoration: BoxDecoration( color: _typeSub==3?Colors.white:Colors.transparent, borderRadius: BorderRadius.all(Radius.circular(5)) ), alignment: Alignment.center, child: Text('多程',style: TextStyle(fontSize: zsp(30),fontWeight: _typeSub==3?FontWeight.bold:FontWeight.normal,color: Colors.black),), ), ), ], ), ), ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return Container( child: Column( children: [ if(_typeSub!=1)Container( padding: EdgeInsets.only(right: wsp(32),top: wsp(30),bottom: wsp(10)), child: Row( children: [ Container( height: hsp(40), alignment: Alignment.center, child: Text(_typeSub==2?(index==0?'往':'返'):'${index+1}',style: TextStyle(fontSize: zsp(20),color: Colors.white),), padding: EdgeInsets.only(left: wsp(20),right: wsp(20)), margin: EdgeInsets.only(right: wsp(30)), decoration: BoxDecoration( color: Color(0xFF007EFF), borderRadius: BorderRadius.only(topRight: Radius.circular(3),bottomRight: Radius.circular(8)) ), ), ], ), ), Container( padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)), child: _type==1?Column( children: [ Row( children: [ GestureDetector( child: Container( child: SingleChildScrollView( child: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isNotEmpty? (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['name']:'请选择出发地'}', style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),maxLines: 1,), scrollDirection: Axis.horizontal, ), width: (MediaQuery.of(context).size.width-hsp(240))/2, alignment: Alignment.centerLeft, ), onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return _type==1?YSCity():YSChooseLocation(); } ) ).then((value){ if(value!=null){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['airplaneName'] ==value['airplaneName']){ ysFlutterToast(context, '出发地与目的地不能相同'); return; } (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'] = value; if((_type==1?_planeType1:_planeType2)!=null&& (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'].isNotEmpty){ _getDate(index); }else{ setState(() {}); } // _getFeatureDisplayListData(); } }); }, ), Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),), GestureDetector( child: Container( child: SingleChildScrollView( child: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isNotEmpty? (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['name']:'请选择目的地'}', style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),maxLines: 1,), scrollDirection: Axis.horizontal, ), width: (MediaQuery.of(context).size.width-hsp(240))/2, alignment: Alignment.centerRight, ), onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return YSCity(); } ) ).then((value){ if(value!=null){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['airplaneName'] ==value['airplaneName']){ ysFlutterToast(context, '目的地与出发地不能相同'); return; } (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'] = value; if((_type==1?_planeType1:_planeType2)!=null&& (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'].isNotEmpty){ _getDate(index); }else{ setState(() {}); } // _getFeatureDisplayListData(); } }); }, ), ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isNotEmpty? (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['airplaneName']:''}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),), Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isNotEmpty? (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['airplaneName']:''}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),), ], ) ], ): Container( width: MediaQuery.of(context).size.width-hsp(100), child: ListView.builder( itemBuilder: (context,indexSub){ return GestureDetector( onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return YSChooseLocation(); } ) ).then((value){ if(value!=null){ print(value); if(indexSub==0){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['airplaneName'] ==value['airplaneName']){ ysFlutterToast(context, '出发地与目的地不能相同'); return; } }else if(indexSub==1){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['airplaneName'] ==value['airplaneName']){ ysFlutterToast(context, '目的地与出发地不能相同'); return; } } (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity'] = value; if((_type==1?_planeType1:_planeType2)!=null&& (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'].isNotEmpty){ _getDate(index); }else{ setState(() {}); } // _getFeatureDisplayListData(); } }); }, child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( children: [ Container( height: hsp(30), width: hsp(30), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(50)), border: Border.all(color: indexSub%2==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6)) ), margin: EdgeInsets.only(top: hsp(10),bottom: hsp(7)), ), if(indexSub<1)Container( height: hsp(30), width: hsp(5), color: Color(0xFFCACAD4), ) ], ), Container( child: RichText( text: TextSpan( text: '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity'].isNotEmpty? (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity']['title']:'${indexSub==0?'请选择出发地':'请选择目的地'}'}', style: TextStyle(color: Color(0xFF000000),fontSize: hsp(30),fontWeight: FontWeight.bold), children: [ ] ), ), margin: EdgeInsets.only(left: wsp(10),top: hsp(5)), ) ], ), Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),) ], ), ); }, itemCount: 2, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.all(0), ), ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),), GestureDetector( onTap: (){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSChoosePlane(type: _type,); } ) ).then((value){ if(value!=null){ setState(() { if(_type==1){ _planeType1 = value; }else{ _planeType2 = value; } }); } }); }, behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.all(wsp(32)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text((_type==1?_planeType1:_planeType2)==null?'飞机类型':'${(_type==1?_planeType1:_planeType2)['model']}',style: TextStyle(fontSize: zsp(36),color: Colors.black),), Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),) ], ), ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),), Container( padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ Text('出发',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),), GestureDetector( onTap: (){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isEmpty){ ysFlutterToast(context, '请选择出发地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isEmpty){ ysFlutterToast(context, '请选择目的地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['airplaneName'] ==(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['airplaneName']){ ysFlutterToast(context, '出发地与目的地不能相同'); return; } if((_type==1?_planeType1:_planeType2)==null){ ysFlutterToast(context, '请选择飞机类型'); return; } dateChooseAlert(context,dateValue: (date){ timeChooseAlert(context,timeValue: (time){ if((_typeSub==2||_typeSub==3)&&index>0){ DateTime time1 = DateTime.parse((_typeSub==2?_travellings2:_travellings3)[index-1]['endTime']); DateTime time2 = DateTime.parse('$date $time'); if(time2.isBefore(time1)){ ysFlutterToast(context, '${_typeSub==2?'往返':'行程'}时间有冲突,请重新选择出发时间'); return; } } (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'] = '$date $time'; _getDate(index); }); }); }, behavior: HitTestBehavior.opaque, child: RichText( text: TextSpan( text: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'].isNotEmpty? '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime']}':'请选择出发时间', style: TextStyle(fontSize: zsp(28),color: Colors.black), children: [ // TextSpan( // text: '今天', // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal), // ) ] ), ), ) ], crossAxisAlignment: CrossAxisAlignment.start, ), Column( children: [ Text((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'].isNotEmpty?'到达':'',style: TextStyle(fontSize: zsp(24),color: Color(0xFF666666)),), RichText( text: TextSpan( text: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'].isNotEmpty? '${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime']}':'', style: TextStyle(fontSize: zsp(28),color: Colors.black), children: [ // TextSpan( // text: '今天', // style: TextStyle(fontSize: zsp(24),fontWeight: FontWeight.normal), // ) ] ), ) ], crossAxisAlignment: CrossAxisAlignment.start, ), Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),) ], ), ), ], ), ); }, separatorBuilder: (context,index){ return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),); }, itemCount: (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), ), if(_typeSub==3)Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),), if(_typeSub==3)GestureDetector( onTap: (){ for(int i = 0;i<(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length;i++){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startCity'].length==0){ ysFlutterToast(context, '请完善出发地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endCity'].length==0){ ysFlutterToast(context, '请完善目的地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startTime'].length==0){ ysFlutterToast(context, '请完善出发时间'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endTime'].length==0){ ysFlutterToast(context, '请完善到达时间'); return; } } setState(() { _travellings3.add({'startCity':_travellings3[_travellings3.length-1]['endCity'],'endCity':{},'startTime':'','endTime':''}); }); }, behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only(right: wsp(32),top: wsp(32),bottom: wsp(32)), child: Row( children: [ Container( height: hsp(40), alignment: Alignment.center, child: Text('添加',style: TextStyle(fontSize: zsp(20),color: Colors.white),), padding: EdgeInsets.only(left: wsp(10),right: wsp(10)), margin: EdgeInsets.only(right: wsp(30)), decoration: BoxDecoration( color: Color(0xFF007EFF), borderRadius: BorderRadius.only(topRight: Radius.circular(3),bottomRight: Radius.circular(8)) ), ), Text('增加行程',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),), ], ), ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE9E9E9),indent: wsp(32),endIndent: wsp(32),), GestureDetector( onTap: (){ showModalBottomSheet( context: context, builder: (context){ return YSPicker( dataArray: [for(int i=0;i<30;i++){'title':'${i+1}'}], title: 'title', choose: (value){ setState(() { if(_type==1){ _numStr1 = value['title']; }else{ _numStr2 = value['title']; } }); }, ); } ); }, behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.all(wsp(32)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text((_type==1?_numStr1:_numStr2)==null?'请选择出行人数':'${(_type==1?_numStr1:_numStr2)}人出行',style: TextStyle(fontSize: zsp(36),color: Colors.black),), Icon(Icons.keyboard_arrow_right,size: hsp(50),color: Color(0xFFC1C1C1),) ], ), ), ), GestureDetector( onTap: (){ if((_type==1?_planeType1:_planeType2)==null){ ysFlutterToast(context, '请选择飞机类型'); return; } if((_type==1?_numStr1:_numStr2)==null){ ysFlutterToast(context, '请选择出行人数'); return; } for(int i = 0;i<(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).length;i++){ if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startCity'].length==0){ ysFlutterToast(context, '请完善出发地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endCity'].length==0){ ysFlutterToast(context, '请完善目的地'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endCity']['airplaneName'] ==(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startCity']['airplaneName']){ ysFlutterToast(context, '出发地与目的地不能相同'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['startTime'].length==0){ ysFlutterToast(context, '请完善出发时间'); return; } if((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[i]['endTime'].length==0){ ysFlutterToast(context, '请完善到达时间'); return; } } _postPlaneOrderData(); }, child: Container( width: MediaQuery.of(context).size.width-wsp(64)-hsp(64), margin: EdgeInsets.all(hsp(32)), height: hsp(100), decoration: BoxDecoration( color: Color(0xFF007EFF), borderRadius: BorderRadius.all(Radius.circular(5)) ), alignment: Alignment.center, child: Text('一键召唤公务机',style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontSize: zsp(36)),), ), ) ], ), ) ], ), ), ); } _getBackImageData() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/wallconfigure/get',parameter: {'type':7},isLoading: false,isToken: false); if(dict!=null){ setState(() { _msgDict = dict['data']; }); } } _getDate(int index) async{ Map setout = (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']; Map arrive = (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']; print('====================$setout'); Map request = {}; request['timeSetout'] = (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime']; request['modelId'] = (_type==1?_planeType1:_planeType2)['modelId']; request['type'] = _type; if(_type==1){ request['airportidSetout'] = setout['id']; request['airportidArrive'] = arrive['id']; }else{ request['airportidSetout'] = '${setout['lat']},${setout['lng']}'; request['airportidArrive'] = '${arrive['lat']},${arrive['lng']}'; } Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/preferential/caculationHour',parameter: request,isLoading: false,isToken: false); if(dict!=null){ setState(() { (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'] = dict['data']; if(_typeSub==2&&_travellings2.length==1){ _travellings2.add({'startCity':_travellings2[0]['endCity'],'endCity':_travellings2[0]['startCity'],'startTime':'','endTime':''}); } }); } } _postPlaneOrderData() async{ print((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)); Map requestDict = {}; requestDict['type'] = 7; requestDict['modelId'] = (_type==1?_planeType1:_planeType2)['modelId']; requestDict['Itinerary'] = _typeSub; requestDict['travelersNumber'] = _type==1?_numStr1:_numStr2; requestDict['charterType'] = _type; List array = []; int i = 0; (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3).forEach((element) { i++; Map itineraries = {}; if(_type==1){ itineraries['airportidSetout'] = element['startCity']['id']; itineraries['airportidArrive'] = element['endCity']['id']; }else{ itineraries['locationSetout'] = '${element['startCity']['lat']},${element['startCity']['lng']}'; itineraries['locationArrive'] = '${element['endCity']['lat']},${element['endCity']['lng']}'; itineraries['setout'] = element['startCity']['title']; itineraries['arrive'] = element['endCity']['title']; } itineraries['timeSetout'] = '${element['startTime']}:00'; itineraries['timeArrive'] = '${element['endTime']}:00'; itineraries['queue'] = i; array.add(itineraries); }); requestDict['itineraries'] = array; Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/preferential/Grayson',parameter: requestDict,isLoading: true,isToken: true); if(dict!=null){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSOrderOne(msgDict: _msgDict,orderDict: requestDict,confirmDict: dict['data'],planeModel: (_type==1?_planeType1:_planeType2)['model'],); } ) ); } } }