appBar: _currentIndex!=3?AppBar(
leading: IconButton(
icon: Icon(Icons.center_focus_weak,size: 28,color: Colors.black87),
onPressed: null,
),
title: InkWell(
child: Container(
height: ScreenAdaper.height(68),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.8),
borderRadius: BorderRadius.circular(30)
),
padding: EdgeInsets.only(left: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.search),
Text("笔记本",style: TextStyle(fontSize: ScreenAdaper.size(28)),)
],
),
),
onTap: (){
Navigator.pushNamed(context, "/search");
},
),
actions: <Widget>[
IconButton(onPressed: null, icon: Icon(Icons.message,size: 28,color: Colors.black87))
],
):AppBar(
title: Text("用户中心"),
),
Flutter 首页、分类、购物车页面搜索导航布局
搜索页面顶部布局
import 'package:flutter/material.dart';
import 'package:fultter/flutter_jdshop/services/ScreenAdaper.dart';
class SearchPage extends StatefulWidget {
//const SearchPage({Key? key}) : super(key: key);
@override
_SearchPageState createState() => _SearchPageState();
}
class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Container(
child: TextField(
autofocus: true,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none
)
),
),
height: ScreenAdaper.height(68),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.8),
borderRadius: BorderRadius.circular(30)
),
),
actions: [
InkWell(
child: Container(
height: ScreenAdaper.height(68),
width: ScreenAdaper.width(80),
child: Row(
children: [
Text("搜索")
],
),
),
onTap: (){},
)
],
),
body: Text("搜索"),
);
}
}
import 'package:flutter/material.dart';
import 'package:fultter/flutter_jdshop/services/ScreenAdaper.dart';
class SearchPage extends StatefulWidget {
//const SearchPage({Key? key}) : super(key: key);
@override
_SearchPageState createState() => _SearchPageState();
}
class _SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Container(
child: TextField(
autofocus: true,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: BorderSide.none
)
),
),
height: ScreenAdaper.height(68),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.8),
borderRadius: BorderRadius.circular(30)
),
),
actions: [
InkWell(
child: Container(
height: ScreenAdaper.height(68),
width: ScreenAdaper.width(80),
child: Row(
children: [
Text("搜索")
],
),
),
onTap: (){},
)
],
),
body: Container(
padding: EdgeInsets.all(10),
child: ListView(
children: [
Container(
child: Text("热搜",style: Theme.of(context).textTheme.subtitle1,),
),
Divider(),
Wrap(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)
),
child: Text("女装"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("女装"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("笔记本电脑"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("女装111"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("女装"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("女装"),
),
Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.9),
borderRadius: BorderRadius.circular(10)),
child: Text("女装"),
)
],
),
SizedBox(height: 10),
Container(
child: Text("历史记录", style: Theme.of(context).textTheme.subtitle1),
),
Divider(),
Column(
children: <Widget>[
ListTile(
title: Text("女装"),
),
Divider(),
ListTile(
title: Text("女装"),
),
Divider(),
ListTile(
title: Text("男装"),
),
Divider(),
ListTile(
title: Text("手机"),
),
Divider(),
ListTile(
title: Text("鞋子"),
),
Divider(),
],
),
SizedBox(height: 100),
InkWell(
onTap: (){
},
child: Container(
width: ScreenAdaper.width(400),
height: ScreenAdaper.height(64),
decoration: BoxDecoration(
border: Border.all(color: Colors.black45, width: 1)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[Icon(Icons.delete), Text("清空历史记录")],
),
),
)
],
),
)
);
}
}