头部搜索导航布局, 修改主题样式

Posted zhaofeis

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了头部搜索导航布局, 修改主题样式相关的知识,希望对你有一定的参考价值。

import ‘package:flutter/material.dart‘;
import ‘package:flutter_jdshop/services/ScreenAdapter.dart‘;

import ‘Home.dart‘;
import ‘Category.dart‘;
import ‘Cart.dart‘;
import ‘User.dart‘;


class Tabs extends StatefulWidget {
Tabs({Key key}) : super(key: key);

_TabsState createState() => _TabsState();
}

class _TabsState extends State<Tabs> {
int _currentIndex = 0;
PageController _pageController;
@override
void initState() {
super.initState();
this._pageController = new PageController(initialPage: this._currentIndex);
}

List<Widget> _pageList = [HomePage(), CategoryPage(), CartPage(), UserPage()];

@override
Widget build(BuildContext context) {

ScreenAdapter.init(context);

return Scaffold(
appBar: _currentIndex!=3?AppBar(
leading: IconButton(
icon: Icon(Icons.center_focus_weak, size: 28, color: Colors.black87),
onPressed: null,
),
title: InkWell(
child: Container(
height: ScreenAdapter.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: ScreenAdapter.size(28)
))
],
),
),
onTap: (){
Navigator.pushNamed(context, ‘/search‘);

},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.message, size: 28, color: Colors.black87),
onPressed: null,
)
],
):AppBar(
title: Text("用户中心"),
),
body: PageView(
controller: this._pageController,
children: this._pageList,
onPageChanged: (index) {
setState(() {
this._currentIndex = index;
});
},
physics: NeverScrollableScrollPhysics(), //禁止pageView滑动
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: this._currentIndex,
onTap: (index) {
setState(() {
this._currentIndex = index;
this._pageController.jumpToPage(index);
});
},
type: BottomNavigationBarType.fixed,
fixedColor: Colors.red,
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), title: Text("首页")),
BottomNavigationBarItem(
icon: Icon(Icons.category), title: Text("分类")),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart), title: Text("购物车")),
BottomNavigationBarItem(icon: Icon(Icons.people), title: Text("我的"))
],
),
);
}
}

以上是关于头部搜索导航布局, 修改主题样式的主要内容,如果未能解决你的问题,请参考以下文章

48 简单布局1设计头部 2 清除默认样式 3 总体布局的设计

非单页模式下 修改头部显示效果

管理信息系统 课程设计

管理信息系统 课程设计

管理信息系统 课程设计

VUE项目实战16主页Header和左侧菜单栏布局