import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ysairplane/tools/YSTools.dart'; class YSSearchResult extends StatefulWidget { @override _YSSearchResultState createState() => _YSSearchResultState(); } class _YSSearchResultState extends State { TextEditingController _searchStr = TextEditingController(); List _tabValues = ['全部','特惠包机','空中游览','短途客运','短途货运','婚庆典礼','特惠包机','短途货运',]; TabController _controller; @override void initState() { super.initState(); _controller = TabController( length: _tabValues.length, vsync: ScrollableState(), ); } @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: Column( children: [ Container( margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(32)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector(child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},), Container( width: MediaQuery.of(context).size.width-wsp(140), margin: EdgeInsets.only(left: wsp(34)), padding: EdgeInsets.only(left: wsp(26),right: wsp(26)), height: hsp(66), decoration: BoxDecoration( border: Border.all(color: Color(0xFF007AFF),width: 1), borderRadius: BorderRadius.all(Radius.circular(5)) ), child: CupertinoTextField( placeholder: '婚庆包机', placeholderStyle: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)), style: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)), prefix: Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),), suffix: GestureDetector(child: Icon(Icons.close,size: hsp(40),color: Color(0xFF8E8E93),),onTap: (){_searchStr.text = '';},), suffixMode: OverlayVisibilityMode.editing, controller: _searchStr, padding: EdgeInsets.all(0), decoration: BoxDecoration(), onSubmitted: (value){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return YSSearchResult(); } ) ); }, textInputAction: TextInputAction.search, ), ), ], ), ), Container( height: hsp(100), child: TabBar( tabs: _tabValues.map((f) { return Text(f); }).toList(), controller: _controller, indicatorColor: Color(0xFF007AFF), indicatorSize: TabBarIndicatorSize.label, isScrollable: true, labelColor: Color(0xFF007AFF), unselectedLabelColor: Colors.black, indicatorWeight: 2.0, labelStyle: TextStyle(height: 2,fontWeight: FontWeight.bold), unselectedLabelStyle: TextStyle(height: 2,fontWeight: FontWeight.normal), ), ), Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(208), color: Color(0xFFF1F2F3), child: TabBarView( controller: _controller, children: _tabValues.map((f) { return f=='全部'?ListView.builder( padding: EdgeInsets.only(left: wsp(36),right: wsp(36)), shrinkWrap: true, itemBuilder: (context,index){ return Column( children: [ Container( height: hsp(84), child: Text('特惠包机',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),), alignment: Alignment.centerLeft, ), ListView.separated( padding: EdgeInsets.all(0), shrinkWrap: true, itemBuilder: (context,indexSub){ return Container( height: hsp(240), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(5)), color: Colors.white, ), child: Row( children: [ Container( height: hsp(240), width: hsp(240), decoration: BoxDecoration( color: Colors.lightGreen, borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5)) ), child: Stack( children: [ if(indexSub%2==0)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), width: MediaQuery.of(context).size.width-wsp(72)-hsp(240), child: Column( children: [ Text('周星星专业婚庆包机',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444),fontWeight: FontWeight.bold),), Container( margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), child: 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(' G450',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('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),), decoration: BoxDecoration( border: Border.all(color: Color(0xFF565656),width: 0.5) ), alignment: Alignment.center, ), ], ), ), RichText( text: TextSpan( text: '¥', style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal), children: [ TextSpan( text: '200,000', style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold), ), TextSpan( text: '元起', ) ] ), ) ], crossAxisAlignment: CrossAxisAlignment.start, ), padding: EdgeInsets.all(hsp(20)), ) ], ), ); }, separatorBuilder: (context,indexSub){ return Divider(height: hsp(24),thickness: hsp(24),color: Color(0xFFF1F2F3),); }, itemCount: 3, physics: NeverScrollableScrollPhysics(), ) ], ); }, itemCount: 2 ):ListView.separated( padding: EdgeInsets.all(hsp(36)), shrinkWrap: true, itemBuilder: (context,indexSub){ return Container( height: hsp(240), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(5)), color: Colors.white, ), child: Row( children: [ Container( height: hsp(240), width: hsp(240), decoration: BoxDecoration( color: Colors.lightGreen, borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5)) ), child: Stack( children: [ if(indexSub%2==0)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), width: MediaQuery.of(context).size.width-wsp(72)-hsp(240), child: Column( children: [ Text('周星星专业婚庆包机',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444),fontWeight: FontWeight.bold),), Container( margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)), child: 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(' G450',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('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),), decoration: BoxDecoration( border: Border.all(color: Color(0xFF565656),width: 0.5) ), alignment: Alignment.center, ), ], ), ), RichText( text: TextSpan( text: '¥', style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal), children: [ TextSpan( text: '200,000', style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold), ), TextSpan( text: '元起', ) ] ), ) ], crossAxisAlignment: CrossAxisAlignment.start, ), padding: EdgeInsets.all(hsp(20)), ) ], ), ); }, separatorBuilder: (context,indexSub){ return Divider(height: hsp(24),thickness: hsp(24),color: Color(0xFFF1F2F3),); }, itemCount: 3, physics: NeverScrollableScrollPhysics(), ); }).toList(), ), ), ], ), ), ); } }