123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997 |
- 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<YSContractPlane> {
- 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: <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;
- _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<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(() {
- });
- }
- }
- }
|