• BottomNavigationBar


    该Widget通常在Material design风格的页面框架Widget Scaffold中使用,作为Scaffold的一个bottomNavigationBar属性值。具体使用方法如下:

    int selectedIndex = 1;
      final widgetOptions = [
        Text('This is Home Page'),
        Text('This is Product Page'),
        Text('This is More Page'),
      ];
     
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar( //应用栏
            title: Text(widget.title),
          ),
          body: widgetOptions[selectedIndex], //页面内容
          bottomNavigationBar: BottomNavigationBar( //底部导航栏
            items: <BottomNavigationBarItem>[ //导航栏选项集合
              BottomNavigationBarItem( //底部单个导航栏选项
                icon: Icon(Icons.home), //图标
                title: Text('首页'), //标题
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.list),
                title: Text('产品'),
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.more_horiz),
                title: Text('更多'),
              ),
            ],
            currentIndex: selectedIndex, //当前导航栏选中的索引
            fixedColor: Colors.redAccent, //选中项的标题颜色
            onTap: (index) { //导航栏项点击后的处理方法
              setState(() {
                selectedIndex = index;
              });
            },
          ),
        );
      }
  • 相关阅读:
    03 http请求协议与响应协议
    02 web应用程序
    Django web框架目录
    01 http协议
    Django框架
    Bootstrap栅格系统
    bootstrap介绍和引入
    Python中日志logging模块
    Python 装饰器实现单列模式
    Python 如何理解可更改元组中的可变序列
  • 原文地址:https://www.cnblogs.com/timba1322/p/12487051.html
Copyright © 2020-2023  润新知