1

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DashPage(),
);
}
} class DashPage extends StatefulWidget {
@override
_DashPageState createState() => _DashPageState();
} class _DashPageState extends State<DashPage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 4,
child: Scaffold(
bottomNavigationBar: TabBar(
tabs: <Widget>[
Tab(icon: Icon(Icons.home), text: "Home"),
Tab(icon: Icon(Icons.search), text: "Search"),
Tab(icon: Icon(Icons.file_download), text: "Download"),
Tab(icon: Icon(Icons.list), text: "More"),
],
unselectedLabelColor: Colors.grey, // 未选中时的颜色
labelColor: Colors.blue, // 选中时的颜色
),
body: TabBarView(
children: <Widget>[
Center(child: Text('Home Page')),
Center(child: Text('Search Page')),
Center(child: Text('Download Page')),
Center(child: Text('More Page')),
],
),
),
);
}
}

2

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DashPage(),
);
}
} class DashPage extends StatefulWidget {
@override
_DashPageState createState() => _DashPageState();
} class _DashPageState extends State<DashPage> {
int _currentIndex = 0;
final PageController _controller = PageController();
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
fixedColor: Colors.purple,
onTap: (int index) {
setState(() {
_currentIndex = index;
_controller.jumpToPage(index);
});
},
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
activeIcon: Icon(Icons.home),
title: Text("Home")),
BottomNavigationBarItem(
icon: Icon(Icons.search),
activeIcon: Icon(Icons.search),
title: Text("Search")),
BottomNavigationBarItem(
icon: Icon(Icons.file_download),
activeIcon: Icon(Icons.file_download),
title: Text("Search")),
BottomNavigationBarItem(
icon: Icon(Icons.list),
activeIcon: Icon(Icons.list),
title: Text("More")),
],
),
body: PageView(
controller: _controller,
onPageChanged: (int index) {
setState(() {
_currentIndex = index;
});
},
children: <Widget>[
Center(child: Text('Home Page')),
Center(child: Text('Search Page')),
Center(child: Text('Download Page')),
Center(child: Text('More Page')),
],
),
);
}
}

Flutter 创建dashboard页面的更多相关文章

  1. Flutter - 创建侧滑菜单(不使用navigatior,仅改变content)

    之前写过一篇文章,Flutter - 创建横跨所有页面的侧滑菜单.这个里面中使用了Navigator.of(context).push来导航到新的页面. 这次介绍一种不使用导航,仅仅改变content ...

  2. Flutter - 创建底部导航栏

    之前写过的一篇文章介绍了 Flutter - 创建横跨所有页面的侧滑菜单, 这次就一起来学习一下底部导航栏. 底部导航栏在ios平台上非常常见,app store就是这样的风格.还有就是大家最常用的微 ...

  3. 【Flutter学习】页面跳转之路由及导航

    一,概述 移动应用通常通过成为‘屏幕’或者‘页面’的全屏元素显示其内容,在Flutter中,这些元素统称为路由,它们由导航器Navigator组件管理.导航器管理一组路由Route对象,并提供了管理堆 ...

  4. Django项目:CRM(客户关系管理系统)--04--02PerfectCRM创建ADMIN页面02

    十.CRM项目创建模板页面 {#king_base.html#} {## ————————02PerfectCRM创建ADMIN页面————————#} {#模板文件 king_base.html#} ...

  5. Drupal8开发教程:模块开发——创建新页面

    之前我们已经通过<Drupal8开发教程:认识.info.yml文件>对模块的YAML文件有了了解,今天我们来看如何通过模块开发的方式添加一个新的页面. 在 Drupal 7 中,通过模块 ...

  6. ruby on rails创建的页面訪问很慢

    ruby on rails创建的页面訪问很慢 用rvm安装的ruby1.9.3 解决:cd ~/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/webrick v ...

  7. Ionic2开发笔记(2)创建子页面及其应用

    1. 当你第一次产生ionic2应用程序,这是生成的项目结构 ├── ├── config.xml      这包含配置应用程序的名称,和包名,将被用于我们的应用程序安装到一个实际的设备. ├── h ...

  8. BBS项目详解(forms快速创建登陆页面,登陆验证、通过阅读器进行头像上传的预览、内存管理器)

    BBS项目涉及的知识点 django中知识点 钩子函数(局部钩子和全局钩子) 1.局部钩子就是用来做合法性校验,比如用户名有没有被使用等 2.全局的就是用来做对比校验,比如两次输入的密码是否一致 3. ...

  9. ecplise中创建jsp页面时默认的编码格式为ISO-8859-1,这里我们将其编码格式设置为utf-8

    我们在创建jsp页面时,默认的编码格式为ISO-8859-1,我们如果想要将其改为utf-8还要自己手动去更改. 因此可以设置Jsp默认的编码为utf-8,具体步骤如下: 启动Eclipse,点击菜单 ...

随机推荐

  1. centos7+python+selenium+chrome

    1.安装chrome yum install google-chrome 2.安装chromedriver所有版本的下载地址:https://sites.google.com/a/chromium.o ...

  2. HTTPS是怎么保证数据安全传输的?

    前言 关于HTTPS的连接过程,也是老生常谈的话题了. 其中涉及到的数字证书.电子签名.SSL/TLS.对称加密.非对称加密的问题总是让人摸不清头脑,不知道怎么回答. 今天就和大家再熟悉熟悉这其中千丝 ...

  3. linux 下解决mysql root 权限无法远程连接问题

    问题描述:MySQL数据库安装成功后,在服务器本地可以连接成功,但是使用工具navicat无法进行远程连接,如图: 原因:MySQL默认只允许root帐户在本地登录,如果要在其它机器上连接mysql, ...

  4. form(form基础、标签渲染、错误显示 重置信息、form属性、局部钩子、全局钩子)

    form基础 Django中的Form使用时一般有两种功能: 1.生成html标签 2.验证输入内容 要想使用django提供的form,要在views里导入form模块 from django im ...

  5. DolphinScheduler源码分析之EntityTestUtils类

    1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license ...

  6. [HDU4734] 不要62(数位dp入门)

    >传送门< 题意:统计区间 [a,b] 中不含 4 和 62 的数字有多少个. 思路:数位dp 就是数位上不能有4也不能有连续的62,没有4的话在枚举的时候判断一下,不枚举4就可以保证状态 ...

  7. __getattr__,__getattribute__和__get__的区别

    dir(object)  列出对象的大多数属性 getattr(object, name) 从object对象中获取name字符串指定的属性 hasattr(object, name) 如果objec ...

  8. log查看工具log2console

    log查看工具log2console介绍:https://www.cnblogs.com/TianFang/archive/2013/03/27/2985296.html Log2Console日志监 ...

  9. CF1401-C. Mere Array

    CF1401-C. Mere Array 题意: 给出一个长度为\(n\)的数组\(a\),你可以对这个数组进行如下操作:对于数组\(a\)中任意的两个元素\(a_i\).\(a_j\),若\(gcd ...

  10. CF1462-F. The Treasure of The Segments

    题意: 给出n个线段组成的集合,第i个线段用 \(\{l_i, r_i\}\) 表示线段从坐标轴的点\(l_i\)横跨到点\(r_i\).现在你可以删除其中的一些线段,使得剩下的线段组成的集合中至少存 ...