12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_easyrefresh/easy_refresh.dart';
- import 'package:ysairplane2/code/YSChoosePoint.dart';
- import 'package:ysairplane2/code/YSCity.dart';
- import 'package:ysairplane2/code/YSContractPlaneDetail.dart';
- import 'package:ysairplane2/tools/YSNetWorking.dart';
- import 'package:ysairplane2/tools/YSTools.dart';
- class YSContractPlane extends StatefulWidget {
- @override
- _YSContractPlaneState createState() => _YSContractPlaneState();
- }
- class _YSContractPlaneState extends State<YSContractPlane> {
- int _type = 0;
- int _selected = 0;
- int _plansIndex = 0;
- int _page = 1;
- List _dataArray = [];
- Map _siftDict,_siftDict2;
- Map _startCity,_endCity,_startCity2,_endCity2,_startCity3,_endCity3;
- int _priceIndex = 0;
- int _dateIndex = 0;
- int _dateIndex2 = 0;
- String _timeStr;
- MethodChannel _channel;
- var _endId,_arriveId;
- List _endPoints = [];
- int _endIndex = 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),),
- 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: (){
- dateChooseAlert(context,dateValue: (dateValue){
- timeChooseAlert(context,timeValue: (timeValue){
- DateTime date = DateTime.parse('$dateValue $timeValue');
- 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: <Widget>[
- 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;
- if(_type!=2){
- _refreshData();
- }else{
- setState(() {
- });
- }
- },
- 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),)
- ],
- ),
- ),
- if (_type!=2) Column(
- children: [
- 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,
- ),
- ),
- 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: 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.65,
- padding: EdgeInsets.only(top: hsp(30),left: wsp(40),right: wsp(40)),
- child: ListView.builder(
- itemBuilder: (context,indexSub){
- return Stack(
- children: [
- Container(
- width: (MediaQuery.of(context).size.width-wsp(56))*0.65-wsp(80),
- child: Column(
- children: [
- Text('${_dataArray[index][indexSub==0?'setoutInfo':'arriveInfo']['display']}',style: TextStyle(fontSize: zsp(30),color: Colors.black),),
- Text('${_dataArray[index][indexSub==0?'setoutInfo':'arriveInfo']['airplaneName']}',style: TextStyle(fontSize: zsp(22),color: Color(0xFF999999)),),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- decoration: BoxDecoration(
- border: Border(left: BorderSide(width: 1,color: indexSub==1?Colors.transparent:Color(0xFFEFEFEE)))
- ),
- padding: EdgeInsets.only(left: 15,bottom: hsp(28)),
- margin: EdgeInsets.only(left: hsp(14)),
- ),
- Positioned(
- left: 0,
- width: 12,
- top: 0,
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(50)),
- border: Border.all(color: indexSub==0?Color(0xFF02C094):Color(0xFFFB9658),width: wsp(6))
- ),
- margin: EdgeInsets.only(top: 5),
- ),
- height: 17,
- ),
- Positioned(
- left: 4,
- width: 5,
- top: 0,
- child: Container(color: Colors.white),
- height: 5,
- ),
- Positioned(
- left: 4,
- width: 5,
- top: 17,
- child: Container(color: Colors.white),
- height: 5,
- ),
- ],
- );
- },
- itemCount: 2,
- shrinkWrap: true,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- )
- ),
- Container(
- width: (MediaQuery.of(context).size.width-wsp(56))*0.35,
- 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),
- ),
- )
- )
- ],
- ) else Stack(
- children: [
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(150),
- width: MediaQuery.of(context).size.width,
- color: Color(0xFFF1F2F3),
- child: platformView(
- platforms: (value){
- value.setMethodCallHandler((call) {
- if(call.method=='endPoint'){
- setState(() {
- _endCity3 = call.arguments;
- String str = '${_endCity3['id']}';
- _endId = str.split(',')[0];
- _arriveId = str.split(',')[1];
- });
- }
- return;
- });
- _channel = value;
- }
- )
- ),
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(5)),
- ),
- height: hsp(200)+1,
- margin: EdgeInsets.only(left: hsp(24),top: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(400),right: hsp(24)),
- child: ListView.separated(
- itemBuilder: (context,index){
- return GestureDetector(
- onTap: (){
- if(index==2){
- dateChooseAlert(context,dateValue: (date){
- timeChooseAlert(context,timeValue: (time){
- setState(() {
- _timeStr = '$date $time';
- });
- });
- });
- }else if(index==0){
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSChoosePoint();
- }
- )
- ).then((value){
- if(value!=null){
- _startCity3 = value;
- _getEndPointsData();
- }
- });
- }else{
- if(_startCity3==null)return;
- if(_endCity3!=null){
- for(int i = 0;i<_endPoints.length;i++){
- if(_endPoints[i]['title']==_endCity3['title']){
- _endIndex = i;
- }
- }
- }
- showModalBottomSheet(
- context: context,
- isScrollControlled: true,
- backgroundColor: Colors.transparent,
- barrierColor: Colors.transparent,
- builder: (context){
- return StatefulBuilder(
- builder: (context,chooseSet){
- return Container(
- height: hsp(750),
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(left: hsp(30),right: hsp(30),bottom: hsp(30)),
- height: hsp(600),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: ListView.separated(
- itemCount: _endPoints.length,
- padding: EdgeInsets.all(0),
- itemBuilder: (context,indexSub){
- return GestureDetector(
- onTap: (){
- chooseSet(() {
- _endIndex = indexSub;
- });
- },
- child: Container(
- height: hsp(99),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${_endPoints[indexSub]['title']}',style: TextStyle(fontSize: zsp(30),color: Colors.black),),
- Icon(_endIndex==indexSub?Icons.check_box:
- Icons.check_box_outline_blank,size: hsp(50),color:
- _endIndex==indexSub?Color(0xFF2B7CF6):Color(0xFF818181),)
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,indexSub){
- return Divider(height: 1,thickness: 1,color: Color(0xFFF5F6F7),);
- },
- ),
- ),
- GestureDetector(
- child: Container(
- height: hsp(100),
- margin: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Text('确认',style: TextStyle(fontSize: zsp(36),color: Colors.white,fontWeight: FontWeight.bold),),
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Color(0xFF2B7CF6),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- ),
- onTap: (){
- Navigator.pop(context);
- setState(() {
- _endCity3 = _endPoints[_endIndex];
- String str = '${_endCity3['id']}';
- _endId = str.split(',')[0];
- _arriveId = str.split(',')[1];
- });
- },
- )
- ],
- ),
- );
- },
- );
- }
- );
- }
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- height: hsp(100),
- padding: EdgeInsets.only(left: hsp(30),right: hsp(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(index==0?'出发地点':index==1?'目的地点':'出发时间',style: TextStyle(fontSize: zsp(30),color: Color(0xFFA7A7A7)),),
- Container(
- width: MediaQuery.of(context).size.width-hsp(350),
- child: Text(index==0?(_startCity3==null?'请选择出发地点':'${_startCity3['setoutInfo']['introduce']}'):
- index==1?(_endCity3==null?'请选择目的地点':'${_endCity3['title']}'):
- (_timeStr==null?'请选择出发时间':_timeStr),style: TextStyle(fontSize: zsp(30),color: Color(0xFF443F3F),fontWeight: FontWeight.bold),),
- ),
- Icon(Icons.chevron_right,size: hsp(50),color: Color(0xFFC1C1C1),)
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F6F7),);
- },
- itemCount: 2,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- ),
- ),
- GestureDetector(
- onTap: (){
- if(_startCity3==null){
- ysFlutterToast(context, '请选择出发地点');
- return;
- }
- if(_endId==null){
- ysFlutterToast(context, '请选择目的地点');
- return;
- }
- // if(_timeStr==null){
- // ysFlutterToast(context, '请选择出发时间');
- // return;
- // }
- Navigator.of(context).push(
- CupertinoPageRoute(
- builder: (context){
- return YSContractPlaneDetail(contractId: _endId,isWhole: _type,arriveId: _arriveId,);
- }
- )
- );
- },
- child: Container(
- height: hsp(110),
- margin: EdgeInsets.only(left: hsp(24),top: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44-hsp(150),right: hsp(24)),
- child: Text('任意飞',style: TextStyle(fontSize: zsp(36),color: Colors.white,fontWeight: FontWeight.bold),),
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Color(0xFF2B7CF6),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- ),
- )
- ],
- )
- ],
- ),
- ),
- ),
- );
- }
- Future<void> _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<void> _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(() {
- });
- }
- }
- _getEndPointsData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getFreedomFlyByPartnerId',
- parameter: {'partnerId':_startCity3['partnerId'],'airportIdSetout':_startCity3['airportIdSetout']},isLoading: false,refresh: (){},isToken: true);
- if(dict!=null){
- _endPoints.clear();
- dict['data'].forEach((element) {
- Map temp = {};
- temp['lat'] = element['arriveInfo']['latitude'];
- temp['lng'] = element['arriveInfo']['longitude'];
- temp['title'] = element['arriveInfo']['airplaneName'];
- temp['content'] = element['arriveInfo']['introduce'];
- temp['id'] = "${element['id']},${element['airportIdArrive']}";
- _endPoints.add(temp);
- });
- _channel.invokeMethod('setPoints', {'points':_endPoints,'startPoint':{'lat':_startCity3['setoutInfo']['latitude'],'lng':_startCity3['setoutInfo']['longitude']
- ,'title':_startCity3['setoutInfo']['airplaneName'],'content':_startCity3['setoutInfo']['introduce'],'range':1000}});
- setState(() {});
- }
- }
- }
|