import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:ysairplane/code/YSCity.dart'; import 'package:ysairplane/code/YSContractPlaneDetail.dart'; import 'package:ysairplane/tools/YSNetWorking.dart'; import 'package:ysairplane/tools/YSTools.dart'; class YSContractPlane extends StatefulWidget { @override _YSContractPlaneState createState() => _YSContractPlaneState(); } class _YSContractPlaneState extends State { int _type = 0; int _selected = 0; int _plansIndex = 0; int _page = 1; List _dataArray = []; Map _siftDict,_siftDict2; Map _startCity,_endCity,_startCity2,_endCity2; int _priceIndex = 0; int _dateIndex = 0; int _dateIndex2 = 0; int _distanceIndex = 0; @override void initState() { Future.delayed(Duration(seconds: 0)).then((value){ _refreshData(); _getSiftData(); }); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( endDrawer: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width*0.85, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(10),bottomLeft: Radius.circular(10)) ), child: Column( children: [ Container( height: MediaQuery.of(context).size.height-hsp(100), width: MediaQuery.of(context).size.width*0.85, child: SingleChildScrollView( padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(30),bottom: hsp(30)), child: _type==2?Column( children: [ Container( padding: EdgeInsets.only(left: wsp(30),right: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('航线',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return Container( child: Row( children: [ Text('出发地',style: TextStyle(fontSize: zsp(24),color: Color(0xFF2C7CF6)),), Container( margin: EdgeInsets.only(left: wsp(40)), padding: EdgeInsets.only(left: wsp(30),right: wsp(30)), height: hsp(60), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('西安',style: TextStyle(fontSize: zsp(24),color: Colors.black),), Icon(Icons.keyboard_arrow_right,size: hsp(40),color: Color(0xFF2C7CF6),) ], ) ) ], ), ); }, itemCount: 2, padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), separatorBuilder: (BuildContext context, int index) { return Divider(height: hsp(30),thickness: hsp(30),color: Colors.white,); }, ), ], ), ), Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF4F4F4),), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: wsp(20),bottom: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('行程距离',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), Container( margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), child: Row( children: [ Container( height: hsp(60), width: wsp(180), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('最小距离',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ), Container( height: hsp(3), width: wsp(30), color: Color(0xFFF4F4F4), margin: EdgeInsets.only(left: wsp(33),right: wsp(33)), ), Container( height: hsp(60), width: wsp(180), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('最大距离',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ) ], ), ), ListView.separated( itemBuilder: (context,index){ return Container( height: hsp(60), width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('100公里 -300公里 30%的选择',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ); }, separatorBuilder: (context,index){ return Divider(color: Colors.white,height: hsp(30),thickness: hsp(30),); }, itemCount: 3, shrinkWrap: true, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), ) ], ), ), Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF4F4F4),), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: wsp(20),bottom: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text('出发时间',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), Icon(Icons.keyboard_arrow_right,size: hsp(40),color: Color(0xFF2C7CF6),) ], ), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(top: hsp(30)), height: hsp(90), child: ListView.separated( itemBuilder: (context,index){ return Container( height: hsp(60), width: wsp(200), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('2020.09.18',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ); }, separatorBuilder: (context,index){ return Container(color: Colors.white,width: wsp(24),); }, itemCount: 3, // shrinkWrap: true, scrollDirection: Axis.horizontal, padding: EdgeInsets.all(0), ), ) ], ), ) ], ):Column( children: [ Container( padding: EdgeInsets.only(left: wsp(30),right: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Text('预订方式',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), // Container( // margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), // child: Row( // children: [ // GestureDetector( // child: Container( // height: hsp(60), // width: wsp(180), // decoration: BoxDecoration( // color: _way==0?Color(0xFFECF4FF):Color(0xFFF4F4F4), // border: Border.all(color: _way==0?Color(0xFF2C7CF6):Colors.transparent,width: 1), // borderRadius: BorderRadius.all(Radius.circular(50)) // ), // alignment: Alignment.center, // child: Text('拼座',style: TextStyle(fontSize: zsp(24),color: _way==0?Color(0xFF2C7CF6):Colors.black),), // ), // onTap: (){ // setState(() { // _way = 0; // }); // }, // ), // GestureDetector( // onTap: (){ // setState(() { // _way = 1; // }); // }, // child: Container( // margin: EdgeInsets.only(left: wsp(25)), // height: hsp(60), // width: wsp(180), // decoration: BoxDecoration( // color: _way==1?Color(0xFFECF4FF):Color(0xFFF4F4F4), // border: Border.all(color: _way==1?Color(0xFF2C7CF6):Colors.transparent,width: 1), // borderRadius: BorderRadius.all(Radius.circular(50)) // ), // alignment: Alignment.center, // child: Text('整机',style: TextStyle(fontSize: zsp(24),color: _way==1?Color(0xFF2C7CF6):Colors.black),), // ), // ) // ], // ), // ), Text('航线',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return GestureDetector( onTap: (){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSCity(); } ) ).then((value){ if(value!=null){ if(index==0){ _startCity = value; }else{ _endCity = value; } setState(() { }); } }); }, child: Container( child: Row( children: [ Text('出发地',style: TextStyle(fontSize: zsp(24),color: Color(0xFF2C7CF6)),), Container( margin: EdgeInsets.only(left: wsp(40)), padding: EdgeInsets.only(left: wsp(30),right: wsp(30)), height: hsp(60), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(index==0?'${_startCity!=null?_startCity['display']:'请选择'}':'${_endCity!=null?_endCity['display']:'请选择'}',style: TextStyle(fontSize: zsp(24),color: Colors.black),), Icon(Icons.keyboard_arrow_right,size: hsp(40),color: Color(0xFF2C7CF6),) ], ) ) ], ), ), ); }, itemCount: 2, padding: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), separatorBuilder: (BuildContext context, int index) { return Divider(height: hsp(30),thickness: hsp(30),color: Colors.white,); }, ), ], ), ), Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF4F4F4),), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: wsp(20),bottom: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('价格区间',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), Container( margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), child: Row( children: [ Container( height: hsp(60), width: wsp(180), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text(_siftDict==null?'':'${_siftDict['price'][_priceIndex]['min']}元',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ), Container( height: hsp(3), width: wsp(30), color: Color(0xFFF4F4F4), margin: EdgeInsets.only(left: wsp(33),right: wsp(33)), ), Container( height: hsp(60), width: wsp(180), decoration: BoxDecoration( color: Color(0xFFF4F4F4), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text(_siftDict==null?'':'${_siftDict['price'][_priceIndex]['max']}元',style: TextStyle(fontSize: zsp(24),color: Colors.black),), ) ], ), ), ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ setState(() { _priceIndex = index; }); }, child: Container( height: hsp(60), width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: _priceIndex==index?Color(0xFFECF4FF):Color(0xFFF4F4F4), border: Border.all(color: _priceIndex==index?Color(0xFF2C7CF6):Colors.transparent,width: 1), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('${_siftDict['price'][index]['min']}元 - ${_siftDict['price'][index]['max']}元 ${_siftDict['price'][index]['rate']}的选择', style: TextStyle(fontSize: zsp(24),color: _priceIndex==index?Color(0xFF2C7CF6):Colors.black),), ), ); }, separatorBuilder: (context,index){ return Divider(color: Colors.white,height: hsp(30),thickness: hsp(30),); }, itemCount: _siftDict!=null?_siftDict['price'].length:0, shrinkWrap: true, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), ) ], ), ), Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF4F4F4),), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: wsp(20),bottom: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( onTap: (){ showModalBottomSheet( context: context, builder: (context){ return YSDatePicker( choose: (value){ DateTime date = DateTime.parse(value); String timeStr = '${date.year}.${date.month}.${date.day}'; if(_siftDict['date'].contains(timeStr)==true){ _siftDict['date'].remove(timeStr); } _siftDict['date'].insert(0, timeStr); _dateIndex = 0; setState(() { }); }, ); } ); }, child: Row( children: [ Text('出发时间',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), Icon(Icons.keyboard_arrow_right,size: hsp(40),color: Color(0xFF2C7CF6),) ], ), ), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(top: hsp(30)), height: hsp(90), child: ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ setState(() { _dateIndex = index; }); }, child: Container( height: hsp(60), width: wsp(200), decoration: BoxDecoration( color: _dateIndex==index?Color(0xFFECF4FF):Color(0xFFF4F4F4), border: Border.all(color: _dateIndex==index?Color(0xFF2C7CF6):Colors.transparent,width: 1), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('${_siftDict['date'][index]}',style: TextStyle(fontSize: zsp(24),color: _dateIndex==index?Color(0xFF2C7CF6):Colors.black),), ), ); }, separatorBuilder: (context,index){ return Container(color: Colors.white,width: wsp(24),); }, itemCount: _siftDict!=null?_siftDict['date'].length:0, // shrinkWrap: true, scrollDirection: Axis.horizontal, padding: EdgeInsets.all(0), ), ) ], ), ), Divider(height: hsp(10),thickness: hsp(10),color: Color(0xFFF4F4F4),), Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: wsp(20),bottom: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('航空公司',style: TextStyle(fontSize: zsp(26),color: Colors.black,fontWeight: FontWeight.bold),), Icon(Icons.keyboard_arrow_down,size: hsp(40),color: Color(0xFF2C7CF6),) ], ), if(_siftDict!=null)Container( width: MediaQuery.of(context).size.width*0.85, padding: EdgeInsets.only(top: hsp(20)), child: Wrap( alignment: WrapAlignment.start, children: [ for (int i =0;i<(_siftDict['partner']).length;i++ ) GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ setState(() { _plansIndex = i; }); }, child: Container( margin: EdgeInsets.symmetric(vertical: hsp(16), horizontal: hsp(16)), decoration: BoxDecoration( color: _plansIndex==i?Color(0xFFECF4FF):Color(0xFFF4F4F4), border: Border.all(color: _plansIndex==i?Color(0xFF2C7CF6):Colors.transparent,width: 1), borderRadius: BorderRadius.all(Radius.circular(50)) ), padding: EdgeInsets.only(left: wsp(30), right: wsp(30),top: hsp(10),bottom: hsp(10)), child: Text('${_siftDict['partner'][i]['partnerName']}', style: TextStyle(fontSize: zsp(26),color: _plansIndex==i?Color(0xFF2C7CF6):Colors.black), textAlign: TextAlign.center,), ), ) ] ), ) ], ), ) ], ), ), ), Container( height: hsp(100), padding: EdgeInsets.only(left: wsp(40),right: wsp(40)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: (){ _plansIndex = 0; _priceIndex = 0; _dateIndex = 0; _startCity = null; _endCity = null; _siftDict2 = _siftDict; _siftDict = null; _refreshData(); Navigator.pop(context); }, child: Container( child: Text('重置',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(26),color: Colors.black),), width: (MediaQuery.of(context).size.width*0.85-wsp(100))/2, height: hsp(70), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(50)), border: Border.all(color: Color(0xFFB2B2B2),width: 1) ), ), ), GestureDetector( onTap: (){ _refreshData(); Navigator.pop(context); }, child: Container( child: Text('确定',style: TextStyle(fontWeight: FontWeight.bold,fontSize: zsp(26),color: Colors.white),), width: (MediaQuery.of(context).size.width*0.85-wsp(100))/2, height: hsp(70), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(50)), color: Color(0xFF2C7CF6) ), ), ) ], ), ) ], ), ), backgroundColor: Color(0xFFF1F2F3), body: SingleChildScrollView( child: Container( width: MediaQuery.of(context).size.width, child: Column( children: [ Container( height: MediaQuery.of(context).padding.top+hsp(20)+hsp(100), color: Colors.white, padding: EdgeInsets.only(left: wsp(30),right: wsp(30),top: MediaQuery.of(context).padding.top+hsp(20),bottom: hsp(20)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector(child: Icon(Icons.arrow_back_ios,size: wsp(40),color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},), Container( width: MediaQuery.of(context).size.width-wsp(200), height: hsp(60), decoration: BoxDecoration( color: Color(0xFFF7F7F7), border: Border.all(color: Color(0xFF2C7CF6),width: hsp(2)), borderRadius: BorderRadius.all(Radius.circular(5)), ), child: ListView.separated( padding: EdgeInsets.all(0), itemBuilder: (context,index){ return GestureDetector( onTap: (){ _type = index; _refreshData(); }, child: Container( width: (MediaQuery.of(context).size.width-wsp(200))/3, height: hsp(60), alignment: Alignment.center, child: Text(index==0?'拼座':index==1?'整机':'任意飞',style: TextStyle(color: _type==index?Colors.white:Color(0xFF2C7CF6),fontSize: zsp(26)),), decoration: BoxDecoration( color: _type==index?Color(0xFF2C7DF7):Colors.transparent, borderRadius: index==0?BorderRadius.only(bottomLeft: Radius.circular(2),topLeft: Radius.circular(2)): index==2?BorderRadius.only(topRight: Radius.circular(5),bottomRight: Radius.circular(5)):BorderRadius.all(Radius.circular(0)) ), ), ); }, separatorBuilder: (context,index){ return Container( height: hsp(60), width: hsp(2), color: Color(0xFF2C7CF6), ); }, itemCount: 3, scrollDirection: Axis.horizontal, ), ), Icon(Icons.search,size: wsp(40),color: Color(0xFF000000),) ], ), ), Container( width: MediaQuery.of(context).size.width, height: hsp(80), color: Colors.white, child: ListView.builder( itemBuilder: (context,index){ return GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ if(index==2){ if(_siftDict==null&&_siftDict2!=null){ setState(() { _siftDict = _siftDict2; }); } Scaffold.of(context).openEndDrawer(); }else{ _selected = index; _refreshData(); } }, child: Container( alignment: Alignment.center, width: MediaQuery.of(context).size.width/3, height: hsp(80), child: Text(index==0?'综合':index==1?'销量':'筛选',style: TextStyle(fontSize: zsp(26),color: _selected==index?Color(0xFF007EFF):Color(0xFF222222),fontWeight: _selected==index?FontWeight.bold:FontWeight.normal),), ), ); }, itemCount: 3, scrollDirection: Axis.horizontal, ), ), Stack( children: [ Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(200), child: EasyRefresh( onRefresh: _refreshData, onLoad: _loadMoreData, header: TaurusHeader( ), footer: TaurusFooter( ), child: ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSContractPlaneDetail(contractId: _dataArray[index]['id'],isWhole: _type,); } ) ); }, behavior: HitTestBehavior.opaque, child: _type!=5?Container( padding: EdgeInsets.only(bottom: hsp(30)), margin: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5)) ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: hsp(50), width: wsp(200), alignment: Alignment.center, child: Text(_getDateStr('${_dataArray[index]['flightTime']}'),style: TextStyle(color: Color(0xFF007AFF),fontSize: zsp(24)),), decoration: BoxDecoration( color: Color(0xFFF3F9FF), borderRadius: BorderRadius.only(topLeft: Radius.circular(5)) ), ), Row( children: [ Container( width: (MediaQuery.of(context).size.width-wsp(56))*0.6, padding: EdgeInsets.only(top: hsp(30),left: wsp(40),right: wsp(40)), child: Column( children: [ Row( children: [ Text('${_dataArray[index]['setoutInfo']['display']} ',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),), Container( height: 2, width: wsp(50), color: Color(0xFFCCCCCC), ), Text(' ${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),) ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), Container( child: Row( children: [ Text('${_dataArray[index]['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), Text('${_dataArray[index]['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)), ), Row( children: [ Container( color: Color(0xFF000000), height: hsp(35), child: Row( children: [ Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),), Text(' ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),) ], ), padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), ), Container( padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), height: hsp(35), child: Text('座位${_dataArray[index]['dtFlightInformation']['seatNum']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),), decoration: BoxDecoration( border: Border.all(color: Color(0xFF565656),width: 0.5) ), alignment: Alignment.center, ), ], ) ], ), ), Container( width: (MediaQuery.of(context).size.width-wsp(56))*0.4, child: Column( children: [ RichText( text: TextSpan( text: '¥ ', style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal), children: [ TextSpan( text: '${_dataArray[index]['discountPrice']}', style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold), ), TextSpan( text: ' 元起', ) ] ), ), Container( child: Text('原价: ${_dataArray[index]['price']}元起/座',style: TextStyle(fontSize: zsp(24),color: Color(0xFFA2A2A2),decoration: TextDecoration.lineThrough),), margin: EdgeInsets.only(top: hsp(10)), ) ], ), ), ], ) ], ), ):Container( padding: EdgeInsets.all(hsp(30)), color: Colors.white, child: Row( children: [ Container( height: hsp(240), width: hsp(240), decoration: BoxDecoration( color: Colors.lightGreen, borderRadius: BorderRadius.all(Radius.circular(5)) ), ), Container( width: (MediaQuery.of(context).size.width-hsp(280))*0.55, padding: EdgeInsets.only(top: hsp(30),left: wsp(30),right: wsp(30)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text('${_dataArray[index]['setoutInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),), Container( height: 2, width: wsp(40), color: Color(0xFFCCCCCC), ), Text('${_dataArray[index]['arriveInfo']['display']}',style: TextStyle(fontSize: zsp(40),color: Colors.black,fontWeight: FontWeight.bold),) ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), Container( child: Row( children: [ Text('${_dataArray[index]['setoutInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), Text('${_dataArray[index]['arriveInfo']['airplanename']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),), ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)), ), Row( children: [ Container( color: Color(0xFF000000), height: hsp(35), child: Row( children: [ Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),), Text(' ${_dataArray[index]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),) ], ), padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), ), Container( padding: EdgeInsets.only(left: wsp(5),right: wsp(5)), height: hsp(35), child: Text('座位${_dataArray[index]['dtFlightInformation']['seatNum']}',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),), decoration: BoxDecoration( border: Border.all(color: Color(0xFF565656),width: 0.5) ), alignment: Alignment.center, ), ], ), Container( child: Text('8月12日 18:00',style: TextStyle(fontSize: zsp(28),color: Colors.black,fontWeight: FontWeight.bold),), margin: EdgeInsets.only(top: hsp(20)), ) ], ), ), Container( width: (MediaQuery.of(context).size.width-wsp(280))*0.42, child: Column( children: [ RichText( text: TextSpan( text: '¥ ', style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal), children: [ TextSpan( text: '${_dataArray[index]['discountPrice']}', style: TextStyle(fontSize: zsp(42),fontWeight: FontWeight.bold), ), TextSpan( text: ' 元起', ) ] ), ), Container( child: Text('原价: ${_dataArray[index]['price']}元起/座',style: TextStyle(fontSize: zsp(24),color: Color(0xFFA2A2A2),decoration: TextDecoration.lineThrough),), margin: EdgeInsets.only(top: hsp(10)), ) ], ), ) ], ), ), ); }, separatorBuilder: (context,index){ return Divider(height: hsp(20),thickness: hsp(20),color: Color(0xFFF1F2F3),); }, itemCount: _dataArray.length, padding: EdgeInsets.all(0), ), ) ), ], ) ], ), ), ), ); } Future _refreshData() async{ _page = 1; Map request = {}; request['category'] = 8; request['type'] = _type+1; request['pageNo'] = _page; request['pageSize'] = 10; if(_siftDict!=null&&_siftDict2!=null){ if(_type==2){ if(_startCity2!=null)request['setout'] = _startCity2['display']; if(_endCity2!=null)request['arrive'] = _endCity2['display']; request['maxDistance'] = _siftDict['distance'][_priceIndex]['max']; request['minDistance'] = _siftDict['distance'][_priceIndex]['min']; request['time'] = _siftDict['date'][_dateIndex2].replaceAll('.', '-'); }else{ request['time'] = _siftDict['date'][_dateIndex].replaceAll('.', '-'); request['maxPrice'] = _siftDict['price'][_priceIndex]['max']; request['minPrice'] = _siftDict['price'][_priceIndex]['min']; if(_startCity!=null)request['setout'] = _startCity['display']; if(_endCity!=null)request['arrive'] = _endCity['display']; request['partnerId'] = _siftDict['partner'][_plansIndex]['id']; } } if(_selected==1){ request['sales'] = 1; } Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/list',parameter: request,isLoading: false,isToken: false); if(dict!=null){ setState(() { _dataArray = dict['data']['resultList']; }); } } Future _loadMoreData() async{ _page++; Map request = {}; request['category'] = 8; request['type'] = _type+1; request['pageNo'] = _page; request['pageSize'] = 10; if(_siftDict!=null&&_siftDict2!=null){ if(_type==2){ if(_startCity2!=null)request['setout'] = _startCity2['display']; if(_endCity2!=null)request['arrive'] = _endCity2['display']; request['maxDistance'] = _siftDict['distance'][_priceIndex]['max']; request['minDistance'] = _siftDict['distance'][_priceIndex]['min']; request['time'] = _siftDict['date'][_dateIndex2].replaceAll('.', '-'); }else{ request['time'] = _siftDict['date'][_dateIndex].replaceAll('.', '-'); request['maxPrice'] = _siftDict['price'][_priceIndex]['max']; request['minPrice'] = _siftDict['price'][_priceIndex]['min']; if(_startCity!=null)request['setout'] = _startCity['display']; if(_endCity!=null)request['arrive'] = _endCity['display']; request['partnerId'] = _siftDict['partner'][_plansIndex]['id']; } } if(_selected==1){ request['sales'] = 1; } Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/list',parameter: request,isLoading: false,isToken: false); if(dict!=null){ setState(() { _dataArray.addAll(dict['data']['resultList']); }); } } _getDateStr(String date) { DateTime time = DateTime.parse(date); String timeStr = '${time.month}月${time.day}日 '+time.hour.toString().padLeft(2,'0')+':'+time.minute.toString().padLeft(2,'0'); return timeStr; } _getSiftData() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/preferential/filter',parameter: {},isLoading: false,isToken: false); if(dict!=null){ _siftDict = dict['data']; List array = []; DateTime date = DateTime.now(); for(int i = 0;i<7;i++){ String timeStr = '${date.year}.${date.month}.${date.day}'; array.add(timeStr); date = date.add(Duration(days: 1)); } _siftDict['date'] = array; setState(() { }); } } }