YSSearch.dart 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/code/YSSearchResult.dart';
  4. import 'package:ysairplane/tools/YSTools.dart';
  5. class YSSearch extends StatefulWidget {
  6. @override
  7. _YSSearchState createState() => _YSSearchState();
  8. }
  9. class _YSSearchState extends State<YSSearch> {
  10. TextEditingController _searchStr = TextEditingController();
  11. List _historyList = ['婚庆包机','空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览',
  12. '中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北',
  13. '中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北',
  14. '医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机',
  15. '空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机'];
  16. @override
  17. Widget build(BuildContext context) {
  18. return Scaffold(
  19. backgroundColor: Colors.white,
  20. body: SingleChildScrollView(
  21. child: Container(
  22. width: MediaQuery.of(context).size.width,
  23. child: Column(
  24. crossAxisAlignment: CrossAxisAlignment.start,
  25. children: [
  26. Container(
  27. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(22)),
  28. child: Row(
  29. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  30. children: [
  31. Container(
  32. width: MediaQuery.of(context).size.width-wsp(130),
  33. padding: EdgeInsets.only(left: wsp(26),right: wsp(26)),
  34. height: hsp(66),
  35. decoration: BoxDecoration(
  36. border: Border.all(color: Color(0xFF007AFF),width: 1),
  37. borderRadius: BorderRadius.all(Radius.circular(5))
  38. ),
  39. child: CupertinoTextField(
  40. placeholder: '婚庆包机',
  41. placeholderStyle: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  42. style: TextStyle(fontSize: zsp(25),color: Color(0xFF545454)),
  43. prefix: Icon(Icons.search,size: hsp(40),color: Color(0xFF8E8E93),),
  44. suffix: GestureDetector(child: Icon(Icons.close,size: hsp(40),color: Color(0xFF8E8E93),),onTap: (){_searchStr.text = '';},),
  45. suffixMode: OverlayVisibilityMode.editing,
  46. controller: _searchStr,
  47. padding: EdgeInsets.all(0),
  48. decoration: BoxDecoration(),
  49. onSubmitted: (value){
  50. Navigator.of(context).push(
  51. CupertinoPageRoute(
  52. builder: (context){
  53. return YSSearchResult();
  54. }
  55. )
  56. );
  57. },
  58. textInputAction: TextInputAction.search,
  59. ),
  60. ),
  61. GestureDetector(child: Text('取消',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444)),),onTap: (){Navigator.pop(context);},)
  62. ],
  63. ),
  64. ),
  65. Container(
  66. child: Row(
  67. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  68. children: [
  69. Text('定位/历史',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
  70. Icon(Icons.delete,color: Color(0xFFE0E0E0),size: hsp(40),)
  71. ],
  72. ),
  73. padding: EdgeInsets.only(left: wsp(32),right: wsp(62),top: hsp(34),bottom: hsp(10)),
  74. ),
  75. Container(
  76. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(200),
  77. child: SingleChildScrollView(
  78. padding: EdgeInsets.only(left: wsp(16)),
  79. child: Wrap(
  80. alignment: WrapAlignment.start,
  81. children: <Widget>[
  82. for (int i =0;i<_historyList.length;i++ ) GestureDetector(
  83. behavior: HitTestBehavior.opaque,
  84. onTap: (){
  85. },
  86. child: Container(
  87. margin: EdgeInsets.symmetric(vertical: hsp(16), horizontal: hsp(16)),
  88. decoration: BoxDecoration(
  89. color: Color(0xFFE0E0E0),
  90. borderRadius: BorderRadius.all(Radius.circular(3))
  91. ),
  92. padding: EdgeInsets.only(left: wsp(40), right: wsp(40),top: hsp(20),bottom: hsp(20)),
  93. child: Text('${_historyList[i]}', style: TextStyle(fontSize: zsp(26),color: Color(0xFF16181A)), textAlign: TextAlign.center,),
  94. ),
  95. )
  96. ]
  97. ),
  98. ),
  99. )
  100. ],
  101. ),
  102. ),
  103. physics: NeverScrollableScrollPhysics(),
  104. ),
  105. );
  106. }
  107. }