123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803 |
- import 'dart:convert';
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'package:ysairplane/code/YSCity.dart';
- import 'package:ysairplane/code/YSContractPlaneDetail.dart';
- import 'package:ysairplane/code/YSDoctorPlane.dart';
- import 'package:ysairplane/code/YSHelpPlane.dart';
- import 'package:ysairplane/code/YSHomeMsg.dart';
- import 'package:ysairplane/code/YSMarryPlane.dart';
- import 'package:ysairplane/code/YSSearch.dart';
- import 'package:ysairplane/code/YSShortDetail.dart';
- import 'package:ysairplane/code/YSShortGoods.dart';
- import 'package:ysairplane/code/YSShortPlane.dart';
- import 'package:ysairplane/code/YSTravelling.dart';
- import 'package:ysairplane/tools/YSNetWorking.dart';
- import 'package:flutter_swiper/flutter_swiper.dart';
- import 'package:ysairplane/code/YSNews.dart';
- import 'package:ysairplane/tools/YSTools.dart';
- import 'YSContractPlane.dart';
- import 'YSSightseeingPlane.dart';
- class YSHome extends StatefulWidget {
- @override
- _YSHomeState createState() => _YSHomeState();
- }
- class _YSHomeState extends State<YSHome> with AutomaticKeepAliveClientMixin{
- List _banners = [];
- List _products = [];
- Map _advertising;
- String _city = '';
- List _dataArray = [];
- SwiperController _swiperController = SwiperController();
- @override
- bool get wantKeepAlive => true;
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value){
- _getFeatureDisplayShowData();
- });
- super.initState();
- }
- @override
- void dispose() {
- _swiperController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- super.build(context);
- return Scaffold(
- backgroundColor: Colors.white,
- appBar: CupertinoNavigationBar(
- leading: GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return YSCity();
- }
- )
- ).then((value){
- if(value!=null){
- _city = value['display'];
- _getFeatureDisplayListData(_city);
- }
- });
- },
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- width: hsp(35*(_city.length>5?5:_city.length)),
- child: Text(_city,style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93)),overflow: TextOverflow.ellipsis,),
- ),
- Icon(Icons.keyboard_arrow_down,size: zsp(30),color: Color(0xFF8E8E93),)
- ],
- ),
- ),
- middle: GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return YSSearch();
- }
- )
- );
- },
- child: Container(
- height: hsp(66),
- padding: EdgeInsets.only(left: wsp(30),right: wsp(30)),
- decoration: BoxDecoration(
- color: Color(0xFFF0F0F1),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Row(
- children: [
- Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
- Text(' 目的地·酒店·关键词',style: TextStyle(fontSize: zsp(28),color: Color(0xFF8E8E93),fontWeight: FontWeight.normal),)
- ],
- ),
- ),
- ),
- trailing: GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return YSHomeMsg();
- }
- )
- );
- },
- child: Container(
- height: hsp(30),
- width: wsp(30),
- child: Image.asset('lib/images/homeMsg.png'),
- ),
- ),
- border: Border.all(width: 0.5,color: Colors.white),
- ),
- body: Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-94,
- child: SingleChildScrollView(
- padding: EdgeInsets.all(0),
- child: Column(
- children: [
- if(_banners.length>0)Container(
- height: hsp(292),
- margin: EdgeInsets.all(hsp(24)),
- child: Swiper(
- itemBuilder: (BuildContext context, int index) {
- return CachedNetworkImage(
- imageUrl: '${_banners[index]['url']}',
- fit: BoxFit.fill,
- );
- },
- itemCount: _banners.length,
- scrollDirection: Axis.horizontal,
- loop: true,
- duration: 300,
- autoplay: true,
- onTap: (index) {
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _banners[index]['target']==1?YSDoctorPlane():_banners[index]['target']==2?YSHelpPlane():_banners[index]['target']==3?
- YSShortGoods():_banners[index]['target']==4?YSMarryPlane(type: _banners[index]['target'],marryId: _banners[index]['targerId'],):_banners[index]['target']==5?
- YSMarryPlane(type: _banners[index]['target'],marryId: _banners[index]['targerId'],):
- _banners[index]['target']==6?YSShortDetail(shortId: _banners[index]['targerId'],):_banners[index]['target']==7?
- YSTravelling():_banners[index]['target']==8?YSContractPlaneDetail(contractId: _banners[index]['targerId'],):_banners[index]['target']==9?YSMarryPlane(type: _banners[index]['target'],
- marryId: _banners[index]['targerId'],):YSNews();
- }
- )
- );
- },
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- builder: DotSwiperPaginationBuilder(
- color: Colors.white,
- activeColor: Colors.white,
- size: 5.0,
- activeSize: 10.0
- ),
- ),
- autoplayDisableOnInteraction : true,
- controller: _swiperController,
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: hsp(24),right: hsp(24),top: hsp(15),bottom: hsp(30)),
- child: GridView.builder(
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 5,
- crossAxisSpacing: wsp(51),
- mainAxisSpacing: hsp(36),
- childAspectRatio: 0.75
- ),
- itemBuilder: (context,index){
- return GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _products[index]['target']==1?YSDoctorPlane():_products[index]['target']==2?YSHelpPlane():_products[index]['target']==3?YSShortGoods():
- _products[index]['target']==4?YSSightseeingPlane(type: planeType.marry,):_products[index]['target']==5?YSSightseeingPlane(type: planeType.sport,):_products[index]['target']==6?YSShortPlane():
- _products[index]['target']==7?YSTravelling():_products[index]['target']==8?YSContractPlane():_products[index]['target']==9?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
- }
- )
- );
- },
- child: Container(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- CachedNetworkImage(
- width: 40,
- height: 40,
- imageUrl: '${_products[index]['url']}',
- fit: BoxFit.fill
- ),
- Text('${_products[index]['name']}',style: TextStyle(fontSize: zsp(23),color: Color(0xFF34373A)),)
- ],
- ),
- ),
- );
- },
- itemCount: _products.length,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- ),
- ),
- if(_advertising!=null)Container(
- margin: EdgeInsets.only(left: hsp(24),right: hsp(24),bottom: hsp(24)),
- height: wsp(136),
- decoration: BoxDecoration(
- image: DecorationImage(
- image: NetworkImage('${_advertising['url']}'),
- fit: BoxFit.fill
- )
- ),
- ),
- Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),),
- ListView.separated(
- itemBuilder: (context,index){
- return _dataArray[index]['displayType']=='1'?Column(
- children: [
- Container(
- height: hsp(100),
- padding: EdgeInsets.all(hsp(24)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- children: [
- Container(
- height: hsp(36),
- width: wsp(5),
- color: Color(0xFF3676EC),
- margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
- ),
- Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
- ],
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
- _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
- _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
- }
- )
- );
- },
- child: Row(
- children: [
- Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
- ],
- ),
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
- Container(
- height: hsp(387),
- margin: EdgeInsets.all(hsp(24)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- child: Stack(
- children: [
- Container(
- height: hsp(387),
- width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: ClipRRect(
- child: CachedNetworkImage(
- imageUrl: '${_dataArray[index]['dtAirTours'][0]['cover']}',
- fit: BoxFit.fill,
- ),
- borderRadius: BorderRadius.all(Radius.circular(5)),
- )
- ),
- Container(
- height: hsp(40),
- alignment: Alignment.centerLeft,
- child: Text('${_dataArray[index]['dtAirTours'][0]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- decoration: BoxDecoration(
- color: Colors.black26,
- borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
- ),
- padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
- )
- ],
- ),
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
- YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
- [0]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][0]['id'],):
- _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][0]['id'],):_dataArray[index]['target']=='7'?
- YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][0]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
- marryId: _dataArray[index]['dtAirTours'][0]['id'],):YSNews();
- }
- )
- );
- },
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- child: Stack(
- children: [
- Container(
- height: hsp(387)/2-wsp(6),
- width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: ClipRRect(
- child: CachedNetworkImage(
- imageUrl: '${_dataArray[index]['dtAirTours'][1]['cover']}',
- fit: BoxFit.fill,
- ),
- borderRadius: BorderRadius.all(Radius.circular(5)),
- )
- ),
- Container(
- height: hsp(40),
- alignment: Alignment.centerLeft,
- child: Text('${_dataArray[index]['dtAirTours'][1]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- decoration: BoxDecoration(
- color: Color(0xFFEC6163),
- borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
- ),
- padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
- )
- ],
- ),
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
- YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
- [1]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][1]['id'],):
- _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][1]['id'],):_dataArray[index]['target']=='7'?
- YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][1]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
- marryId: _dataArray[index]['dtAirTours'][1]['id'],):YSNews();
- }
- )
- );
- }
- ),
- GestureDetector(
- child: Stack(
- children: [
- Container(
- height: hsp(387)/2-wsp(6),
- width: (MediaQuery.of(context).size.width-wsp(24)*2-wsp(6))/2,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: ClipRRect(
- child: CachedNetworkImage(
- imageUrl: '${_dataArray[index]['dtAirTours'][2]['cover']}',
- fit: BoxFit.fill,
- ),
- borderRadius: BorderRadius.all(Radius.circular(5)),
- )
- ),
- Container(
- height: hsp(40),
- alignment: Alignment.centerLeft,
- child: Text('${_dataArray[index]['dtAirTours'][2]['title']}',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- decoration: BoxDecoration(
- color: Color(0xFFFB882E),
- borderRadius: BorderRadius.only(bottomRight: Radius.circular(5),topLeft: Radius.circular(5))
- ),
- padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
- )
- ],
- ),
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
- YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
- [2]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type:_dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][2]['id'],):
- _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][2]['id'],):_dataArray[index]['target']=='7'?
- YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][2]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
- marryId: _dataArray[index]['dtAirTours'][2]['id'],):YSNews();
- }
- )
- );
- }
- ),
- ],
- )
- ],
- ),
- ),
- ],
- ):_dataArray[index]['displayType']=='2'?Column(
- children: [
- Container(
- height: hsp(100),
- color: Colors.white,
- padding: EdgeInsets.all(hsp(24)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- children: [
- Container(
- height: hsp(36),
- width: wsp(5),
- color: Color(0xFF3676EC),
- margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
- ),
- Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
- ],
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
- _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
- _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
- }
- )
- );
- },
- child: Row(
- children: [
- Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
- ],
- ),
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
- Container(
- height: hsp(420),
- margin: EdgeInsets.only(top: hsp(24),bottom: hsp(24),left: wsp(40),right: wsp(24)),
- child: Swiper(
- itemBuilder: (BuildContext context, int indexSub) {
- return GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
- YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
- [indexSub]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):
- _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='7'?
- YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
- marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):YSNews();
- }
- )
- );
- },
- child: Container(
- width: wsp(350),
- margin: EdgeInsets.only(bottom: hsp(20),top: hsp(10)),
- decoration: BoxDecoration(
- color: Colors.white,
- boxShadow: [
- BoxShadow(
- color: Color(0x1A000000),
- blurRadius: wsp(20),
- offset: Offset(1, 1),
- )
- ]
- ),
- child: Column(
- children: [
- Stack(
- children: [
- Container(
- height: hsp(200),
- width: wsp(350),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
- ),
- child: ClipRRect(
- child: CachedNetworkImage(
- imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
- fit: BoxFit.fill,
- ),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
- )
- ),
- Row(
- children: [
- Container(
- height: hsp(32),
- alignment: Alignment.centerLeft,
- child: Text('西安',style: TextStyle(fontSize: zsp(20),color: Colors.white),),
- decoration: BoxDecoration(
- color: Color(0xFFE9C68E),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
- ),
- padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
- )
- ],
- )
- ],
- ),
- Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
- ),
- child: Column(
- children: [
- Container(
- width: wsp(350),
- child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',
- style: TextStyle(fontSize: zsp(28),fontWeight: FontWeight.bold,color: Color(0xFF181818)),overflow: TextOverflow.ellipsis,maxLines: 2,),
- margin: EdgeInsets.only(top: hsp(20),bottom: hsp(15)),
- ),
- SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text('${_dataArray[index]['dtAirTours'][indexSub]['price']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text(' 元起',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text('${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}人体验',style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal),),
- ],
- ),
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- padding: EdgeInsets.all(hsp(20)),
- )
- ],
- ),
- ),
- );
- },
- itemCount: (_dataArray[index]['dtAirTours']).length,
- scrollDirection: Axis.horizontal,
- loop: true,
- viewportFraction: 0.5,
- scale: 0.8,
- onTap: (index) {
- debugPrint("点击了第:$index个");
- },
- ),
- ),
- ],
- ):Column(
- children: [
- Container(
- height: hsp(100),
- color: Colors.white,
- padding: EdgeInsets.all(hsp(24)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- children: [
- Container(
- height: hsp(36),
- width: wsp(5),
- color: Color(0xFF3676EC),
- margin: EdgeInsets.only(right: wsp(20),top: hsp(8)),
- ),
- Text('${_dataArray[index]['labelName']}',style: TextStyle(fontSize: zsp(36),color: Color(0xFF181818),fontWeight: FontWeight.bold),)
- ],
- ),
- GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?YSShortGoods():
- _dataArray[index]['target']=='4'?YSSightseeingPlane(type: planeType.marry,):_dataArray[index]['target']=='5'?YSSightseeingPlane(type: planeType.sport,):_dataArray[index]['target']=='6'?YSShortPlane():
- _dataArray[index]['target']=='7'?YSTravelling():_dataArray[index]['target']=='8'?YSContractPlane():_dataArray[index]['target']=='9'?YSSightseeingPlane(type: planeType.sightseeing,):YSNews();
- }
- )
- );
- },
- child: Row(
- children: [
- Text('更多',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
- Icon(Icons.keyboard_arrow_right,size: hsp(30),color: Color(0xFF999999),)
- ],
- ),
- )
- ],
- ),
- ),
- Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F2),),
- Container(
- height: hsp(470),
- margin: EdgeInsets.all(hsp(24)),
- child: ListView.separated(
- scrollDirection: Axis.horizontal,
- itemBuilder: (context,indexSub){
- return GestureDetector(
- onTap: (){
- Navigator.of(context,rootNavigator: true).push(
- CupertinoPageRoute(
- builder: (context){
- return _dataArray[index]['target']=='1'?YSDoctorPlane():_dataArray[index]['target']=='2'?YSHelpPlane():_dataArray[index]['target']=='3'?
- YSShortGoods():_dataArray[index]['target']=='4'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours']
- [indexSub]['id'],):_dataArray[index]['target']=='5'?YSMarryPlane(type: _dataArray[index]['target'],marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):
- _dataArray[index]['target']=='6'?YSShortDetail(shortId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='7'?
- YSTravelling():_dataArray[index]['target']=='8'?YSContractPlaneDetail(contractId: _dataArray[index]['dtAirTours'][indexSub]['id'],):_dataArray[index]['target']=='9'?YSMarryPlane(type: _dataArray[index]['target'],
- marryId: _dataArray[index]['dtAirTours'][indexSub]['id'],):YSNews();
- }
- )
- );
- },
- child: Container(
- height: hsp(450),
- width: wsp(350),
- decoration: BoxDecoration(
- color: Colors.white,
- boxShadow: [
- BoxShadow(
- color: Color(0x1A000000),
- blurRadius: wsp(20),
- offset: Offset(1, 1),
- )
- ]
- ),
- child: Column(
- children: [
- Stack(
- children: [
- Container(
- height: hsp(210),
- width: wsp(330),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
- ),
- child: ClipRRect(
- child: CachedNetworkImage(
- imageUrl: '${_dataArray[index]['dtAirTours'][indexSub]['cover']}',
- fit: BoxFit.fill,
- ),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),topRight: Radius.circular(5)),
- )
- ),
- Row(
- children: [
- if(_dataArray[index]['dtAirTours'][indexSub]['isVip']==1)Container(
- height: hsp(32),
- width: wsp(59),
- decoration: BoxDecoration(
- color: Color(0xFFE9C68E),
- borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
- ),
- padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
- child: Image.asset('lib/images/vip.png'),
- )
- ],
- )
- ],
- ),
- Container(
- height: hsp(240),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(bottomLeft: Radius.circular(5),bottomRight: Radius.circular(5)),
- ),
- child: Column(
- children: [
- Container(
- width: wsp(330),
- child: Text('${_dataArray[index]['dtAirTours'][indexSub]['title']}',style: TextStyle(fontSize: zsp(32),fontWeight: FontWeight.bold,color: Color(0xFF181818)),overflow: TextOverflow.ellipsis,),
- ),
- Row(
- children: [
- Container(
- height: hsp(30),
- child: Row(
- children: [
- Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
- Text(' ${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['model']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
- ],
- ),
- color: Color(0xFF000000),
- padding: EdgeInsets.only(left: wsp(7),right: wsp(7)),
- ),
- Container(
- height: hsp(30),
- decoration: BoxDecoration(
- border: Border.all(color: Color(0xFF000000),width: 0.1)
- ),
- padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
- child: Text('座位${_dataArray[index]['dtAirTours'][indexSub]['dtFlightInformation']['seatNum']}',style: TextStyle(fontSize: zsp(18),color: Color(0xFF565656)),),
- alignment: Alignment.center,
- )
- ],
- ),
- Text('${_dataArray[index]['dtAirTours'][indexSub]['flightTime']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFFA2A2A2)),),
- SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- child: Row(
- children: [
- Text('¥',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text('${_dataArray[index]['dtAirTours'][indexSub]['discountPrice']}',style: TextStyle(fontSize: zsp(38),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text(' 元起/座',style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.bold),),
- Text(' ¥${_dataArray[index]['dtAirTours'][indexSub]['price']}元起/座',style: TextStyle(fontSize: zsp(16),color: Color(0xFFA2A2A2),fontWeight: FontWeight.normal),),
- ],
- ),
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- padding: EdgeInsets.all(hsp(20)),
- )
- ],
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(
- color: Colors.white,
- width: wsp(14),
- );
- },
- itemCount: (_dataArray[index]['dtAirTours']).length,
- padding: EdgeInsets.only(bottom: hsp(20)),
- ),
- ),
- ],
- );
- },
- separatorBuilder: (context,index){
- return Divider(height: 10,thickness: 10,color: Color(0xFFF5F6F8),);
- },
- itemCount: _dataArray.length,
- padding: EdgeInsets.all(0),
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- ),
- Container(
- height: 30,
- color: Color(0xFFF5F6F8),
- )
- ],
- ),
- ),
- ),
- );
- }
- _getFeatureDisplayShowData() async{
- Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/featureDisplay/show',parameter: {},isLoading: false,isToken: false);
- if(dict!=null){
- _banners = dict['data']['banner'];
- _products = dict['data']['product'];
- _advertising = dict['data']['advertising'];
- SharedPreferences prefer = await SharedPreferences.getInstance();
- if(prefer.getString('cityHistory')!=null){
- String historyStr = prefer.getString('cityHistory');
- List historyList = jsonDecode(historyStr);
- _city = '${historyList[0]['display']}';
- }else{
- _city = '';
- }
- _getFeatureDisplayListData(_city);
- }
- }
- _getFeatureDisplayListData(String city) async {
- Map dict = await ysRequestHttp(context, type: requestType.get,api: '/app/applets/featureDisplay/list',parameter: {'city':city},isLoading: true,isToken: false);
- if (dict != null) {
- setState(() {
- _dataArray = dict['data'];
- });
- }
- }
- }
|