123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:ysairplane/code/YSChooseLocation.dart';
- import 'package:ysairplane/code/YSChoosePlane.dart';
- import 'package:ysairplane/code/YSOrderOne.dart';
- import 'package:ysairplane/code/YSOrderTwo.dart';
- import 'package:ysairplane/code/YSPay.dart';
- import 'package:ysairplane/tools/YSNetWorking.dart';
- import 'package:ysairplane/tools/YSTools.dart';
- import 'YSCity.dart';
- class YSTravelling extends StatefulWidget {
- @override
- _YSTravellingState createState() => _YSTravellingState();
- }
- class _YSTravellingState extends State<YSTravelling> {
- 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 _numStr;
- Map _planeType;
- @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: [
- 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==3)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('${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: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'].isNotEmpty?
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['display']:'请选择出发地'}',
- style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- width: (MediaQuery.of(context).size.width-hsp(210))/2,
- alignment: Alignment.centerLeft,
- ),
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _type==1?YSCity():YSChooseLocation();
- }
- )
- ).then((value){
- if(value!=null){
- setState(() {
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity'] = value;
- });
- // _getFeatureDisplayListData();
- }
- });
- },
- ),
- Image(height: hsp(60),width: hsp(60),image: AssetImage('lib/images/plane.png'),),
- GestureDetector(
- child: Container(
- child: Text('${(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'].isNotEmpty?
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['display']:'请选择目的地'}',
- style: TextStyle(fontSize: zsp(40),fontWeight: FontWeight.bold,color: Colors.black),),
- width: (MediaQuery.of(context).size.width-hsp(210))/2,
- alignment: Alignment.centerRight,
- ),
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return YSCity();
- }
- )
- ).then((value){
- if(value!=null){
- setState(() {
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity'] = value;
- });
- // _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);
- setState(() {
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index][indexSub==0?'startCity':'endCity'] = value;
- });
- // _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']['display']:'${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),),
- 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;
- }
- showModalBottomSheet(
- context: context,
- builder: (context){
- return YSDatePicker(
- choose: (value){
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'] = value;
- _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),fontWeight: FontWeight.bold,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),fontWeight: FontWeight.bold,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(() {
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)
- .add({'startCity':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_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(() {
- _numStr = value['title'];
- });
- },
- );
- }
- );
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.all(wsp(32)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(_numStr==null?'请选择出行人数':'$_numStr人出行',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),),
- GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSChoosePlane(type: _type,);
- }
- )
- ).then((value){
- if(value!=null){
- setState(() {
- _planeType = value;
- });
- }
- });
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.all(wsp(32)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(_planeType==null?'飞机类型':'${_planeType['partnerName']}',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),),
- GestureDetector(
- onTap: (){
- if(_planeType==null){
- ysFlutterToast(context, '请选择飞机类型');
- return;
- }
- if(_numStr==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]['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 dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/preferential/caculationHour',parameter: {'timeSetout':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startTime'],
- 'airportidSetout':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['startCity']['id'],
- 'airportidArrive':(_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endCity']['id']},isLoading: false,isToken: false);
- if(dict!=null){
- setState(() {
- (_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3)[index]['endTime'] = dict['data'];
- });
- }
- }
- _postPlaneOrderData() async{
- print((_typeSub==1?_travellings1:_typeSub==2?_travellings2:_travellings3));
- Map requestDict = {};
- requestDict['type'] = 7;
- requestDict['airplaneid'] = _planeType['id'];
- requestDict['Itinerary'] = _typeSub;
- requestDict['travelersNumber'] = _numStr;
- 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']['location'];
- itineraries['locationArrive'] = element['endCity']['location'];
- itineraries['setout'] = element['startCity']['display'];
- itineraries['arrive'] = element['endCity']['display'];
- }
- 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']);
- }
- )
- );
- }
- }
- }
|