import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ysairplane/tools/YSNetWorking.dart'; import 'package:ysairplane/tools/YSTools.dart'; import 'YSComment.dart'; import 'YSPay.dart'; class YSMarryPlane extends StatefulWidget { final marryId,type; const YSMarryPlane({Key key, this.marryId, this.type}) : super(key: key); @override _YSMarryPlaneState createState() => _YSMarryPlaneState(); } class _YSMarryPlaneState extends State { bool _isDetail = false; bool _isOrder = false; bool _isShow = false; List _chooses = []; List _packages = []; Map _msgDict; String _timeStr; int _selected = 0; List _priceList = []; List _packList = []; int _index = 9999; TextEditingController _bless = TextEditingController(); @override void initState() { Future.delayed(Duration(seconds: 0)).then((value){ _timeStr = DateTime.now().year.toString()+'-'+DateTime.now().month.toString().padLeft(2,'0')+'-' +DateTime.now().day.toString().padLeft(2,'0')+' '+DateTime.now().hour.toString().padLeft(2,'0')+':'+DateTime.now().minute.toString().padLeft(2,'0'); _getMarryDetailData(); _getPackageData(); }); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFF1F2F4), body: Stack( children: [ 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(top: MediaQuery.of(context).padding.top+hsp(300)), height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(410), width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: Color(0xFFF1F2F4), borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10)) ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.only(left: hsp(30),top: hsp(30),bottom: hsp(20),right: hsp(30)), child: Text('${_msgDict['title']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF343434),fontWeight: FontWeight.bold),), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10)) ), width: MediaQuery.of(context).size.width, ), Container( color: Colors.white, width: MediaQuery.of(context).size.width, child: Row( children: [ Container( width: wsp(70), height: hsp(40), margin: EdgeInsets.only(left: hsp(30)), child: Text('${_msgDict['averageRating']}',style: TextStyle(fontSize: zsp(25),color: Colors.white),), alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFFED5E58), borderRadius: BorderRadius.only(topLeft: Radius.circular(50),bottomLeft: Radius.circular(50)) ), ), GestureDetector( onTap: (){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSComment(); } ) ); }, child: Container( width: wsp(150), height: hsp(40), child: Text('${_msgDict['dtOrderScoringNum']}条点评 >',style: TextStyle(fontSize: zsp(20),color: Colors.white),), alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFFFD8B86), borderRadius: BorderRadius.only(bottomRight: Radius.circular(50),topRight: Radius.circular(50)) ), ), ) ], ), ), GestureDetector( onTap: (){ _showAlert(0); }, child: Container( padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20)), color: Colors.white, width: MediaQuery.of(context).size.width, child: Row( children: [ Icon(Icons.location_on,color: Color(0xFF5E5E5E),size: hsp(35),), Text(' ${_msgDict['attractions']}',style: TextStyle(fontSize: zsp(23),color: Color(0xFF5E5E5E)),), ], ), ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE4E6E7),indent: hsp(30),endIndent: hsp(30),), Container( padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)), color: Colors.white, width: MediaQuery.of(context).size.width, height: hsp(80), child: Row( children: [ GestureDetector( onTap: (){ _showAlert(0); }, child: RichText( text: TextSpan( text: '${_msgDict['dtFlightInformation']['partnerName']} ', style: TextStyle(fontSize: zsp(26),color: Color(0xFF3283D9)), children: [ TextSpan( text: '>', style: TextStyle(color: Color(0xFFC1C1C1)), ) ] ), ), ), Container(width: wsp(40),), GestureDetector( onTap: (){ _showAlert(0); }, child: RichText( text: TextSpan( text: '${_msgDict['dtFlightInformation']['model']} ', style: TextStyle(fontSize: zsp(26),color: Color(0xFF3283D9)), children: [ TextSpan( text: '>', style: TextStyle(color: Color(0xFFC1C1C1)), ) ] ), ), ), Container(width: wsp(40),), RichText( text: TextSpan( text: '可乘人数${_msgDict['dtFlightInformation']['seatNum']}人 ', style: TextStyle(fontSize: zsp(26),color: Color(0xFF3283D9)), ), ) ], ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE4E6E7),indent: hsp(30),endIndent: hsp(30),), Container( padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)), child: Text('选择套餐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF222222)),), color: Colors.white, width: MediaQuery.of(context).size.width, ), ListView.builder( itemBuilder: (context,index){ return Container( padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)), width: MediaQuery.of(context).size.width, color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('${_packages[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF333333)),), Container(height: hsp(10),), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ RichText( text: TextSpan( children: [ TextSpan( text: '¥${_packages[index]['discountPrice']}', style: TextStyle(fontSize: zsp(32),color: Color(0xFFEB423B),fontWeight: FontWeight.bold) ) ] ), ), GestureDetector( onTap: (){ _index = index; _getPriceData(); }, child: Container( height: hsp(50), width: hsp(150), decoration: BoxDecoration( color: Color(0xFFEA4D45), borderRadius: BorderRadius.all(Radius.circular(3)) ), alignment: Alignment.center, child: Text('立即预订',style: TextStyle(fontSize: zsp(20),color: Colors.white),), ), ) ], ) ], ), ); }, itemCount: _packages.length, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), shrinkWrap: true, ), Container( height: hsp(88), color: Colors.white, margin: EdgeInsets.only(top: hsp(10)), padding: EdgeInsets.only(left: hsp(30),right: hsp(30)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('预订须知',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),), Icon(Icons.keyboard_arrow_right,color: Color(0xFFC0C0C0),size: hsp(50),) ], ), ), Container( margin: EdgeInsets.only(top: hsp(10)), width: MediaQuery.of(context).size.width, color: Colors.white, padding: EdgeInsets.only(left: hsp(30),top: hsp(20),right: hsp(30)), child: Text('详情',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),), ), Container( padding: EdgeInsets.all(hsp(30)), width: MediaQuery.of(context).size.width, color: Colors.white, child: Text('${_msgDict['content']}',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434)),), ), Container( margin: EdgeInsets.only(top: hsp(10)), width: MediaQuery.of(context).size.width, color: Colors.white, padding: EdgeInsets.only(left: hsp(30),bottom: hsp(20),top: hsp(20),right: hsp(30)), child: Text('相关推荐',style: TextStyle(fontSize: zsp(30),color: Color(0xFF343434),fontWeight: FontWeight.bold),), ), Container( padding: EdgeInsets.only(left: hsp(30),right: hsp(30)), width: MediaQuery.of(context).size.width, color: Color(0xFFF1F2F4), child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: hsp(20), crossAxisSpacing: hsp(20), childAspectRatio: 345/381 ), itemBuilder: (context, index) { return Column( children: [ Container( width: (MediaQuery.of(context).size.width-hsp(80))/2, height: (MediaQuery.of(context).size.width-hsp(80))/2/(345/381)*0.6, decoration: BoxDecoration( color: Colors.lightGreen, borderRadius: BorderRadius.only(topLeft: Radius.circular(8),topRight: Radius.circular(8)), image: DecorationImage( image: NetworkImage('${_msgDict['recommendAirTourList'][index]['background']}'), fit: BoxFit.fill ) ), ), Container( width: (MediaQuery.of(context).size.width-hsp(80))/2, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8),bottomRight: Radius.circular(8)), ), padding: EdgeInsets.all(hsp(20)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(' ${_msgDict['recommendAirTourList'][index]['title']}',style: TextStyle(fontSize: zsp(26),color: Color(0xFF333333)),), RichText( text: TextSpan( text: '¥', style: TextStyle(fontSize: zsp(24),color: Color(0xFFEA413A)), children: [ TextSpan( text: '${_msgDict['recommendAirTourList'][index]['discountPrice']}', style: TextStyle(fontSize: zsp(38),fontWeight: FontWeight.bold) ), TextSpan( text: '元起' ) ] ), ), ], crossAxisAlignment: CrossAxisAlignment.start, ), ) ], ); }, itemCount: (_msgDict['recommendAirTourList']).length, shrinkWrap: true, padding: EdgeInsets.only(top: hsp(20),bottom: hsp(20)), physics: NeverScrollableScrollPhysics(), ) ) ], ), ), ), Container( margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(110)), height: hsp(110), color: Colors.white, padding: EdgeInsets.only(left: wsp(40),right: wsp(40)), alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( mainAxisSize: MainAxisSize.min, children: [ Icon(Icons.headset,color: Color(0xFF666666),size: zsp(40),), Text('咨询',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),) ], ), Column( mainAxisSize: MainAxisSize.min, children: [ Icon(Icons.star_border,color: Color(0xFF666666),size: zsp(40),), Text('加入收藏',style: TextStyle(fontSize: zsp(22),color: Color(0xFF767676)),) ], ), GestureDetector( onTap: (){ _index = 9999; _postOrderData(); }, child: Container( height: hsp(80), width: MediaQuery.of(context).size.width*0.6, decoration: BoxDecoration( color: Color(0xFF007EFF), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('立即预订',style: TextStyle(fontSize: zsp(36),color: Colors.white,fontWeight: FontWeight.bold),), ), ) ], ), ) ], ), ), if(_isOrder==true)GestureDetector( onTap: (){ setState(() { _isOrder = false; }); }, child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, color: Colors.black54, child: SingleChildScrollView( child: GestureDetector( onTap: (){}, child: Column( children: [ Container( height: MediaQuery.of(context).size.height*0.8-hsp(120), width: MediaQuery.of(context).size.width, margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2), decoration: BoxDecoration( color: Color(0xFFF1F2F3), borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)) ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: hsp(100), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)) ), padding: EdgeInsets.only(left: 15,right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container(width: wsp(50),), Text('订单确认',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), GestureDetector( child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), onTap: (){ setState(() { _isOrder = false; }); }, ), ], ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),), Container( height: MediaQuery.of(context).size.height*0.8-hsp(220)-0.5, child: SingleChildScrollView( padding: EdgeInsets.all(0), child: Column( children: [ Container( padding: EdgeInsets.all(hsp(30)), color: Colors.white, width: MediaQuery.of(context).size.width, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('使用日期',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),), Container( margin: EdgeInsets.only(top: hsp(20)), child: Row( children: [ Container( height: hsp(120), width: MediaQuery.of(context).size.width-hsp(200), child: ListView.separated( itemBuilder: (context,index){ return GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ setState(() { _selected = index; }); }, child: Stack( children: [ Container( height: hsp(120), width: (MediaQuery.of(context).size.width-hsp(230))/3, decoration: BoxDecoration( color: index==_selected?Color(0xFF007EFF):Color(0xFFF0EEEE), borderRadius: BorderRadius.all(Radius.circular(5)) ), alignment: Alignment.center, child: Text('${_priceList[index]['time']} \n¥${_priceList[index]['price']}', style: TextStyle(fontSize: zsp(20),color: index==_selected?Colors.white:Color(0xFF8B8B8B)),textAlign: TextAlign.center,), ), if(_selected==index)Container( child: Text(timeTag('${_priceList[index]['time']}'),style: TextStyle(fontSize: zsp(16),color: Color(0xFF007EFF)),), height: hsp(30), padding: EdgeInsets.only(left: wsp(3),right: wsp(3)), decoration: BoxDecoration( color: Color(0xFFF7F7F7), borderRadius: BorderRadius.only(topLeft: Radius.circular(3),bottomRight: Radius.circular(5)) ), alignment: Alignment.center, ), ], ), ); }, separatorBuilder: (context,index){ return Container(width: hsp(15),color: Colors.white,); }, itemCount: _priceList.length, padding: EdgeInsets.all(0), scrollDirection: Axis.horizontal, ), ), GestureDetector( onTap: (){ showModalBottomSheet( context: context, builder: (context){ return YSDatePicker( choose: (value){ Map time = {'time':value.split(' ')[0],'price':_priceList[0]['price']}; int index; for(int i=0;i<_priceList.length;i++){ if(_priceList[i]['time']==time['time']){ index = i; } } if(index!=null){ _priceList.removeAt(index); } setState(() { _priceList.insert(0, time); }); }, ); } ); }, behavior: HitTestBehavior.opaque, child: Container( height: hsp(120), width: hsp(140), alignment: Alignment.center, child: Text('更多\n日期',style: TextStyle(fontSize: zsp(26),color: Color(0xFF007EFF)),), ), ) ], ), ), ], ), ), Container( padding: EdgeInsets.all(hsp(30)), color: Colors.white, width: MediaQuery.of(context).size.width, margin: EdgeInsets.only(top: hsp(10),bottom: hsp(10)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('${_msgDict['title']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFF000000),fontWeight: FontWeight.bold),), Text('¥${_packages[_index]['discountPrice']}',style: TextStyle(fontSize: zsp(40),color: Color(0xFFEA413A)),) ], ), Container( child: Text('${_packages[_index]['name']}',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),fontWeight: FontWeight.bold),), margin: EdgeInsets.only(top: hsp(20),bottom: hsp(20)), ), GestureDetector( onTap: (){ _showAlert(0); }, child: RichText( text: TextSpan( text: '预订须知 ', style: TextStyle(fontSize: zsp(24),color: Color(0xFF017EFF)), children: [ TextSpan( text: '>', style: TextStyle(color: Color(0xFF000000)), ) ] ), ), ) ], ), ), if(widget.type==4)Container( height: hsp(80), padding: EdgeInsets.only(left: hsp(30),right: hsp(30)), color: Colors.white, alignment: Alignment.centerLeft, width: MediaQuery.of(context).size.width, child: Text('贺卡服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF333333)),), ), if(widget.type==4)Container( height: hsp(130), padding: EdgeInsets.only(left: hsp(20),right: hsp(20)), margin: EdgeInsets.only(top: 0.5), width: MediaQuery.of(context).size.width, color: Colors.white, child: CupertinoTextField( placeholder: '请输入备注信息或祝福语', placeholderStyle: TextStyle(fontSize: zsp(27),color: Color(0xFF999999)), style: TextStyle(fontSize: zsp(27),color: Color(0xFF999999)), maxLines: 10, decoration: BoxDecoration(), controller: _bless, ), ), GestureDetector( onTap: (){ setState(() { _isShow = !_isShow; }); }, behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.only(left: wsp(40),right: wsp(40),top: hsp(20),bottom: hsp(20)), margin: EdgeInsets.only(top: hsp(10)), color: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('更多服务',style: TextStyle(fontSize: zsp(30),color: Color(0xFF9A9A9A)),), Icon(Icons.keyboard_arrow_down,size: hsp(50),color: Color(0xFFC1C1C1),) ], ) ), ), if(_isShow==true)Container( padding: EdgeInsets.only(left: wsp(32),right: wsp(32),top: hsp(20),bottom: hsp(10)), decoration: BoxDecoration( color: Color(0xFFFAFAFA), borderRadius: BorderRadius.only(bottomRight: Radius.circular(10),bottomLeft: Radius.circular(10)) ), child: ListView.builder( shrinkWrap: true, itemBuilder: (context,index){ return Container( padding: EdgeInsets.only(bottom: wsp(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Text('${_packList[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF999999)),), Container( width: wsp(50), child: GestureDetector( child: Icon(Icons.error_outline,size: hsp(40),color: Color(0xFF999999)), ), ), Text('${_packList[index]['price']}元',style: TextStyle(fontSize: zsp(28),color: Colors.black),), ], ), GestureDetector( child: Container( height: hsp(60), width: hsp(100), child: Image.asset(_chooses.contains(_packList[index])==true?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'), ), onTap: (){ setState(() { if(_chooses.contains(_packList[index])==true){ _chooses.remove(_packList[index]); }else{ _chooses.add(_packList[index]); } }); }, ) ], ), ); }, itemCount: _packList.length, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), ), ) ], ), ), ), ], ), ), Container( height: hsp(120), width: MediaQuery.of(context).size.width, color: Colors.white, padding: EdgeInsets.only(left: wsp(30),right: wsp(30)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ RichText( text: TextSpan( text: '参考价(¥)', style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)), children: [ TextSpan( text: ' ${_getPrice()}', style: TextStyle(fontSize: zsp(40),color: Color(0xFFFF6600)), ) ] ), ), GestureDetector( child: Row( children: [ Text('明细',style: TextStyle(fontSize: zsp(22),color: Color(0xFF181818)),), Icon(Icons.keyboard_arrow_up,size: hsp(30),color: Color(0xFF007EFF),), ], ), onTap: (){ setState(() { _isDetail = !_isDetail; }); }, ), GestureDetector( onTap: (){ _postOrderData(); }, child: Container( height: hsp(70), padding: EdgeInsets.only(left: wsp(50),right: wsp(50)), decoration: BoxDecoration( color: Color(0xFF007EFF), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('立即预约',style: TextStyle(fontSize: zsp(30),color: Colors.white,fontWeight: FontWeight.bold),), ), ) ], ), ) ], ), ), ), ), ), if(_isDetail==true)GestureDetector( onTap: (){ setState(() { _isDetail = false; }); }, child: Container( height: MediaQuery.of(context).size.height-hsp(120), color: Colors.black45, child: Container( margin: EdgeInsets.only(top: MediaQuery.of(context).size.height-hsp(120)-hsp(370)), height: hsp(370), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)) ), child: GestureDetector( onTap: (){}, behavior: HitTestBehavior.opaque, child: Column( children: [ Container( height: hsp(100), padding: EdgeInsets.only(left: 15,right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),), onTap: (){ setState(() { _isDetail = false; }); }, ), Text('明细',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), Container(width: wsp(50),), ], ), ), Container( height: hsp(100), color: Color(0xFFF7F8F9), padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(20),top: hsp(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('座位',style: TextStyle(fontSize: zsp(32),color: Color(0xFF000000),decoration: TextDecoration.none),), Text('¥ ${_priceList[_selected]['price']}',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none),), ], ), ), Container( color: Color(0xFFF7F8F9), height: hsp(170), child: ListView.builder( padding: EdgeInsets.all(0), itemBuilder: (context,index){ return Container( padding: EdgeInsets.only(left: wsp(40),right: wsp(40),bottom: hsp(10)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('${_chooses[index]['name']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),), Text('¥ ${_chooses[index]['price']}',style: TextStyle(fontSize: zsp(28),color: Color(0xFF9A9A9A)),), ], ), ); }, itemCount: _chooses.length, ), ) ], ), ), ), ), ) ], ), ); } _getMarryDetailData() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getTour',parameter: {'id':widget.marryId,'type':widget.type},isLoading: true,isToken: false); if(dict!=null){ setState(() { _msgDict = dict['data']; }); } } _getPackageData() async{ var dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':widget.type},isLoading: true,isToken: false); if(dict!=null){ setState(() { _packages = dict['data']; }); } } _showAlert(int type){ showModalBottomSheet( isScrollControlled: true, context: context, backgroundColor: Colors.transparent, builder: (context){ return Container( height: MediaQuery.of(context).size.height*0.85, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10)) ), child: Column( children: [ Container( height: hsp(100), padding: EdgeInsets.only(left: hsp(30),right: hsp(30)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container(width: wsp(50),), Text('预订须知',style: TextStyle(fontSize: 15,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), GestureDetector( child: Text('关闭',style: TextStyle(fontSize: 15,color: Color(0xFF007EFF),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), onTap: (){ Navigator.pop(context); }, ), ], ), ), Divider(height: 0.5,thickness: 0.5,color: Color(0xFFE5E5E5),), Container( height: MediaQuery.of(context).size.height*0.85-0.5-hsp(100), color: Colors.white, ), ], ), ); } ); } _getPackData() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneservice/get',parameter: {'type':widget.type},isLoading: true,isToken: false); if(dict!=null){ setState(() { _packList = dict['data']; }); } } _getPriceData() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/airplaneorder/getDateAndTime', parameter: {'type':widget.type,'id':_msgDict['id'],'time':_timeStr},isLoading: true,isToken: true); if(dict!=null){ _isOrder = true; _priceList = dict['data']; _getPackData(); } } _getPrice(){ double price = double.parse('${_priceList[_selected]['discountprice']}'); _chooses.forEach((element) { price+=double.parse('${element['price']}'); }); return price.toStringAsFixed(2); } _postOrderData() async{ FocusScope.of(context).unfocus(); Map request = {}; request['flightTime'] = _timeStr; request['type'] = widget.type; request['airlaneId'] = _msgDict['dtFlightInformation']['id']; List array = []; _chooses.forEach((element) { array.add(element['id']); }); if(array.length>0){ request['serviceIds'] = array.join(','); } if(_bless.text.isNotEmpty){ request['des'] = _bless.text; } if(_index!=9999){ request['setmealIds'] = _packages[_index]['id']; } Map dict = await ysRequestHttp(context,type: requestType.post,api: '/app/applets/airplaneorder/createOrder',parameter: request,isLoading: true,isToken: true); if(dict!=null){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSPay(orderDict: dict['data'],type: widget.type==4?payType.marry:widget.type==5?payType.sport:payType.sightseeing,); } ) ); } } }