BottomNavigationBar 组件
   BottomNavigationBar 是底部导航条,可以让我们定义底部 Tab 切换,bottomNavigationBar是 Scaffold 组件的参数。
 
BottomNavigationBar 常见的属性
 
items  List<BottomNavigationBarItem> 底部导航条按钮集合
iconSize  icon
currentIndex 默认选中第几个
onTap 选中变化回调函数
fixedColor 选中的颜色
type  BottomNavigationBarType.fixed  BottomNavigationBarType.shifting
 
案例
 
案例代码
main.dart里面
   return MaterialApp(
       home: Home()
    );


home组件里面
import 'package:flutter/material.dart';

import 'home/index.dart';
import 'home/class.dart';
import 'home/my.dart'; class Home extends StatefulWidget{
Home({Key key});
_HomeState createState() => _HomeState();
} class _HomeState extends State {
var _currentIndex = 0;
var tabs = [Index(), ClassIf(), My()];
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('欢迎')
),
body: tabs[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
type: BottomNavigationBarType.fixed,
onTap: (val) {
setState(() {
_currentIndex = val;
});
},
items: [
BottomNavigationBarItem(
title: Text('首页'),
icon: Icon(Icons.home)
),
BottomNavigationBarItem(
title: Text('分类'),
icon: Icon(Icons.category)
),
BottomNavigationBarItem(
title: Text('我的'),
icon: Icon(Icons.my_location)
),
],
),
);
}
}

tab 切换 和 BottomNavigationBar 自定义 底部导航条的更多相关文章

  1. 15 Flutter BottomNavigationBar自定义底部导航条 以及实现页面切换 以及模块化

    效果: /**  * Flutter  BottomNavigationBar 自定义底部导航条.以及实现页面切换:  * BottomNavigationBar是底部导航条,可以让我们定义底部Tab ...

  2. BottomNavigationBar 自定义 底部导航条

    在flutter中,BottomNavigationBar 是底部导航条,可以让我们定义底部 Tab 切换,bottomNavigationBar是 Scaffold 组件的参数. BottomNav ...

  3. android开发(1):底部导航条的实现 | navigation tab | activity的创建

    底部导航条,在iOS中叫tabbar,在android中叫bottombar或bottom navigation,是一个常用的切换页面的导航条. 同样,如果有良好的第三方库,我们应该优先考虑,能用好别 ...

  4. Android开发关闭虚拟按钮、底部导航条

    在Android开发中,遇到了一系列大大小小的问题,其中一个就是屏蔽底部实体键,我找了很多的博客也尝试了许许多多的方法,但始终不能屏蔽 HOME键,后来看见一篇博客说在Android 4.0以后,屏蔽 ...

  5. 微信小程序-自定义底部导航

    代码地址如下:http://www.demodashi.com/demo/14258.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...

  6. VS 2015 开发Android底部导航条----[实例代码,多图]

      1.废话背景介绍  在Build 2016开发者大会上,微软宣布,Xamarin将被整合进所有版本的Visual Studio之中. 这也就是说,Xamarin将免费提供给所有购买了Visual ...

  7. Android 修改TabLayout底部导航条Indicator的长短

    关于Tablayout,使用的应该很频繁了,但是底部导航条长短是固定死的,需要自己来改动长短,找了半天没找着方法,看了下官方建议,可以通过映射来修改自己想要的长短,其实也就几行代码的问题,看代码: p ...

  8. OS开发(2):自定义tabbar | 导航条 | 突显中间按钮

    tabbar是放在APP底部的控件,也叫navigationbar或导航条.常见的APP都使用tabbar来进行功能分类的管理,比如微信.QQ等等. 需求是这样的,需要一个特殊一点的tabbar,要求 ...

  9. 微信小程序自定义底部导航栏组件+跳转

    微信小程序本来封装有底部导航栏,但对于想自定义样式和方法的开发者来说,这并不是很好. 参考链接:https://github.com/ljybill/miniprogram-utils/tree/ma ...

随机推荐

  1. Centos7添加软链接

    1.pycharm添加软连接: 命令行模式中输入命令: ln -s /root/pycharm-2018.1/bin/pycharm.sh /usr/bin/pycharm ps:代码中/root/p ...

  2. ArcGIS10:ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIS

    [网络转载] 今天将ArcGIS系列的软件从ArcGIS9.3.1升级到ArcGIS10,然后就使用VS创建一个简单的AE应用程序,然后拖放一个toolbar.LicenseControl以及MapC ...

  3. monkey log 处理

    Monkey结果输出 1.保存在pc中 adb shell monkey [option] <count> >d:\monkey.txt 2.保存在手机中 adb shell mon ...

  4. mysql之case..when ..then..else..end as..用法

    1.示例1 查询1: SELECT CASE main_xm_sam31 WHEN '02' THEN 2 ELSE 1 END AS SPDJ FROM SR_MAIN_BG A WHERE A.P ...

  5. C++-POJ3349-Snowflake Snow Snowflakes[STL][set][hash未写]

    错误AC解法,sort+set判重,为考虑异构! 比较坑的一点是读入时scanf一定要一次读6个数,不然会TLE #include <set> #include <map> # ...

  6. zabbix_agentd无法启动,cannot open log 错误

    最近有一台服务器的zabbix启动异常,看日志有如下报错 zabbix_agentd []: cannot open log: cannot create semaphore ] No space l ...

  7. Django_模型

    1. ORM 2. 简单使用 3. 外键 2.0以上的版本要这样写s_grade = models.ForeignKey(Grade,on_delete=models.CASCADE) 3. 修改表名 ...

  8. AAC MDCT

    AAC采用MDCT进行时频变换. 在编码端,以block为单位取出N个sample,乘以合适的window function后再进行MDCT.N通常为2048,256. 每个输入到MDCT的sampl ...

  9. Nginx之server和location配置使用

    配置server代码段: server { server_name www.meiduo.site; listen ; root /home/python/Desktop/meiduo_mall_ad ...

  10. CodeForces Gym 100213F Counterfeit Money

    CodeForces Gym题目页面传送门 有\(1\)个\(n1\times m1\)的字符矩阵\(a\)和\(1\)个\(n2\times m2\)的字符矩阵\(b\),求\(a,b\)的最大公共 ...