YSSearchResult.dart 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane/tools/YSTools.dart';
  4. class YSSearchResult extends StatefulWidget {
  5. @override
  6. _YSSearchResultState createState() => _YSSearchResultState();
  7. }
  8. class _YSSearchResultState extends State<YSSearchResult> {
  9. TextEditingController _searchStr = TextEditingController();
  10. List<String> _tabValues = ['全部','特惠包机','空中游览','短途客运','短途货运','婚庆典礼','特惠包机','短途货运',];
  11. TabController _controller;
  12. @override
  13. void initState() {
  14. super.initState();
  15. _controller = TabController(
  16. length: _tabValues.length,
  17. vsync: ScrollableState(),
  18. );
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. body: SingleChildScrollView(
  24. child: Column(
  25. children: [
  26. Container(
  27. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(32)),
  28. child: Row(
  29. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  30. children: [
  31. GestureDetector(child: Icon(Icons.arrow_back_ios,size: hsp(40),color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},),
  32. Container(
  33. width: MediaQuery.of(context).size.width-wsp(140),
  34. margin: EdgeInsets.only(left: wsp(34)),
  35. padding: EdgeInsets.only(left: wsp(26),right: wsp(26)),
  36. height: hsp(66),
  37. decoration: BoxDecoration(
  38. border: Border.all(color: Color(0xFF007AFF),width: 1),
  39. borderRadius: BorderRadius.all(Radius.circular(5))
  40. ),
  41. child: CupertinoTextField(
  42. placeholder: '婚庆包机',
  43. placeholderStyle: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  44. style: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  45. prefix: Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
  46. suffix: GestureDetector(child: Icon(Icons.close,size: hsp(40),color: Color(0xFF8E8E93),),onTap: (){_searchStr.text = '';},),
  47. suffixMode: OverlayVisibilityMode.editing,
  48. controller: _searchStr,
  49. padding: EdgeInsets.all(0),
  50. decoration: BoxDecoration(),
  51. onSubmitted: (value){
  52. Navigator.of(context).push(
  53. CupertinoPageRoute(
  54. builder: (context){
  55. return YSSearchResult();
  56. }
  57. )
  58. );
  59. },
  60. textInputAction: TextInputAction.search,
  61. ),
  62. ),
  63. ],
  64. ),
  65. ),
  66. Container(
  67. height: hsp(100),
  68. child: TabBar(
  69. tabs: _tabValues.map((f) {
  70. return Text(f);
  71. }).toList(),
  72. controller: _controller,
  73. indicatorColor: Color(0xFF007AFF),
  74. indicatorSize: TabBarIndicatorSize.label,
  75. isScrollable: true,
  76. labelColor: Color(0xFF007AFF),
  77. unselectedLabelColor: Colors.black,
  78. indicatorWeight: 2.0,
  79. labelStyle: TextStyle(height: 2,fontWeight: FontWeight.bold),
  80. unselectedLabelStyle: TextStyle(height: 2,fontWeight: FontWeight.normal),
  81. ),
  82. ),
  83. Container(
  84. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(208),
  85. color: Color(0xFFF1F2F3),
  86. child: TabBarView(
  87. controller: _controller,
  88. children: _tabValues.map((f) {
  89. return f=='全部'?ListView.builder(
  90. padding: EdgeInsets.only(left: wsp(36),right: wsp(36)),
  91. shrinkWrap: true,
  92. itemBuilder: (context,index){
  93. return Column(
  94. children: [
  95. Container(
  96. height: hsp(84),
  97. child: Text('特惠包机',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  98. alignment: Alignment.centerLeft,
  99. ),
  100. ListView.separated(
  101. padding: EdgeInsets.all(0),
  102. shrinkWrap: true,
  103. itemBuilder: (context,indexSub){
  104. return Container(
  105. height: hsp(240),
  106. decoration: BoxDecoration(
  107. borderRadius: BorderRadius.all(Radius.circular(5)),
  108. color: Colors.white,
  109. ),
  110. child: Row(
  111. children: [
  112. Container(
  113. height: hsp(240),
  114. width: hsp(240),
  115. decoration: BoxDecoration(
  116. color: Colors.lightGreen,
  117. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  118. ),
  119. child: Stack(
  120. children: [
  121. if(indexSub%2==0)Container(
  122. height: hsp(32),
  123. width: wsp(59),
  124. decoration: BoxDecoration(
  125. color: Color(0xFFE9C68E),
  126. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  127. ),
  128. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  129. child: Image.asset('lib/images/vip.png'),
  130. )
  131. ],
  132. )
  133. ),
  134. Container(
  135. height: hsp(240),
  136. width: MediaQuery.of(context).size.width-wsp(72)-hsp(240),
  137. child: Column(
  138. children: [
  139. Text('周星星专业婚庆包机',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444),fontWeight: FontWeight.bold),),
  140. Container(
  141. margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
  142. child: Row(
  143. children: [
  144. Container(
  145. color: Color(0xFF000000),
  146. height: hsp(35),
  147. child: Row(
  148. children: [
  149. Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  150. Text(' G450',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  151. ],
  152. ),
  153. padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  154. ),
  155. Container(
  156. padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  157. height: hsp(35),
  158. child: Text('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),),
  159. decoration: BoxDecoration(
  160. border: Border.all(color: Color(0xFF565656),width: 0.5)
  161. ),
  162. alignment: Alignment.center,
  163. ),
  164. ],
  165. ),
  166. ),
  167. RichText(
  168. text: TextSpan(
  169. text: '¥',
  170. style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal),
  171. children: [
  172. TextSpan(
  173. text: '200,000',
  174. style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold),
  175. ),
  176. TextSpan(
  177. text: '元起',
  178. )
  179. ]
  180. ),
  181. )
  182. ],
  183. crossAxisAlignment: CrossAxisAlignment.start,
  184. ),
  185. padding: EdgeInsets.all(hsp(20)),
  186. )
  187. ],
  188. ),
  189. );
  190. },
  191. separatorBuilder: (context,indexSub){
  192. return Divider(height: hsp(24),thickness: hsp(24),color: Color(0xFFF1F2F3),);
  193. },
  194. itemCount: 3,
  195. physics: NeverScrollableScrollPhysics(),
  196. )
  197. ],
  198. );
  199. },
  200. itemCount: 2
  201. ):ListView.separated(
  202. padding: EdgeInsets.all(hsp(36)),
  203. shrinkWrap: true,
  204. itemBuilder: (context,indexSub){
  205. return Container(
  206. height: hsp(240),
  207. decoration: BoxDecoration(
  208. borderRadius: BorderRadius.all(Radius.circular(5)),
  209. color: Colors.white,
  210. ),
  211. child: Row(
  212. children: [
  213. Container(
  214. height: hsp(240),
  215. width: hsp(240),
  216. decoration: BoxDecoration(
  217. color: Colors.lightGreen,
  218. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomLeft: Radius.circular(5))
  219. ),
  220. child: Stack(
  221. children: [
  222. if(indexSub%2==0)Container(
  223. height: hsp(32),
  224. width: wsp(59),
  225. decoration: BoxDecoration(
  226. color: Color(0xFFE9C68E),
  227. borderRadius: BorderRadius.only(topLeft: Radius.circular(5),bottomRight: Radius.circular(5))
  228. ),
  229. padding: EdgeInsets.only(left: wsp(10),right: wsp(10)),
  230. child: Image.asset('lib/images/vip.png'),
  231. )
  232. ],
  233. )
  234. ),
  235. Container(
  236. height: hsp(240),
  237. width: MediaQuery.of(context).size.width-wsp(72)-hsp(240),
  238. child: Column(
  239. children: [
  240. Text('周星星专业婚庆包机',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444),fontWeight: FontWeight.bold),),
  241. Container(
  242. margin: EdgeInsets.only(top: hsp(30),bottom: hsp(30)),
  243. child: Row(
  244. children: [
  245. Container(
  246. color: Color(0xFF000000),
  247. height: hsp(35),
  248. child: Row(
  249. children: [
  250. Image(image: AssetImage('lib/images/vip2.png'),height: hsp(15),width: wsp(16),),
  251. Text(' G450',style: TextStyle(fontSize: zsp(18),color: Color(0xFFF9DEAC)),)
  252. ],
  253. ),
  254. padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  255. ),
  256. Container(
  257. padding: EdgeInsets.only(left: wsp(5),right: wsp(5)),
  258. height: hsp(35),
  259. child: Text('座位30',style: TextStyle(fontSize: zsp(20),color: Color(0xFF565656)),),
  260. decoration: BoxDecoration(
  261. border: Border.all(color: Color(0xFF565656),width: 0.5)
  262. ),
  263. alignment: Alignment.center,
  264. ),
  265. ],
  266. ),
  267. ),
  268. RichText(
  269. text: TextSpan(
  270. text: '¥',
  271. style: TextStyle(fontSize: zsp(20),color: Color(0xFFEB423B),fontWeight: FontWeight.normal),
  272. children: [
  273. TextSpan(
  274. text: '200,000',
  275. style: TextStyle(fontSize: zsp(36),fontWeight: FontWeight.bold),
  276. ),
  277. TextSpan(
  278. text: '元起',
  279. )
  280. ]
  281. ),
  282. )
  283. ],
  284. crossAxisAlignment: CrossAxisAlignment.start,
  285. ),
  286. padding: EdgeInsets.all(hsp(20)),
  287. )
  288. ],
  289. ),
  290. );
  291. },
  292. separatorBuilder: (context,indexSub){
  293. return Divider(height: hsp(24),thickness: hsp(24),color: Color(0xFFF1F2F3),);
  294. },
  295. itemCount: 3,
  296. physics: NeverScrollableScrollPhysics(),
  297. );
  298. }).toList(),
  299. ),
  300. ),
  301. ],
  302. ),
  303. ),
  304. );
  305. }
  306. }