flutter 封装的组件
search组件
Widget serachBar(){
return Container(
width: ScreenUtil().setWidth(750),
height: MediaQuery.of(context).padding.top + ScreenUtil().setHeight(80),
decoration: BoxDecoration(
color: Colors.blue,
),
child: Container(
// padding: EdgeInsets.only(bottom:5),
child: Column(
children: <Widget>[
SizedBox(height:MediaQuery.of(context).padding.top + 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Container(
width: ScreenUtil().setWidth(750) * 0.85,
height: ScreenUtil().setHeight(60),
color: Colors.white,
child:Padding(
padding: EdgeInsets.only(left:10,right: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.search,color: Colors.grey,size: 26,),
Container(
// color: Colors.green,
width: 120.0,
height: 30.0,
child: TextField(
style: TextStyle(
decorationColor: Colors.red,
color: Colors.black12,
fontSize: ScreenUtil().setSp(30),
// textBaseline: TextBaseline.alphabetic
),
keyboardType: TextInputType.number,
decoration: InputDecoration(
fillColor: Colors.white30,
border: InputBorder.none, //去掉下划线
prefixStyle: TextStyle(color: Colors.grey),
contentPadding: EdgeInsets.all(8),
hintText: '请输入商品名称',
hintStyle: TextStyle(color: Colors.grey,fontSize: ScreenUtil().setSp(30))
), autofocus: false, ),
) ,
],
),
)
) ,
),
InkWell(
onTap: () { },
child: Icon(CupertinoIcons.photo_camera,color: Colors.white,size: ScreenUtil().setSp(70))
)
//IconButton(alignment: Alignment.topCenter,icon: Icon(CupertinoIcons.photo_camera,color: Colors.white,size: ScreenUtil().setSp(70)), onPressed: (){}),
// Container(
// height: ScreenUtil().setSp(80),
// width: ScreenUtil().setSp(750) * 0.1,
// // color: Colors.grey,
// // padding: EdgeInsets.only(bottom: 10),
// child: IconButton(alignment: Alignment.topCenter,icon: Icon(CupertinoIcons.photo_camera,color: Colors.white,size: ScreenUtil().setSp(70)), onPressed: (){}),
// )
],
),
],
),
),
);
}