123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:ysairplane/code/YSSearchResult.dart';
- import 'package:ysairplane/tools/YSTools.dart';
- class YSSearch extends StatefulWidget {
- @override
- _YSSearchState createState() => _YSSearchState();
- }
- class _YSSearchState extends State<YSSearch> {
- TextEditingController _searchStr = TextEditingController();
- List _historyList = ['婚庆包机','空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览',
- '中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北',
- '中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','中国台北','中国台北',
- '医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机','空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机','婚庆包机',
- '空中浏览','医疗包机','医疗包机','短途货运','空中救援','中国台北','中国台北','医疗包机','医疗包机','婚庆包机婚庆包机'];
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: SingleChildScrollView(
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+hsp(42),left: wsp(32),right: wsp(22)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: MediaQuery.of(context).size.width-wsp(130),
- 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,
- ),
- ),
- GestureDetector(child: Text('取消',style: TextStyle(fontSize: zsp(30),color: Color(0xFF444444)),),onTap: (){Navigator.pop(context);},)
- ],
- ),
- ),
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('定位/历史',style: TextStyle(fontSize: zsp(24),color: Color(0xFF9A9A9A)),),
- Icon(Icons.delete,color: Color(0xFFE0E0E0),size: hsp(40),)
- ],
- ),
- padding: EdgeInsets.only(left: wsp(32),right: wsp(62),top: hsp(34),bottom: hsp(10)),
- ),
- Container(
- height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-hsp(200),
- child: SingleChildScrollView(
- padding: EdgeInsets.only(left: wsp(16)),
- child: Wrap(
- alignment: WrapAlignment.start,
- children: <Widget>[
- for (int i =0;i<_historyList.length;i++ ) GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: (){
- },
- child: Container(
- margin: EdgeInsets.symmetric(vertical: hsp(16), horizontal: hsp(16)),
- decoration: BoxDecoration(
- color: Color(0xFFE0E0E0),
- borderRadius: BorderRadius.all(Radius.circular(3))
- ),
- padding: EdgeInsets.only(left: wsp(40), right: wsp(40),top: hsp(20),bottom: hsp(20)),
- child: Text('${_historyList[i]}', style: TextStyle(fontSize: zsp(26),color: Color(0xFF16181A)), textAlign: TextAlign.center,),
- ),
- )
- ]
- ),
- ),
- )
- ],
- ),
- ),
- physics: NeverScrollableScrollPhysics(),
- ),
- );
- }
- }
|